Re: [PATCH v2 14/14] objtool,x86: Rewrite retpoline thunk calls

2021-03-19 Thread Josh Poimboeuf
On Fri, Mar 19, 2021 at 04:56:30PM +0100, Peter Zijlstra wrote: > On Fri, Mar 19, 2021 at 10:30:26AM -0500, Josh Poimboeuf wrote: > > On Fri, Mar 19, 2021 at 09:06:44AM +0100, Peter Zijlstra wrote: > > > > Also doesn't the alternative code already insert nops? > > > > > > Problem is that the {call

Re: [PATCH v2 14/14] objtool,x86: Rewrite retpoline thunk calls

2021-03-19 Thread Peter Zijlstra
On Fri, Mar 19, 2021 at 10:30:26AM -0500, Josh Poimboeuf wrote: > On Fri, Mar 19, 2021 at 09:06:44AM +0100, Peter Zijlstra wrote: > > > Also doesn't the alternative code already insert nops? > > > > Problem is that the {call,jmp} *%\reg thing is not fixed length. They're > > 2 or 3 bytes depending

Re: [PATCH v2 14/14] objtool,x86: Rewrite retpoline thunk calls

2021-03-19 Thread Josh Poimboeuf
On Fri, Mar 19, 2021 at 09:06:44AM +0100, Peter Zijlstra wrote: > > Also doesn't the alternative code already insert nops? > > Problem is that the {call,jmp} *%\reg thing is not fixed length. They're > 2 or 3 bytes depending on which register is picked. Why do they need to be fixed length? Objto

Re: [PATCH v2 14/14] objtool,x86: Rewrite retpoline thunk calls

2021-03-19 Thread Peter Zijlstra
On Thu, Mar 18, 2021 at 10:29:55PM -0500, Josh Poimboeuf wrote: > On Thu, Mar 18, 2021 at 06:11:17PM +0100, Peter Zijlstra wrote: > > When the compiler emits: "CALL __x86_indirect_thunk_\reg" for an > > indirect call, have objtool rewrite it to: > > > > ALTERNATIVE "call __x86_indirect_thunk_\

Re: [PATCH v2 14/14] objtool,x86: Rewrite retpoline thunk calls

2021-03-18 Thread Josh Poimboeuf
On Thu, Mar 18, 2021 at 06:11:17PM +0100, Peter Zijlstra wrote: > When the compiler emits: "CALL __x86_indirect_thunk_\reg" for an > indirect call, have objtool rewrite it to: > > ALTERNATIVE "call __x86_indirect_thunk_\reg", > "call *%reg", ALT_NOT(X86_FEATURE_RETPOLINE) >

[PATCH v2 14/14] objtool,x86: Rewrite retpoline thunk calls

2021-03-18 Thread Peter Zijlstra
When the compiler emits: "CALL __x86_indirect_thunk_\reg" for an indirect call, have objtool rewrite it to: ALTERNATIVE "call __x86_indirect_thunk_\reg", "call *%reg", ALT_NOT(X86_FEATURE_RETPOLINE) Additionally, in order to not emit endless identical .altinst_replacem