From: Peter Zijlstra Subject: Re: [PATCH v2 06/27] x86/entry/64: Adapt assembly for PIE support Date: Wed, 14 Mar 2018 11:29:51 +0100 Message-ID: <20180314102951.GQ4043@hirez.programming.kicks-ass.net> References: <20180313205945.245105-1-thgarnie@google.com> <20180313205945.245105-7-thgarnie@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Kate Stewart , Nicolas Pitre , Michal Hocko , Sergey Senozhatsky , Petr Mladek , Len Brown , Boris Ostrovsky , Christopher Li , Dave Hansen , x86@kernel.org, Dominik Brodowski , linux-kernel@vger.kernel.org, Masahiro Yamada , Pavel Machek , "H . Peter Anvin" , kernel-hardening@lists.openwall.com, Christoph Lameter , Jiri Slaby , Alok Kataria , linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, Herbert Xu , Baoquan He , Jonathan Corbet , Joerg Roede To: Thomas Garnier Return-path: Content-Disposition: inline In-Reply-To: <20180313205945.245105-7-thgarnie@google.com> 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 List-Id: linux-crypto.vger.kernel.org On Tue, Mar 13, 2018 at 01:59:24PM -0700, Thomas Garnier wrote: > @@ -1576,7 +1578,9 @@ first_nmi: > addq $8, (%rsp) /* Fix up RSP */ > pushfq /* RFLAGS */ > pushq $__KERNEL_CS /* CS */ > - pushq $1f /* RIP */ > + pushq %rax /* Support Position Independent Code */ > + leaq 1f(%rip), %rax /* RIP */ > + xchgq %rax, (%rsp) /* Restore RAX, put 1f */ > iretq /* continues at repeat_nmi below */ > UNWIND_HINT_IRET_REGS > 1: Urgh, xchg with a memop has an implicit LOCK prefix.