Re: [tip:x86/vdso] x86/vdso32/syscall.S: Do not load __USER32_DS to %ss

From: Brian Gerst
Date: Thu Apr 23 2015 - 08:01:28 EST


On Thu, Apr 23, 2015 at 7:46 AM, Denys Vlasenko <dvlasenk@xxxxxxxxxx> wrote:
> On 04/23/2015 01:28 PM, Brian Gerst wrote:
>>> Looking at the error message:
>>>
>>>> Unhandled exception: stack overflow in 32-bit code (0xf779bc07).
>>>> Register dump:
>>>> CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
>>>> EIP:f779bc07 ESP:00aed60c EBP:00aed750 EFLAGS:00010216( R- -- I -A-P- )
>>>> EAX:00000040 EBX:00000010 ECX:00aed750 EDX:00000040
>>>> ESI:00000040 EDI:7ffd4000
>>>
>>> it is not coming from Wine itself, looks like it's from Windows code,
>>> and I'd guess it just tells us that they got exception 12,
>>> without further information on the cause.
>>
>> The backtrace shows the fault is in the VDSO, the first pop
>> instruction after returning from the kernel.
>
> Yes, I understand at which insn exception happens.
>
> I meant that *the message* is not generated by Wine or kernel.
> grep for "Unhandled exception:" comes up empty
> on their source trees.
>
> After much grepping, I see that I'm wrong.
> It does come from wine:
>
> void info_win32_exception(void)
> {
> const EXCEPTION_RECORD* rec;
> ADDRESS64 addr;
> char hexbuf[MAX_OFFSET_TO_STR_LEN];
>
> if (!dbg_curr_thread->in_exception)
> {
> dbg_printf("Thread isn't in an exception\n");
> return;
> }
> rec = &dbg_curr_thread->excpt_record;
> memory_get_current_pc(&addr);
>
> /* print some infos */
> dbg_printf("%s: ",
> dbg_curr_thread->first_chance ? "First chance exception" : "Unhandled exception");
> switch (rec->ExceptionCode)
> {
> case EXCEPTION_BREAKPOINT:
> dbg_printf("breakpoint");
> break;
> case EXCEPTION_SINGLE_STEP:
> dbg_printf("single step");
> break;
> case EXCEPTION_INT_DIVIDE_BY_ZERO:
> dbg_printf("divide by zero");
> break;
> case EXCEPTION_INT_OVERFLOW:
> dbg_printf("overflow");
> break;
> case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
> dbg_printf("array bounds");
> break;
> case EXCEPTION_ILLEGAL_INSTRUCTION:
> dbg_printf("illegal instruction");
> break;
> case EXCEPTION_STACK_OVERFLOW:
> dbg_printf("stack overflow");
> break;
> ...
>
> I hoped we can easily make Wine show exception's error code.
> Not that easy :/
>

I added some debug messages to an unpatched kernel:
[ 382.639763] traps: wine[14281] trap stack segment ip:f7716c07
sp:fff9a024 error:0
[ 382.639778] traps: wine[14281] trap stack segment ip:f7716c07
sp:fff9a024 error:0

The patch does appear to fix the crash.

--
Brian Gerst
--
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/