From: Thomas Garnier Subject: [PATCH v3 25/27] x86/pie: Add option to build the kernel as PIE Date: Wed, 23 May 2018 12:54:19 -0700 Message-ID: <20180523195421.180248-26-thgarnie@google.com> References: <20180523195421.180248-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 , Thomas Garnier , Philippe Ombredanne , Kate Stewart , Arnaldo Carvalho de Melo , Yonghong Song , Andrey Ryabinin , Kees Cook , Tom Lendacky , "Kirill A . Shutemov" , Andy Lutomirski , Dominik Brodowski , Borislav Petkov , Borislav Petkov , "Rafael J . Wysocki" , Len Return-path: In-Reply-To: <20180523195421.180248-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 QWRkIHRoZSBDT05GSUdfWDg2X1BJRSBvcHRpb24gd2hpY2ggYnVpbGRzIHRoZSBrZXJuZWwgYXMg YSBQb3NpdGlvbgpJbmRlcGVuZGVudCBFeGVjdXRhYmxlIChQSUUpLiBUaGUga2VybmVsIGlzIGN1 cnJlbnRseSBidWlsZCB3aXRoIHRoZQptY21vZGVsPWtlcm5lbCBvcHRpb24gd2hpY2ggZm9yY2Vz IGl0IHRvIHN0YXkgb24gdGhlIHRvcCAyRyBvZiB0aGUKdmlydHVhbCBhZGRyZXNzIHNwYWNlLiBX aXRoIFBJRSwgdGhlIGtlcm5lbCB3aWxsIGJlIGFibG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kYXRpb24gaXMgbm90IHlldCBzdXBwb3J0IGR1ZSB0byBz ZWxmLXJlZmVyZW5jZWQgc3dpdGNoZXMKK2lmZGVmIENPTkZJR19TVEFDS19WQUxJREFUSU9OCisg ICAgICAgICQod2FybmluZyBDT05GSUdfU1RBQ0tfVkFMSURBVElPTiBpcyBub3QgeWV0IHN1cHBv cnRlZCBmb3IgeDg2XzY0IHBpZSBcCisJICAgICAgICBidWlsZC4pCisgICAgICAgIFNLSVBfU1RB Q0tfVkFMSURBVElPTiA6PSAxCisgICAgICAgIGV4cG9ydCBTS0lQX1NUQUNLX1ZBTElEQVRJT04K K2VuZGlmCisKK2lmbmRlZiBDT05GSUdfQ0NfU1RBQ0tQUk9URUNUT1JfTk9ORQoraWZuZGVmIENP TkZJR19YODZfR0xPQkFMX1NUQUNLUFJPVEVDVE9SCisgICAgICAgIHN0YWNrc2VnLWZsYWcgOj0g LW1zdGFjay1wcm90ZWN0b3ItZ3VhcmQtcmVnPSVncworICAgICAgICBpZmVxICgkKGNhbGwgY2Mt b3B0aW9uLXluLCQoc3RhY2tzZWctZmxhZykpLG4pCisgICAgICAgICAgICAgICAgIyBUcnkgdG8g ZW5hYmxlIGdsb2JhbCBzdGFjayBjb29raWUgaWYgcG9zc2libGUKKyAgICAgICAgICAgICAgICBp ZmVxICgkKHN0YWNrZ2xvYmFsKSwgeSkKKyAgICAgICAgICAgICAgICAgICAgICAgICQod2Fybmlu ZyBDYW5ub3QgdXNlIENPTkZJR19DQ19TVEFDS1BST1RFQ1RPUl8qIHdoaWxlIFwKKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRpbmcgYSBwb3NpdGlvbiBpbmRlcGVuZGVudCBr ZXJuZWwuIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGVmYXVsdCB0byBnbG9i YWwgc3RhY2sgcHJvdGVjdG9yIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKENP TkZJR19YODZfR0xPQkFMX1NUQUNLUFJPVEVDVE9SKS4pCisgICAgICAgICAgICAgICAgICAgICAg ICBDT05GSUdfWDg2X0dMT0JBTF9TVEFDS1BST1RFQ1RPUiA6PSB5CisgICAgICAgICAgICAgICAg ICAgICAgICBLQlVJTERfQ0ZMQUdTICs9IC1EQ09ORklHX1g4Nl9HTE9CQUxfU1RBQ0tQUk9URUNU T1IKKyAgICAgICAgICAgICAgICAgICAgICAgIEtCVUlMRF9BRkxBR1MgKz0gLURDT05GSUdfWDg2 X0dMT0JBTF9TVEFDS1BST1RFQ1RPUgorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAg ICAgICAgICAgICAgICQoZXJyb3IgZWNobyBDYW5ub3QgdXNlIFwKKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgQ09ORklHX0NDX1NUQUNLUFJPVEVDVE9SXyhSRUdVTEFSfFNUUk9OR3xB VVRPKSBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIGJ1aWxkaW5nIGEg cG9zaXRpb24gaW5kZXBlbmRlbnQgYmluYXJ5LiBcCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIFVwZGF0ZSB5b3VyIGNvbXBpbGVyIG9yIHVzZSBcCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIENPTkZJR19YODZfR0xPQkFMX1NUQUNLUFJPVEVDVE9SKQorICAgICAgICAg ICAgICAgIGVuZGlmCisgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICBLQlVJTERfQ0ZMQUdT ICs9ICQoc3RhY2tzZWctZmxhZykKKyAgICAgICAgZW5kaWYKK2VuZGlmCitlbmRpZgorCiBlbHNl CiAgICAgICAgIEtCVUlMRF9DRkxBR1MgKz0gLW1jbW9kZWw9a2VybmVsCiBlbmRpZgpAQCAtMTQ2 LDcgKzE4OSw3IEBAIGVuZGlmCiBlbmRpZgogCiBpZmRlZiBDT05GSUdfWDg2X0dMT0JBTF9TVEFD S1BST1RFQ1RPUgotICAgICAgICBpZmVxICgkKGNhbGwgY2Mtb3B0aW9uLCAtbXN0YWNrLXByb3Rl Y3Rvci1ndWFyZD1nbG9iYWwpLCkKKyAgICAgICAgaWZlcSAoJChzdGFja2dsb2JhbCksIG4pCiAg ICAgICAgICAgICAgICAgJChlcnJvciBDYW5ub3QgdXNlIENPTkZJR19YODZfR0xPQkFMX1NUQUNL UFJPVEVDVE9SOiBcCiAgICAgICAgICAgICAgICAgICAgICAgICAtbXN0YWNrLXByb3RlY3Rvci1n dWFyZD1nbG9iYWwgbm90IHN1cHBvcnRlZCBcCiAgICAgICAgICAgICAgICAgICAgICAgICBieSBj b21waWxlcikKLS0gCjIuMTcuMC40NDEuZ2I0NmZlNjBlMWQtZ29vZwoKCl9fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fClhlbi1kZXZlbCBtYWlsaW5nIGxpc3QK WGVuLWRldmVsQGxpc3RzLnhlbnByb2plY3Qub3JnCmh0dHBzOi8vbGlzdHMueGVucHJvamVjdC5v cmcvbWFpbG1hbi9saXN0aW5mby94ZW4tZGV2ZWw=