lkml.org 
[lkml]   [2015]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] x86: entry_32.S: change ESPFIX test to not touch PT_OLDSS(%esp)
On Mon, Mar 9, 2015 at 8:00 AM, Denys Vlasenko <vda.linux@googlemail.com> wrote:
> On Mon, Mar 9, 2015 at 3:18 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>> Do we actually need espfix on all returns to vm86 mode?
>
> No, the current code (and my new version) does *not* do
> espfix for vm86. It's not needed (apparently).
>
>>> + btl $X86_EFLAGS_VM_BIT,PT_EFLAGS(%esp)
>>> + jc restore_nocheck # VM set, not it
>>
>> This seems useless. In vm86 mode, espfix should work fine (even if
>> pointlessly), CS won't have the two low bits set, and SS won't
>> reference the LDT because it's not a selector at all.
>
> You seem to suggest we can drop VM flag test.
>
> If we do that, the tests for CS and SS will work on bogus data.
> I.e. they will semi-randomly rouse execution through espfix.
>

Mmm, right. My bad, that test is needed.

> Which will probably work correctly, but IIRC espfix does crazy stuff
> which is likely to be slow.
>
> What we definitely should do here is at least frame this check with
> "#ifdef CONFIG_VM86".
>
>> That being said, what ends up in the high bits of esp when we iret to
>> vm86 mode?
>
> I don't know. I guess it's time to write an actual vm86 testcase :)

Ick. I can try...

Anyway, you've convinced me that your patch is good. I queued it up.

--
Andy Lutomirski
AMA Capital Management, LLC


\
 
 \ /
  Last update: 2015-03-09 16:21    [W:1.013 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site