From: Thomas Garnier Subject: [PATCH v1 17/27] xen: Adapt assembly for PIE support Date: Wed, 11 Oct 2017 13:30:17 -0700 Message-ID: <20171011203027.11248-18-thgarnie@google.com> References: <20171011203027.11248-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 , Arnd Bergmann , Thomas Garnier , 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 In-Reply-To: <20171011203027.11248-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 Q2hhbmdlIHRoZSBhc3NlbWJseSBjb2RlIHRvIHVzZSB0aGUgbmV3IF9BU01fR0VUX1BUUiBtYWNy byB3aGljaCBnZXQgYQpzeW1ib2wgcmVmZXJlbmNlIHdoaWxlIGJlaW5nIFBJRSBjb21wYXRpYmxl LiBBZGFwdCB0aGUgcmVsb2NhdGlvbiB0b29sCnRvIGlnbm9yZSAzMi1iaXQgWGVuIGNvZGUuCgpQ b3NpdGlvbiBJbmRlcGVuZGVudCBFeGVjdXRhYmxlIChQSUUpIHN1cHBvcnQgd2lsbCBhbGxvdyB0 byBleHRlbmRlZCB0aGUKS0FTTFIgcmFuZG9taXphdGlvbiByYW5n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