From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751696AbdKTXhU (ORCPT ); Mon, 20 Nov 2017 18:37:20 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:60785 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751243AbdKTXhS (ORCPT ); Mon, 20 Nov 2017 18:37:18 -0500 Date: Tue, 21 Nov 2017 00:37:12 +0100 (CET) From: Thomas Gleixner To: Andy Lutomirski cc: X86 ML , Borislav Petkov , "linux-kernel@vger.kernel.org" , Brian Gerst , Dave Hansen , Linus Torvalds , Josh Poimboeuf Subject: Re: [PATCH 07/16] x86/asm: Move SYSENTER_stack to the beginning of struct tss_struct In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 20 Nov 2017, Andy Lutomirski wrote: > struct tss_struct { > /* > - * The hardware state: > + * Space for the temporary SYSENTER stack. Used for the entry > + * trampoline as well. Size it such that tss_struct ends up > + * as a multiple of PAGE_SIZE. This calculation assumes that > + * io_bitmap is a multiple of PAGE_SIZE (8192 bytes) plus one > + * long. I don't see how sizeof(tss_struct) is a multiple of PAGE_SIZE canary = 8 stack = 512 hw_tss = 104 io bitmap = 8200 ------------------------- 8824 The alignment is what blows it up to 3 * PAGE_SIZE > + */ > + unsigned long SYSENTER_stack_canary; > + unsigned long SYSENTER_stack[64]; > + > + /* > + * The fixed hardware portion. This must not cross a page boundary > + * at risk of violating the SDM's advice and potentially triggering > + * errata. > */ > struct x86_hw_tss x86_tss; > > @@ -338,15 +350,9 @@ struct tss_struct { > * be within the limit. > */ > unsigned long io_bitmap[IO_BITMAP_LONGS + 1]; > +} __attribute__((__aligned__(PAGE_SIZE))); > Thanks, tglx