From: Thomas Garnier Subject: [RFC v2 20/23] x86/pie: Add option to build the kernel as PIE for x86_64 Date: Thu, 10 Aug 2017 10:26:12 -0700 Message-ID: <20170810172615.51965-21-thgarnie@google.com> References: <20170810172615.51965-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-kernel@vger.kernel.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 , Arnd Bergmann , Thomas Garnier , Matthias Kaehlcke , Boris Ostrovsky , Juergen Gross , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Joerg Roedel , Tom Lendacky , Andy Lutomirski , Borislav Petkov , Brian Gerst , "Kirill A . Shutemov" , "Rafael J . Wysocki" , Len Brown , Pavel Machek Return-path: In-Reply-To: <20170810172615.51965-1-thgarnie@google.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" List-Id: linux-crypto.vger.kernel.org QWRkIHRoZSBDT05GSUdfWDg2X1BJRSBvcHRpb24gd2hpY2ggYnVpbGRzIHRoZSBrZXJuZWwgYXMg YSBQb3NpdGlvbgpJbmRlcGVuZGVudCBFeGVjdXRhYmxlIChQSUUpLiBUaGUga2VybmVsIGlzIGN1 cnJlbnRseSBidWlsZCB3aXRoIHRoZQptY21vZGVsPWtlcm5lbCBvcHRpb24gd2hpY2ggZm9yY2Vz IGl0IHRvIHN0YXkgb24gdGhlIHRvcCAyRyBvZiB0aGUKdmlydHVhbCBhZGRyZXNzIHNwYWNlLiBX aXRoIFBJRSwgdGhlIGtlcm5lbCB3aWxsIGJlIGFibGU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