linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>
Subject: Re: [GIT pull] x86/asm for 5.1
Date: Mon, 11 Mar 2019 09:55:18 -0700	[thread overview]
Message-ID: <CAGXu5j+NB16S2gAz9TOW6izZykuOXqRoP0nDkTqgn02OJ2ht5Q@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=whUyG3+Zwb74LSOPGtTBvK9N6DG4f=Y5Yv9Xzcy-qY0Qw@mail.gmail.com>

On Mon, Mar 11, 2019 at 8:39 AM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> They are set early in the boot process, but they are set separately
> for each CPU, and not at the same time.
>
> And that's important. It's important because when the *first* CPU sets
> the "you now need to pin and check the SMAP bit", the _other_ CPU"s
> have not set it yet.

Clarification, just so I get the design considerations adjusted
correctly... I did this with a global because of the observation that
once CPU setup is done, the pin mask is the same for all CPUs.
However, yes, I see the point about the chosen implementation
resulting in a potential timing problem, etc. What about enabling the
pin mask once CPU init is finished? The goal is to protect those bits
during runtime (and to stay out of the way at init time).

I'll play with the "+r" memory output as a way to avoid volatile but
my earlier attempts at that did not produce machine code that was
actually defensive in the face of skipping the "or". (The cr0 case
works; I did use the "+r" method there. It's easy since it's a
hard-coded value -- I had less control over what the compiler decided
to do with register spilling in the cr4 case.)

Anyway, I'll work on a cleaner version and include you on CC.

Thanks!

-- 
Kees Cook

  reply	other threads:[~2019-03-11 16:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-10 11:33 [GIT pull] core udpate for 5.1 Thomas Gleixner
2019-03-10 11:33 ` [GIT pull] locking fixes " Thomas Gleixner
2019-03-10 22:30   ` pr-tracker-bot
2019-03-10 11:33 ` [GIT pull] perf updates " Thomas Gleixner
2019-03-10 22:30   ` pr-tracker-bot
2019-03-10 11:33 ` [GIT pull] scheduler " Thomas Gleixner
2019-03-10 20:56   ` Linus Torvalds
2019-03-11  9:09     ` Ingo Molnar
2019-03-11 14:16     ` Thomas Gleixner
2019-03-10 11:33 ` [GIT pull] timer fix " Thomas Gleixner
2019-03-10 22:30   ` pr-tracker-bot
2019-03-10 11:33 ` [GIT pull] x86/asm " Thomas Gleixner
2019-03-10 21:43   ` Linus Torvalds
2019-03-11 14:22     ` Thomas Gleixner
2019-03-11 15:39       ` Linus Torvalds
2019-03-11 16:55         ` Kees Cook [this message]
2019-03-11 17:41           ` Linus Torvalds
2019-03-11 19:14             ` Kees Cook
     [not found]               ` <CAHk-=whQYG7iHO8Gv2Ka2_2tXNJkX1LdsyqKUZ=EO0aP6uS+2g@mail.gmail.com>
2019-03-11 20:36                 ` Kees Cook
2019-03-11 21:04                   ` Linus Torvalds
2019-03-10 11:33 ` [GIT pull] x86/boot fix " Thomas Gleixner
2019-03-10 22:30   ` pr-tracker-bot
2019-03-10 11:33 ` [GIT pull] x86 fixes " Thomas Gleixner
2019-03-10 22:30   ` pr-tracker-bot
2019-03-10 22:30 ` [GIT pull] core udpate " pr-tracker-bot

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=CAGXu5j+NB16S2gAz9TOW6izZykuOXqRoP0nDkTqgn02OJ2ht5Q@mail.gmail.com \
    --to=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).