mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'Andy Lutomirski'" <luto@amacapital.net>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>, Andy Lutomirski <luto@kernel.org>,
	Borislav Petkov <bp@alien8.de>, X86 ML <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Brian Gerst <brgerst@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: RE: [PATCH] LDT improvements
Date: Fri, 8 Dec 2017 13:55:24 +0000	[thread overview]
Message-ID: <e8c77e8387c04b2ea2f96c4c1adce564@AcuMS.aculab.com> (raw)
In-Reply-To: <6363C18D-D84A-40E4-8ED4-FE996609467B@amacapital.net>

From: Andy Lutomirski
> Sent: 08 December 2017 13:20
...
> >> - It would also be a cleaner approach all around, and would avoid the fixmap
> >>   complications and the scheduler muckery.
> >
> > 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?

Well, the cpu will fault in kernel on the 'pop %xs' or 'iret' instruction.
These all (probably) happen on the kernel stack with the usergs loaded.
So the fault handler has to look at the opcodes and/or %pc value, sort
out the stack (etc) and then generate SIGSEGV.

I'm not sure the kernel needs to know why the segment selector is invalid.

	David

  reply	other threads:[~2017-12-08 13:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07  7:22 Andy Lutomirski
2017-12-07 12:43 ` Borislav Petkov
2017-12-07 17:08   ` Andy Lutomirski
2017-12-07 17:23     ` Thomas Gleixner
2017-12-07 18:21       ` Andy Lutomirski
2017-12-08  7:34         ` Ingo Molnar
2017-12-08  9:34           ` Thomas Gleixner
2017-12-08  9:44             ` Ingo Molnar
2017-12-08  9:55               ` Thomas Gleixner
2017-12-08 11:31                 ` Ingo Molnar
2017-12-08 16:38                   ` Andy Lutomirski
2017-12-08 17:37                     ` Thomas Gleixner
2017-12-08 17:42                       ` Andy Lutomirski
2017-12-08 17:48                     ` Peter Zijlstra
2017-12-08 13:20             ` Andy Lutomirski
2017-12-08 13:55               ` David Laight [this message]
2017-12-08 14:06               ` Peter Zijlstra
2017-12-08 16:20                 ` Peter Zijlstra
2017-12-08 16:33                 ` Andy Lutomirski
2017-12-08 16:46                   ` David Laight
2017-12-08 16:47                     ` Andy Lutomirski
2017-12-08 17:29                       ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8c77e8387c04b2ea2f96c4c1adce564@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome