[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrWCoduoc9B336gg82qcN8nVJ4PwA508FLXnMzrin7nAfA@mail.gmail.com>
Date: Fri, 8 Dec 2017 08:33:48 -0800
From: Andy Lutomirski <luto@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...en8.de>, X86 ML <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Brian Gerst <brgerst@...il.com>,
David Laight <David.Laight@...lab.com>,
Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH] LDT improvements
On Fri, Dec 8, 2017 at 6:06 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> On Fri, Dec 08, 2017 at 05:20:00AM -0800, Andy Lutomirski wrote:
>> >
>> > The error code of such an access is always 0x03. So I added a special
>> > handler, which checks whether the address is in the LDT map range and
>> > verifies that the access bit in the descriptor is 0. If that's the case it
>> > sets it and returns. If not, the thing dies. That works.
>>
>> What if you are in kernel mode and try to return to a context with SS
>> or CS pointing to a non-accessed segment? Or what if you try to
>> schedule to a context with fs or, worse, gs pointing to such a
>> segment?
>
> How would that be different from setting a 'crap' GS in modify_ldt() and
> then returning from the syscall? That is something we should be able to
> deal with already, no?
>
> Is this something ldt_gdt.c already tests? The current "Test GS" is in
> test_gdt_invalidation() which seems to suggest not.
>
> Could we get a testcase for the exact situation you worry about? I'm not
> sure I'd trust myself to get it right, all this LDT magic is new to me.
#GP on IRET is a failure, and we have disgusting code to handle it.
#PF on IRET would not be a failure -- it's a case where IRET should be
retried. Our crap that fixes up #GP would get that wrong and leave us
with the wrong GSBASE.
Powered by blists - more mailing lists