mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Anish Bhatt <anish@chelsio.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	X86 ML <x86@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Sebastian Lackner <sebastian@fds-team.de>
Subject: Re: [PATCH] x86 : Ensure X86_FLAGS_NT is cleared on syscall entry
Date: Mon, 29 Sep 2014 23:37:14 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1409292331420.22082@ionos.tec.linutronix.de> (raw)
In-Reply-To: <CALCETrW=PMe6y4E+i7KoDQg0nqukWy-X0XsVr0eMFjJ9NTyA-g@mail.gmail.com>

On Mon, 29 Sep 2014, Andy Lutomirski wrote:
> On Mon, Sep 29, 2014 at 12:41 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> > On Mon, 29 Sep 2014, Andy Lutomirski wrote:
> >> On Mon, Sep 29, 2014 at 11:59 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> >> > On Mon, 29 Sep 2014, Andy Lutomirski wrote:
> >> >> Presumably interrupt delivery clears NT.  I haven't spotted where that's
> >> >> documented yet.
> >> >
> >> > Nope, that's unrelated.
> >>
> >> If it weren't the case, then we'd be totally screwed.  Fortunately, it
> >> is.  I found it: SDM Volume 3 6.12.1.2 says:
> >>
> >> (On calls to exception and interrupt
> >> handlers, the processor also clears the VM, RF, and NT flags in the
> >> EFLAGS register,
> >> after they are saved on the stack.)
> >
> > Sorry, I misunderstood your question.
> >
> > And yes on exception and interrupt entry it is cleared. Otherwise the
> > whole feature would not work at all ...
> >
> > But that's why I'm really not worried about it. While we can mask out
> > the stupid bit easily, it does not provide any value except protecting
> > silly userspace from rightfully raised exceptions.
> >
> > When I first saw that patch, I was worried about the security impact,
> > but after staring long enough at the SDM and the code, the only way it
> > can explode is when returning to user space. It cannot explode in the
> > kernel.
> 
> This is only true as long as the only use of lret from a system call
> (or kernel thread started from a system call) is to return to
> userspace.
> 
> For example, __efi64_thunk uses lretq, so mixed-mode EFI doesn't
> violate this assumption, but __efi64_thunk could just as easily have
> used iret.

And if __efi64_thunk would use iret, it would be wrong to begin with,
really. I'd rather see it die right there.
 
> IOW, I don't think there's any vulnerability here, but this makes me
> nervous.

I was pretty relaxed until you mentioned EFI ....

Thanks,

	tglx

  reply	other threads:[~2014-09-29 21:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25 19:42 Anish Bhatt
2014-09-25 23:00 ` Chuck Ebbert
2014-09-29 17:30   ` Andy Lutomirski
2014-09-26 22:00 ` Chuck Ebbert
2014-09-26 22:10   ` Anish Bhatt
2014-09-26 23:32   ` Linus Torvalds
2014-09-29 17:40 ` Andy Lutomirski
2014-09-29 18:30   ` Sebastian Lackner
2014-09-29 18:43     ` Andy Lutomirski
2014-09-29 19:33     ` Thomas Gleixner
2014-09-29 19:41       ` Sebastian Lackner
2014-09-29 19:51         ` Thomas Gleixner
2014-09-29 18:59   ` Thomas Gleixner
2014-09-29 19:08     ` Andy Lutomirski
2014-09-29 19:17     ` Andy Lutomirski
2014-09-29 19:41       ` Thomas Gleixner
2014-09-29 19:43         ` H. Peter Anvin
2014-09-29 19:57           ` Thomas Gleixner
2014-09-29 20:01             ` H. Peter Anvin
2014-09-29 20:10               ` Thomas Gleixner
2014-09-29 20:29               ` Andy Lutomirski
2014-09-29 20:16         ` Andy Lutomirski
2014-09-29 21:37           ` Thomas Gleixner [this message]
2014-09-30  0:11             ` Andy Lutomirski

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=alpine.DEB.2.02.1409292331420.22082@ionos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=anish@chelsio.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=sebastian@fds-team.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

all inboxes | Powered by JetHome®