Re: [x86/asm/entry] BUG: unable to handle kernel paging request

From: Denys Vlasenko
Date: Mon Mar 09 2015 - 10:15:42 EST


On Mon, Mar 9, 2015 at 3:00 PM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>> I'm preparing a patch which does this:
>>
>> btl $X86_EFLAGS_VM_BIT,PT_EFLAGS(%esp)
>> jc restore_nocheck # VM set, not it
>> testb $3,PT_CS(%esp)
>> jz restore_nocheck # CPL0, not it
>> # Note: we access PT_OLDSS only when we know it exists.
>> # If PT_CS is from CPL0, this can be not true.
>> testb $SEGMENT_TI_MASK,PT_OLDSS(%esp)
>> jnz ldt_ss # returning to user-space with LDT SS
>>
>> All three checks can run in parallel on an OOO CPU.
>> Most of the time, none of branches will be taken.
>
> Why do we need the VM check? Isn't CS == 0 in vm86 mode?

IF VM is set, then we are in vm86 mode, not in 16-bit protected mode
where ESPFIX thingy may be necessary. And also,
%ss register in vm86 does nit have LDT bit, thus that check would
not work properly anyway.
--
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/