Re: [tip:x86/asm] x86/asm/entry/64: Always allocate a complete " struct pt_regs" on the kernel stack

From: Denys Vlasenko
Date: Sun Mar 22 2015 - 10:15:47 EST


>> @@ -492,7 +496,6 @@ GLOBAL(stub32_clone)
>>
>> ALIGN
>> ia32_ptregs_common:
>> - popq %r11
>> CFI_ENDPROC
>> CFI_STARTPROC32 simple
>> CFI_SIGNAL_FRAME
>> @@ -507,9 +510,9 @@ ia32_ptregs_common:
>> /* CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
>> CFI_REL_OFFSET rsp,RSP-ARGOFFSET
>> /* CFI_REL_OFFSET ss,SS-ARGOFFSET*/
>> - SAVE_REST
>> + SAVE_EXTRA_REGS 8
>> call *%rax
>> - RESTORE_REST
>> - jmp ia32_sysret /* misbalances the return cache */
>> + RESTORE_EXTRA_REGS 8
>> + ret
>> CFI_ENDPROC
>> END(ia32_ptregs_common)
>
> This change is causing Wine to fail when it's built to support both
> 32-bit and 64-bit code:
>
> [ 523.657406] wineserver[1605]: segfault at 453a7c90 ip
> 00000000453a7c90 sp 00000000b3c6ad10 error 14 in
> ld-2.21.so[7fad453a7000+21000]
>
> It tries to exec the 64-bit wineserver from 32-bit code and faults
> because %rip is truncated. This is because simply returning to the
> caller will exit via sysretl which doesn't change %cs to 64-bit mode.
> We need to set a thread flag to enter the slow path and return via
> iret instead.
>
> Patch coming to fix it.

Something like adding

orl $_TIF_NOTIFY_RESUME,TI_flags+THREAD_INFO(%rsp,RIP)

in stub32_execve[at] will probably do it
Please add a comment why it is needed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/