* [PATCH v1 1/1] x86/fred: Remove ENDBR64 from FRED entry points
@ 2025-07-15 6:44 Xin Li (Intel)
2025-07-15 6:50 ` Xin Li
2025-07-15 15:49 ` Andrew Cooper
0 siblings, 2 replies; 6+ messages in thread
From: Xin Li (Intel) @ 2025-07-15 6:44 UTC (permalink / raw)
To: linux-kernel
Cc: luto, tglx, mingo, bp, dave.hansen, x86, hpa, jmill, peterz,
andrew.cooper3
The FRED specification v9.0 states that there is no need for FRED
event handlers to begin with ENDBR64, because in the presence of
supervisor indirect branch tracking, FRED event delivery does not
enter the WAIT_FOR_ENDBRANCH state.
As a result, remove ENDBR64 from FRED entry points.
Then add ANNOTATE_NOENDBR to indicate that FRED entry points will
never be used for indirect calls to suppress an objtool warning.
This change implies that any indirect CALL/JMP to FRED entry points
causes #CP in the presence of supervisor indirect branch tracking.
Credit goes to Jennifer Miller <jmill@asu.edu> and other contributors
from Arizona State University whose work led to this change.
Link: https://lore.kernel.org/linux-hardening/Z60NwR4w%2F28Z7XUa@ubun/
Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Xin Li (Intel) <xin@zytor.com>
Cc: Jennifer Miller <jmill@asu.edu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: H. Peter Anvin <hpa@zytor.com>
---
arch/x86/entry/entry_64_fred.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S
index 29c5c32c16c3..907bd233c6c1 100644
--- a/arch/x86/entry/entry_64_fred.S
+++ b/arch/x86/entry/entry_64_fred.S
@@ -16,7 +16,7 @@
.macro FRED_ENTER
UNWIND_HINT_END_OF_STACK
- ENDBR
+ ANNOTATE_NOENDBR
PUSH_AND_CLEAR_REGS
movq %rsp, %rdi /* %rdi -> pt_regs */
.endm
--
2.50.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/1] x86/fred: Remove ENDBR64 from FRED entry points
2025-07-15 6:44 [PATCH v1 1/1] x86/fred: Remove ENDBR64 from FRED entry points Xin Li (Intel)
@ 2025-07-15 6:50 ` Xin Li
2025-07-15 8:40 ` Peter Zijlstra
2025-07-15 15:49 ` Andrew Cooper
1 sibling, 1 reply; 6+ messages in thread
From: Xin Li @ 2025-07-15 6:50 UTC (permalink / raw)
To: linux-kernel
Cc: luto, tglx, mingo, bp, dave.hansen, x86, hpa, jmill, peterz,
andrew.cooper3
On 7/14/2025 11:44 PM, Xin Li (Intel) wrote:
> The FRED specification v9.0 states that there is no need for FRED
> event handlers to begin with ENDBR64, because in the presence of
> supervisor indirect branch tracking, FRED event delivery does not
> enter the WAIT_FOR_ENDBRANCH state.
>
> As a result, remove ENDBR64 from FRED entry points.
>
> Then add ANNOTATE_NOENDBR to indicate that FRED entry points will
> never be used for indirect calls to suppress an objtool warning.
>
> This change implies that any indirect CALL/JMP to FRED entry points
> causes #CP in the presence of supervisor indirect branch tracking.
>
> Credit goes to Jennifer Miller <jmill@asu.edu> and other contributors
> from Arizona State University whose work led to this change.
>
> Link: https://lore.kernel.org/linux-hardening/Z60NwR4w%2F28Z7XUa@ubun/
> Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
> Signed-off-by: Xin Li (Intel) <xin@zytor.com>
> Cc: Jennifer Miller <jmill@asu.edu>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
Sorry, forgot to put CC stable.
> ---
> arch/x86/entry/entry_64_fred.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S
> index 29c5c32c16c3..907bd233c6c1 100644
> --- a/arch/x86/entry/entry_64_fred.S
> +++ b/arch/x86/entry/entry_64_fred.S
> @@ -16,7 +16,7 @@
>
> .macro FRED_ENTER
> UNWIND_HINT_END_OF_STACK
> - ENDBR
> + ANNOTATE_NOENDBR
> PUSH_AND_CLEAR_REGS
> movq %rsp, %rdi /* %rdi -> pt_regs */
> .endm
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/1] x86/fred: Remove ENDBR64 from FRED entry points
2025-07-15 6:50 ` Xin Li
@ 2025-07-15 8:40 ` Peter Zijlstra
2025-07-15 15:34 ` Xin Li
0 siblings, 1 reply; 6+ messages in thread
From: Peter Zijlstra @ 2025-07-15 8:40 UTC (permalink / raw)
To: Xin Li
Cc: linux-kernel, luto, tglx, mingo, bp, dave.hansen, x86, hpa,
jmill, andrew.cooper3
On Mon, Jul 14, 2025 at 11:50:57PM -0700, Xin Li wrote:
> On 7/14/2025 11:44 PM, Xin Li (Intel) wrote:
> > The FRED specification v9.0 states that there is no need for FRED
> > event handlers to begin with ENDBR64, because in the presence of
> > supervisor indirect branch tracking, FRED event delivery does not
> > enter the WAIT_FOR_ENDBRANCH state.
> >
> > As a result, remove ENDBR64 from FRED entry points.
> >
> > Then add ANNOTATE_NOENDBR to indicate that FRED entry points will
> > never be used for indirect calls to suppress an objtool warning.
> >
> > This change implies that any indirect CALL/JMP to FRED entry points
> > causes #CP in the presence of supervisor indirect branch tracking.
> >
> > Credit goes to Jennifer Miller <jmill@asu.edu> and other contributors
> > from Arizona State University whose work led to this change.
> >
> > Link: https://lore.kernel.org/linux-hardening/Z60NwR4w%2F28Z7XUa@ubun/
> > Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
> > Signed-off-by: Xin Li (Intel) <xin@zytor.com>
> > Cc: Jennifer Miller <jmill@asu.edu>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> > Cc: H. Peter Anvin <hpa@zytor.com>
>
> Sorry, forgot to put CC stable.
Fixes: 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")
Right?
>
> > ---
> > arch/x86/entry/entry_64_fred.S | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S
> > index 29c5c32c16c3..907bd233c6c1 100644
> > --- a/arch/x86/entry/entry_64_fred.S
> > +++ b/arch/x86/entry/entry_64_fred.S
> > @@ -16,7 +16,7 @@
> > .macro FRED_ENTER
> > UNWIND_HINT_END_OF_STACK
> > - ENDBR
> > + ANNOTATE_NOENDBR
> > PUSH_AND_CLEAR_REGS
> > movq %rsp, %rdi /* %rdi -> pt_regs */
> > .endm
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/1] x86/fred: Remove ENDBR64 from FRED entry points
2025-07-15 8:40 ` Peter Zijlstra
@ 2025-07-15 15:34 ` Xin Li
0 siblings, 0 replies; 6+ messages in thread
From: Xin Li @ 2025-07-15 15:34 UTC (permalink / raw)
To: Peter Zijlstra
Cc: linux-kernel, luto, tglx, mingo, bp, dave.hansen, x86, hpa,
jmill, andrew.cooper3
On 7/15/2025 1:40 AM, Peter Zijlstra wrote:
> On Mon, Jul 14, 2025 at 11:50:57PM -0700, Xin Li wrote:
>> On 7/14/2025 11:44 PM, Xin Li (Intel) wrote:
>>> The FRED specification v9.0 states that there is no need for FRED
>>> event handlers to begin with ENDBR64, because in the presence of
>>> supervisor indirect branch tracking, FRED event delivery does not
>>> enter the WAIT_FOR_ENDBRANCH state.
>>>
>>> As a result, remove ENDBR64 from FRED entry points.
>>>
>>> Then add ANNOTATE_NOENDBR to indicate that FRED entry points will
>>> never be used for indirect calls to suppress an objtool warning.
>>>
>>> This change implies that any indirect CALL/JMP to FRED entry points
>>> causes #CP in the presence of supervisor indirect branch tracking.
>>>
>>> Credit goes to Jennifer Miller<jmill@asu.edu> and other contributors
>>> from Arizona State University whose work led to this change.
>>>
>>> Link:https://lore.kernel.org/linux-hardening/Z60NwR4w%2F28Z7XUa@ubun/
>>> Reviewed-by: H. Peter Anvin (Intel)<hpa@zytor.com>
>>> Signed-off-by: Xin Li (Intel)<xin@zytor.com>
>>> Cc: Jennifer Miller<jmill@asu.edu>
>>> Cc: Peter Zijlstra<peterz@infradead.org>
>>> Cc: Andrew Cooper<andrew.cooper3@citrix.com>
>>> Cc: H. Peter Anvin<hpa@zytor.com>
>> Sorry, forgot to put CC stable.
> Fixes: 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")
>
> Right?
You bet!
Will send v2 to address it soon.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/1] x86/fred: Remove ENDBR64 from FRED entry points
2025-07-15 6:44 [PATCH v1 1/1] x86/fred: Remove ENDBR64 from FRED entry points Xin Li (Intel)
2025-07-15 6:50 ` Xin Li
@ 2025-07-15 15:49 ` Andrew Cooper
2025-07-15 16:10 ` Xin Li
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Cooper @ 2025-07-15 15:49 UTC (permalink / raw)
To: Xin Li (Intel), linux-kernel
Cc: luto, tglx, mingo, bp, dave.hansen, x86, hpa, jmill, peterz
On 15/07/2025 7:44 am, Xin Li (Intel) wrote:
> The FRED specification v9.0 states that there is no need for FRED
> event handlers to begin with ENDBR64, because in the presence of
> supervisor indirect branch tracking, FRED event delivery does not
> enter the WAIT_FOR_ENDBRANCH state.
I would suggest phrasing this as "The FRED specification has been
changed in v9 to..."
Simply "v9 states" can be read as "we mistook what v8 said and did it
wrong".
After all, the change here is specifically as a result of new research
showing ENDBR on the entrypoints to be of negative value.
>
> As a result, remove ENDBR64 from FRED entry points.
>
> Then add ANNOTATE_NOENDBR to indicate that FRED entry points will
> never be used for indirect calls to suppress an objtool warning.
>
> This change implies that any indirect CALL/JMP to FRED entry points
> causes #CP in the presence of supervisor indirect branch tracking.
>
> Credit goes to Jennifer Miller <jmill@asu.edu> and other contributors
> from Arizona State University whose work led to this change.
>
> Link: https://lore.kernel.org/linux-hardening/Z60NwR4w%2F28Z7XUa@ubun/
> Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
> Signed-off-by: Xin Li (Intel) <xin@zytor.com>
> Cc: Jennifer Miller <jmill@asu.edu>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
Preferably with an adjusted commit message, Reviewed-by Andrew Cooper
<andrew.cooper3@citrix.com>
Any idea when an updated SIMICS will be available?
~Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/1] x86/fred: Remove ENDBR64 from FRED entry points
2025-07-15 15:49 ` Andrew Cooper
@ 2025-07-15 16:10 ` Xin Li
0 siblings, 0 replies; 6+ messages in thread
From: Xin Li @ 2025-07-15 16:10 UTC (permalink / raw)
To: Andrew Cooper, linux-kernel
Cc: luto, tglx, mingo, bp, dave.hansen, x86, hpa, jmill, peterz
On 7/15/2025 8:49 AM, Andrew Cooper wrote:
> On 15/07/2025 7:44 am, Xin Li (Intel) wrote:
>> The FRED specification v9.0 states that there is no need for FRED
>> event handlers to begin with ENDBR64, because in the presence of
>> supervisor indirect branch tracking, FRED event delivery does not
>> enter the WAIT_FOR_ENDBRANCH state.
>
> I would suggest phrasing this as "The FRED specification has been
> changed in v9 to..."
>
> Simply "v9 states" can be read as "we mistook what v8 said and did it
> wrong".
>
> After all, the change here is specifically as a result of new research
> showing ENDBR on the entrypoints to be of negative value.
Sure, that makes it more like a story ;)
>
>>
>> As a result, remove ENDBR64 from FRED entry points.
>>
>> Then add ANNOTATE_NOENDBR to indicate that FRED entry points will
>> never be used for indirect calls to suppress an objtool warning.
>>
>> This change implies that any indirect CALL/JMP to FRED entry points
>> causes #CP in the presence of supervisor indirect branch tracking.
>>
>> Credit goes to Jennifer Miller <jmill@asu.edu> and other contributors
>> from Arizona State University whose work led to this change.
>>
>> Link: https://lore.kernel.org/linux-hardening/Z60NwR4w%2F28Z7XUa@ubun/
>> Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
>> Signed-off-by: Xin Li (Intel) <xin@zytor.com>
>> Cc: Jennifer Miller <jmill@asu.edu>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
>> Cc: H. Peter Anvin <hpa@zytor.com>
>
> Preferably with an adjusted commit message, Reviewed-by Andrew Cooper
> <andrew.cooper3@citrix.com>
Thanks, will add in v3 later today (Sent out v2 just now).
>
> Any idea when an updated SIMICS will be available?
The FRED testing is more focused on hardware now :).
Anyway, let me check here.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-07-15 16:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-15 6:44 [PATCH v1 1/1] x86/fred: Remove ENDBR64 from FRED entry points Xin Li (Intel)
2025-07-15 6:50 ` Xin Li
2025-07-15 8:40 ` Peter Zijlstra
2025-07-15 15:34 ` Xin Li
2025-07-15 15:49 ` Andrew Cooper
2025-07-15 16:10 ` Xin Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®