All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Nadav Amit <namit@vmware.com>, Jiri Kosina <jikos@kernel.org>,
	Xi Ruoyao <xry111@mengyan1223.wang>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
	Borislav Petkov <bp@alien8.de>, Len Brown <lenb@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Tony Luck <tony.luck@intel.com>,
	Bob Moore <robert.moore@intel.com>,
	Erik Schmauss <erik.schmauss@intel.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Daniel Bristot de Oliveira <bristot@redhat.com>
Subject: Re: [GIT PULL] x86/topology changes for v5.3
Date: Thu, 11 Jul 2019 08:08:57 -0700	[thread overview]
Message-ID: <201907110806.9C79329@keescook> (raw)
In-Reply-To: <20190711080134.GT3402@hirez.programming.kicks-ass.net>

On Thu, Jul 11, 2019 at 10:01:34AM +0200, Peter Zijlstra wrote:
> On Thu, Jul 11, 2019 at 07:11:19AM +0000, Nadav Amit wrote:
> > > On Jul 10, 2019, at 7:22 AM, Jiri Kosina <jikos@kernel.org> wrote:
> > > 
> > > On Wed, 10 Jul 2019, Peter Zijlstra wrote:
> > > 
> > >> If we mark the key as RO after init, and then try and modify the key to
> > >> link module usage sites, things might go bang as described.
> > >> 
> > >> Thanks!
> > >> 
> > >> 
> > >> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> > >> index 27d7864e7252..5bf7a8354da2 100644
> > >> --- a/arch/x86/kernel/cpu/common.c
> > >> +++ b/arch/x86/kernel/cpu/common.c
> > >> @@ -366,7 +366,7 @@ static __always_inline void setup_umip(struct cpuinfo_x86 *c)
> > >> 	cr4_clear_bits(X86_CR4_UMIP);
> > >> }
> > >> 
> > >> -DEFINE_STATIC_KEY_FALSE_RO(cr_pinning);
> > >> +DEFINE_STATIC_KEY_FALSE(cr_pinning);
> > > 
> > > Good catch, I guess that is going to fix it.
> > > 
> > > At the same time though, it sort of destroys the original intent of Kees' 
> > > patch, right? The exploits will just have to call static_key_disable() 
> > > prior to calling native_write_cr4() again, and the protection is gone.
> > 
> > Even with DEFINE_STATIC_KEY_FALSE_RO(), I presume you can just call
> > set_memory_rw(), make the page that holds the key writable, and then call
> > static_key_disable(), followed by a call to native_write_cr4().
> 
> Or call text_poke_bp() with the right set of arguments.

Right -- the point is to make it defended against an arbitrary write,
not arbitrary execution. Nothing is safe from arbitrary exec, but we can
do our due diligence on making things read-only.

-- 
Kees Cook

  reply	other threads:[~2019-07-11 15:09 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 16:27 [GIT PULL] x86/topology changes for v5.3 Ingo Molnar
2019-07-09  1:45 ` pr-tracker-bot
2019-07-09 21:20 ` Linus Torvalds
2019-07-09 21:26   ` Linus Torvalds
2019-07-09 21:45     ` Linus Torvalds
2019-07-09 22:00       ` Linus Torvalds
2019-07-09 22:07         ` Linus Torvalds
2019-07-09 22:27         ` Thomas Gleixner
2019-07-09 23:00           ` Thomas Gleixner
2019-07-09 23:17             ` Thomas Gleixner
2019-07-10  0:31               ` Kees Cook
2019-07-10 11:27                 ` Xi Ruoyao
2019-07-10 12:01                   ` Xi Ruoyao
2019-07-10 12:19                     ` Thomas Gleixner
2019-07-10 12:31                       ` Jiri Kosina
2019-07-10 13:21                         ` Peter Zijlstra
2019-07-10 13:27                           ` Jiri Kosina
2019-07-10 13:28                             ` Jiri Kosina
2019-07-10 13:31                               ` Xi Ruoyao
2019-07-10 13:25                         ` Xi Ruoyao
2019-07-10 13:44                           ` Peter Zijlstra
2019-07-10 14:03                             ` Thomas Gleixner
2019-07-10 14:26                               ` Thomas Gleixner
2019-07-10 14:22                             ` Jiri Kosina
2019-07-10 14:26                               ` Peter Zijlstra
2019-07-10 15:13                                 ` Thomas Gleixner
2019-07-10 15:58                                   ` Xi Ruoyao
2019-07-10 19:42                                     ` [PATCH] x86/asm: Move native_write_cr0/3() out of line Thomas Gleixner
2019-07-10 19:59                                       ` Kees Cook
2019-07-10 20:00                                         ` Thomas Gleixner
2019-07-10 20:02                                       ` Peter Zijlstra
2019-07-10 20:19                                       ` [tip:x86/urgent] x86/asm: Move native_write_cr0/4() " tip-bot for Thomas Gleixner
2019-07-10 14:44                               ` [GIT PULL] x86/topology changes for v5.3 Xi Ruoyao
2019-07-11  7:11                               ` Nadav Amit
2019-07-11  7:16                                 ` Thomas Gleixner
2019-07-11  8:01                                 ` Peter Zijlstra
2019-07-11 15:08                                   ` Kees Cook [this message]
2019-07-11 17:09                                     ` Nadav Amit
2019-07-10  0:59             ` Linus Torvalds
2019-07-10  1:08               ` Linus Torvalds
2019-07-10  3:21                 ` Linus Torvalds
2019-07-10  5:15                   ` Linus Torvalds
2019-07-10  5:33                     ` Kees Cook
2019-07-10 18:40                     ` Linus Torvalds
2019-07-10 10:03             ` Rafael J. Wysocki

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=201907110806.9C79329@keescook \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=bristot@redhat.com \
    --cc=erik.schmauss@intel.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namit@vmware.com \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robert.moore@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=xry111@mengyan1223.wang \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.