All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Eric Northup <digitaleric@google.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Ingo Molnar <mingo@kernel.org>, Kees Cook <keescook@chromium.org>,
	Ingo Molnar <mingo@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	the arch/x86 maintainers <x86@kernel.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Alex Shi <alex.shi@intel.com>,
	Borislav Petkov <borislav.petkov@amd.com>,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Xen Devel <xen-devel@lists.xensource.com>,
	lf-virt <virtualization@lists.linux-foundation.org>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	Dan Rosenberg <drosenberg@vsecurity.com>,
	Julien Tinnes <jln@google.com>, Will Drewry <wad@chromium.org>
Subject: [kernel-hardening] Re: [PATCH] x86: make IDT read-only
Date: Wed, 10 Apr 2013 09:48:27 -0700	[thread overview]
Message-ID: <516597DB.4020208@zytor.com> (raw)
In-Reply-To: <CAG7+5M06h_UEy39OQqdT7Z6r-85q_R9zHHKGO6F2PX2pgT6U9g@mail.gmail.com>

On 04/10/2013 09:31 AM, Eric Northup wrote:
>>
>> If the effect is measurable I agree it is a legitimate optimization.  At
>> one point there was a suggestion to make the code in the IDT vectors
>> differ based on the which interrupt was registed.  While that can also
>> reduce cache misses that can get hairy very quickly, and of course that
>> would require read-write IDTs.
> 
> read-write IDT or GDT are fine: map them twice, once read+write, once
> read-only.  Point the GDTR and IDTR at the read-only alias.
> 

Well, it is weaker, because if you can discover the pointer to the
writable alias you win.

Now, as has been pointed out the GDT needs to be writable on 32 bits as
a matter of hardware requirement.  However, doing it for 64 bits only is
probably enough of a win.

	-hpa

WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@zytor.com>
To: Eric Northup <digitaleric@google.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Dan Rosenberg <drosenberg@vsecurity.com>,
	lf-virt <virtualization@lists.linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>, Alex Shi <alex.shi@intel.com>,
	the arch/x86 maintainers <x86@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Kees Cook <keescook@chromium.org>, Julien Tinnes <jln@google.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Borislav Petkov <borislav.petkov@amd.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Xen Devel <xen-devel@lists.xensource.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Will Drewry <wad@chromium.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Eric W. Biederman" <ebie>
Subject: Re: [PATCH] x86: make IDT read-only
Date: Wed, 10 Apr 2013 09:48:27 -0700	[thread overview]
Message-ID: <516597DB.4020208@zytor.com> (raw)
In-Reply-To: <CAG7+5M06h_UEy39OQqdT7Z6r-85q_R9zHHKGO6F2PX2pgT6U9g@mail.gmail.com>

On 04/10/2013 09:31 AM, Eric Northup wrote:
>>
>> If the effect is measurable I agree it is a legitimate optimization.  At
>> one point there was a suggestion to make the code in the IDT vectors
>> differ based on the which interrupt was registed.  While that can also
>> reduce cache misses that can get hairy very quickly, and of course that
>> would require read-write IDTs.
> 
> read-write IDT or GDT are fine: map them twice, once read+write, once
> read-only.  Point the GDTR and IDTR at the read-only alias.
> 

Well, it is weaker, because if you can discover the pointer to the
writable alias you win.

Now, as has been pointed out the GDT needs to be writable on 32 bits as
a matter of hardware requirement.  However, doing it for 64 bits only is
probably enough of a win.

	-hpa

WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@zytor.com>
To: Eric Northup <digitaleric@google.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Ingo Molnar <mingo@kernel.org>, Kees Cook <keescook@chromium.org>,
	Ingo Molnar <mingo@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	the arch/x86 maintainers <x86@kernel.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Alex Shi <alex.shi@intel.com>,
	Borislav Petkov <borislav.petkov@amd.com>,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Xen Devel <xen-devel@lists.xensource.com>,
	lf-virt <virtualization@lists.linux-foundation.org>,
	"kernel-hardening@lists.openwall.com" 
	<kernel-hardening@lists.openwall.com>,
	Dan Rosenberg <drosenberg@vsecurity.com>,
	Julien Tinnes <jln@google.com>, Will Drewry <wad@chromium.org>
Subject: Re: [PATCH] x86: make IDT read-only
Date: Wed, 10 Apr 2013 09:48:27 -0700	[thread overview]
Message-ID: <516597DB.4020208@zytor.com> (raw)
In-Reply-To: <CAG7+5M06h_UEy39OQqdT7Z6r-85q_R9zHHKGO6F2PX2pgT6U9g@mail.gmail.com>

On 04/10/2013 09:31 AM, Eric Northup wrote:
>>
>> If the effect is measurable I agree it is a legitimate optimization.  At
>> one point there was a suggestion to make the code in the IDT vectors
>> differ based on the which interrupt was registed.  While that can also
>> reduce cache misses that can get hairy very quickly, and of course that
>> would require read-write IDTs.
> 
> read-write IDT or GDT are fine: map them twice, once read+write, once
> read-only.  Point the GDTR and IDTR at the read-only alias.
> 

Well, it is weaker, because if you can discover the pointer to the
writable alias you win.

Now, as has been pointed out the GDT needs to be writable on 32 bits as
a matter of hardware requirement.  However, doing it for 64 bits only is
probably enough of a win.

	-hpa



  reply	other threads:[~2013-04-10 16:48 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08 22:43 [kernel-hardening] [PATCH] x86: make IDT read-only Kees Cook
2013-04-08 22:43 ` Kees Cook
2013-04-08 22:43 ` Kees Cook
2013-04-08 22:47 ` [kernel-hardening] " H. Peter Anvin
2013-04-08 22:47   ` H. Peter Anvin
2013-04-08 22:47   ` H. Peter Anvin
2013-04-08 22:55   ` [kernel-hardening] " Kees Cook
2013-04-08 22:55     ` Kees Cook
2013-04-08 22:55     ` Kees Cook
2013-04-08 22:48 ` [kernel-hardening] " H. Peter Anvin
2013-04-08 22:48   ` H. Peter Anvin
2013-04-08 22:48   ` H. Peter Anvin
2013-04-09  9:23   ` [kernel-hardening] " Thomas Gleixner
2013-04-09  9:23     ` Thomas Gleixner
2013-04-09 18:22     ` [kernel-hardening] " Kees Cook
2013-04-09 18:22       ` Kees Cook
2013-04-09 18:26       ` H. Peter Anvin
2013-04-09 18:26         ` H. Peter Anvin
2013-04-09 18:31         ` Kees Cook
2013-04-09 18:31           ` Kees Cook
2013-04-09 18:39           ` H. Peter Anvin
2013-04-09 18:39             ` H. Peter Anvin
2013-04-09 18:46             ` Kees Cook
2013-04-09 18:46               ` Kees Cook
2013-04-09 18:50               ` H. Peter Anvin
2013-04-09 18:50                 ` H. Peter Anvin
2013-04-09 18:53                 ` Kees Cook
2013-04-09 18:53                   ` Kees Cook
2013-04-09 18:54               ` Eric Northup
2013-04-09 18:54                 ` Eric Northup
2013-04-09 18:59                 ` H. Peter Anvin
2013-04-09 18:59                   ` H. Peter Anvin
2013-04-10  0:43                 ` [kernel-hardening] Readonly GDT H. Peter Anvin
2013-04-10  0:43                   ` H. Peter Anvin
2013-04-10  0:43                   ` H. Peter Anvin
2013-04-10  0:53                   ` [kernel-hardening] " Steven Rostedt
2013-04-10  0:53                     ` Steven Rostedt
2013-04-10  0:53                     ` Steven Rostedt
2013-04-10  0:58                     ` [kernel-hardening] " H. Peter Anvin
2013-04-10  0:58                       ` H. Peter Anvin
2013-04-10  0:58                       ` H. Peter Anvin
2013-04-10  9:42                   ` [kernel-hardening] Re: [Xen-devel] " Jan Beulich
2013-04-10  9:42                     ` Jan Beulich
2013-04-10  9:42                     ` Jan Beulich
2013-04-10 14:16                     ` [kernel-hardening] " H. Peter Anvin
2013-04-10 14:16                       ` H. Peter Anvin
2013-04-10 14:16                       ` H. Peter Anvin
2013-04-10 18:28                     ` [kernel-hardening] " H. Peter Anvin
2013-04-10 18:28                       ` H. Peter Anvin
2013-04-10  9:41               ` [kernel-hardening] Re: [PATCH] x86: make IDT read-only Ingo Molnar
2013-04-10  9:41                 ` Ingo Molnar
2013-04-10  0:03       ` H. Peter Anvin
2013-04-10  0:03         ` H. Peter Anvin
2013-04-10  9:52         ` Ingo Molnar
2013-04-10  9:52           ` Ingo Molnar
2013-04-09  9:23   ` Thomas Gleixner
2013-04-09  9:45   ` [kernel-hardening] " Eric W. Biederman
2013-04-09  9:45     ` Eric W. Biederman
2013-04-09  9:45     ` Eric W. Biederman
2013-04-10  9:57     ` [kernel-hardening] " Ingo Molnar
2013-04-10  9:57       ` Ingo Molnar
2013-04-10  9:57       ` Ingo Molnar
2013-04-10 10:40       ` [kernel-hardening] " Eric W. Biederman
2013-04-10 10:40         ` Eric W. Biederman
2013-04-10 10:40         ` Eric W. Biederman
2013-04-10 16:31         ` [kernel-hardening] " Eric Northup
2013-04-10 16:31           ` Eric Northup
2013-04-10 16:31           ` Eric Northup
2013-04-10 16:48           ` H. Peter Anvin [this message]
2013-04-10 16:48             ` H. Peter Anvin
2013-04-10 16:48             ` H. Peter Anvin
2013-04-08 22:56 ` Maciej W. Rozycki
2013-04-08 22:56 ` [kernel-hardening] " Maciej W. Rozycki
2013-04-08 22:56   ` Maciej W. Rozycki
2013-04-08 23:00   ` [kernel-hardening] " Kees Cook
2013-04-08 23:00     ` Kees Cook
2013-04-08 23:00     ` Kees Cook
2013-04-08 23:05   ` [kernel-hardening] " Kees Cook
2013-04-08 23:05     ` Kees Cook
2013-04-08 23:05     ` Kees Cook
2013-04-08 23:42     ` [kernel-hardening] " Maciej W. Rozycki
2013-04-08 23:42       ` Maciej W. Rozycki
2013-04-08 23:42       ` Maciej W. Rozycki

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=516597DB.4020208@zytor.com \
    --to=hpa@zytor.com \
    --cc=alex.shi@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=borislav.petkov@amd.com \
    --cc=digitaleric@google.com \
    --cc=drosenberg@vsecurity.com \
    --cc=ebiederm@xmission.com \
    --cc=fweisbec@gmail.com \
    --cc=jeremy@goop.org \
    --cc=jln@google.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wad@chromium.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /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.