Re: [Xen-devel] [PATCH v2 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-03-14 Thread Peter Zijlstra
On Tue, Mar 13, 2018 at 01:59:39PM -0700, Thomas Garnier wrote: > + /* > + * If PIE is not enabled or no GOT call was found, default to the > + * original approach to code modification. > + */ > + if (!IS_ENABLED(CONFIG_X86_PIE) > + || probe_kernel_read(replaced,

[Xen-devel] [PATCH v2 21/27] x86/ftrace: Adapt function tracing for PIE support

2018-03-13 Thread Thomas Garnier
When using -fPIE/PIC with function tracing, the compiler generates a call through the GOT (call *__fentry__@GOTPCREL). This instruction takes 6 bytes instead of 5 on the usual relative call. If PIE is enabled, replace the 6th byte of the GOT call by a 1-byte nop so ftrace can handle the previous