From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Re: [PATCH 2/3] x86: tss: Eliminate fragile calculation of TSS segment limit Date: Wed, 30 Oct 2013 15:53:11 -0700 Message-ID: <52718DD7.7040905@zytor.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Kees Cook , Josh Triplett Cc: Alexander van Heukelum , Jeremy Fitzhardinge , "x86@kernel.org" , Len Brown , Frederic Weisbecker , "virtualization@lists.linux-foundation.org" , Paul Gortmaker , Raghavendra K T , David Herrmann , Masami Hiramatsu , Seiji Aguchi , Jiri Slaby , Alok Kataria , Jesper Nilsson , Andi Kleen , Daniel Lezcano , Ingo Molnar , Steven Rostedt , xen-devel@lists.xenproject.org, Borislav Petkov , Fenghua Yu , Konrad List-Id: virtualization@lists.linuxfoundation.org On 10/30/2013 03:22 PM, Kees Cook wrote: >> >> - /* >> - * 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. > Agreed, although it doesn't need to be an unsigned long at all... the CPU will only ever access one extra byte past the end. -hpa