From: Thomas Garnier Subject: [PATCH v2 18/27] xen: Adapt assembly for PIE support Date: Tue, 13 Mar 2018 13:59:36 -0700 Message-ID: <20180313205945.245105-19-thgarnie@google.com> References: <20180313205945.245105-1-thgarnie@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Cc: linux-arch@vger.kernel.org, kvm@vger.kernel.org, linux-pm@vger.kernel.org, x86@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-sparse@vger.kernel.org, linux-crypto@vger.kernel.org, kernel-hardening@lists.openwall.com, xen-devel@lists.xenproject.org To: Herbert Xu , "David S . Miller" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Greg Kroah-Hartman , Kate Stewart , Thomas Garnier , Arnd Bergmann , Philippe Ombredanne , Arnaldo Carvalho de Melo , Andrey Ryabinin , Matthias Kaehlcke , Kees Cook , Tom Lendacky , "Kirill A . Shutemov" , Andy Lutomirski , Dominik Brodowski , Borislav Petkov , Borislav Petkov , "Raf Return-path: In-Reply-To: <20180313205945.245105-1-thgarnie@google.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" List-Id: linux-crypto.vger.kernel.org Q2hhbmdlIHRoZSBhc3NlbWJseSBjb2RlIHRvIHVzZSB0aGUgbmV3IF9BU01fTU9WQUJTIG1hY3Jv IHdoaWNoIGdldCBhCnN5bWJvbCByZWZlcmVuY2Ugd2hpbGUgYmVpbmcgUElFIGNvbXBhdGlibGUu IEFkYXB0IHRoZSByZWxvY2F0aW9uIHRvb2wKdG8gaWdub3JlIDMyLWJpdCBYZW4gY29kZS4KClBv c2l0aW9uIEluZGVwZW5kZW50IEV4ZWN1dGFibGUgKFBJRSkgc3VwcG9ydCB3aWxsIGFsbG93IHRv IGV4dGVuZGVkIHRoZQpLQVNMUiByYW5kb21pemF0aW9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