From: Thomas Garnier Subject: [PATCH v1 20/27] x86/ftrace: Adapt function tracing for PIE support Date: Wed, 11 Oct 2017 13:30:20 -0700 Message-ID: <20171011203027.11248-21-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 V2hlbiB1c2luZyAtZlBJRS9QSUMgd2l0aCBmdW5jdGlvbiB0cmFjaW5nLCB0aGUgY29tcGlsZXIg Z2VuZXJhdGVzIGEKY2FsbCB0aHJvdWdoIHRoZSBHT1QgKGNhbGwgKl9fZmVudHJ5X19AR09UUENS RUwpLiBUaGlzIGluc3RydWN0aW9uCnRha2VzIDYgYnl0ZXMgaW5zdGVhZCBvZiA1IG9uIHRoZSB1 c3VhbCByZWxhdGl2ZSBjYWxsLgoKSWYgUElFIGlzIGVuYWJsZWQsIHJlcGxhY2UgdGhlIDZ0aCBi eXRlIG9mIHRoZSBHT1QgY2FsbCBieSBhIDEtYnl0Z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