Sender: Ingo Molnar Date: Fri, 20 Oct 2017 17:20:28 +0200 From: Ingo Molnar Message-ID: <20171020152028.syq6woeet6it3z3h@gmail.com> References: <20171011203027.11248-1-thgarnie@google.com> <20171011203027.11248-7-thgarnie@google.com> <20171020082646.bkxrps35sb3gq2nr@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [kernel-hardening] Re: [PATCH v1 06/27] x86/entry/64: Adapt assembly for PIE support To: Thomas Garnier Cc: Herbert Xu , "David S . Miller" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Arnd Bergmann , Kees Cook , Andrey Ryabinin , Matthias Kaehlcke , Tom Lendacky , Andy Lutomirski , "Kirill A . Shutemov" , Borislav Petkov , "Rafael J . Wysocki" , Len Brown , Pavel Machek , Juergen Gross , Chris Wright , Alok Kataria , Rusty Russell , Tejun Heo , Christoph Lameter , Boris Ostrovsky , Paul Gortmaker , Andrew Morton , Alexey Dobriyan , "Paul E . McKenney" , Nicolas Pitre , Borislav Petkov , "Luis R . Rodriguez" , Greg Kroah-Hartman , Christopher Li , Steven Rostedt , Jason Baron , Mika Westerberg , Dou Liyang , "Rafael J . Wysocki" , Lukas Wunner , Masahiro Yamada , Alexei Starovoitov , Daniel Borkmann , Markus Trippelsdorf , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Joerg Roedel , Rik van Riel , David Howells , Ard Biesheuvel , Waiman Long , Kyle Huey , Jonathan Corbet , Michal Hocko , Peter Foley , Paul Bolle , Jiri Kosina , "H . J . Lu" , Rob Landley , Baoquan He , Jan H =?iso-8859-1?Q?=2E_Sch=F6nherr?= , Daniel Micay , the arch/x86 maintainers , Linux Crypto Mailing List , LKML , Linux PM list , virtualization@lists.linux-foundation.org, xen-devel , linux-arch , Sparse Mailing-list , kvm list , linux-doc@vger.kernel.org, Kernel Hardening List-ID: * Thomas Garnier wrote: > >> */ > >> - cmpq $.Lentry_SYSCALL_64_after_fastpath_call, (%rsp) > >> + leaq .Lentry_SYSCALL_64_after_fastpath_call(%rip), %r11 > >> + cmpq %r11, (%rsp) > >> jne 1f > > This patch seems to add extra overhead to the syscall fast-path even when PIE is > > disabled, right? > > It does add extra instructions when one is not possible, I preferred > that over ifdefing but I can change it. So my problem is, this pattern repeats in many other places as well, but sprinking various pieces of assembly code with #ifdefs would be very bad as well. I have no good idea how to solve this. Thanks, Ingo