virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Kees Cook <keescook@chromium.org>
Cc: Alexander van Heukelum <heukelum@fastmail.fm>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	"x86@kernel.org" <x86@kernel.org>,
	Len Brown <len.brown@intel.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>,
	David Herrmann <dh.herrmann@gmail.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Seiji Aguchi <seiji.aguchi@hds.com>, Jiri Slaby <jslaby@suse.cz>,
	Alok Kataria <akataria@vmware.com>,
	Jesper Nilsson <jesper.nilsson@axis.com>,
	Andi Kleen <ak@linux.intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Ingo Molnar <mingo@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	xen-devel@lists.xenproject.org, Borislav Petkov <bp@suse.de>,
	Fenghua Yu <feng>
Subject: Re: [PATCH 2/3] x86: tss: Eliminate fragile calculation of TSS segment limit
Date: Thu, 31 Oct 2013 04:12:43 -0700	[thread overview]
Message-ID: <20131031111243.GA25280@leaf> (raw)
In-Reply-To: <CAGXu5jLNhzrQHtgkW8rAm3em=aEHsTXy+DndEqLJCMH0H8n_Sg@mail.gmail.com>

On Wed, Oct 30, 2013 at 03:22:33PM -0700, Kees Cook wrote:
> On Mon, Oct 21, 2013 at 7:34 PM, Josh Triplett <josh@joshtriplett.org> wrote:
> > __set_tss_desc has a complex calculation of the TSS segment limit,
> > duplicating the quirky details of the I/O bitmap array length, and
> > requiring a complex comment to explain.  Replace that calculation with a
> > simpler one based on the offsetof the "stack" field that follows the
> > array.
> >
> > That then removes the last use of IO_BITMAP_OFFSET, so delete it.
> >
> > Signed-off-by: Josh Triplett <josh@joshtriplett.org>
> > ---
> >  arch/x86/include/asm/desc.h      | 11 +----------
> >  arch/x86/include/asm/processor.h |  3 ++-
> >  2 files changed, 3 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
> > index b90e5df..17ac92f 100644
> > --- a/arch/x86/include/asm/desc.h
> > +++ b/arch/x86/include/asm/desc.h
> > @@ -177,16 +177,7 @@ static inline void __set_tss_desc(unsigned cpu, unsigned int entry, void *addr)
> >         struct desc_struct *d = get_cpu_gdt_table(cpu);
> >         tss_desc tss;
> >
> > -       /*
> > -        * sizeof(unsigned long) coming from an extra "long" at the end
> > -        * of the iobitmap. See tss_struct definition in processor.h
> > -        *
> > -        * -1? seg base+limit should be pointing to the address of the
> > -        * last valid byte
> 
> I think it might be better to keep at least a minimal comment near the
> TSS_LIMIT declaration, just to explain the "-1" part, which is not
> entirely obvious from just reading the code.

Fair enough; I've added an appropriate comment next to TSS_LIMIT, and
I'll include that in PATCHv2, which I'll send out as soon as I see
any feedback on patch 3/3.

- Josh Triplett

  parent reply	other threads:[~2013-10-31 11:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22  2:33 [PATCH 0/3] x86: Support compiling out userspace I/O (iopl and ioperm) Josh Triplett
2013-10-22  2:34 ` [PATCH 1/3] x86: process: Unify 32-bit and 64-bit copy_thread I/O bitmap handling Josh Triplett
2013-10-30 22:21   ` Kees Cook
2013-10-31 20:01   ` Alexander van Heukelum
2013-11-01 16:33     ` Josh Triplett
2013-10-22  2:34 ` [PATCH 2/3] x86: tss: Eliminate fragile calculation of TSS segment limit Josh Triplett
2013-10-30 22:22   ` Kees Cook
2013-10-30 22:53     ` H. Peter Anvin
2013-10-31 11:17       ` Josh Triplett
2013-10-31 11:12     ` Josh Triplett [this message]
2013-10-31 20:02   ` Alexander van Heukelum
2013-11-01 16:40     ` Josh Triplett
2013-10-22  2:35 ` [PATCH 3/3] x86: Support compiling out userspace I/O (iopl and ioperm) Josh Triplett
2013-10-26  3:17   ` Stephen Hemminger
2013-10-26  4:30     ` Kees Cook
2013-10-31 20:04   ` Alexander van Heukelum
2013-11-01 17:19     ` Josh Triplett

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=20131031111243.GA25280@leaf \
    --to=josh@joshtriplett.org \
    --cc=ak@linux.intel.com \
    --cc=akataria@vmware.com \
    --cc=bp@suse.de \
    --cc=daniel.lezcano@linaro.org \
    --cc=dh.herrmann@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=heukelum@fastmail.fm \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=jesper.nilsson@axis.com \
    --cc=jslaby@suse.cz \
    --cc=keescook@chromium.org \
    --cc=len.brown@intel.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=raghavendra.kt@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=seiji.aguchi@hds.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.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).