Skip to contentSkip to conversation

x86/fred: Remove ENDBR64 from FRED entry points

PATCH Superseded Xin Li (Intel) 3 participants 6 messages Jul 15, 2025

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Xin Li (Intel)

author maintainer
#0 lore raw

PATCH 1/1 x86/fred: Remove ENDBR64 from FRED entry points

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 <[email protected]> and other contributors from Arizona State University whose work led to this change.

---
 arch/x86/entry/entry_64_fred.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/entry_64_fred.S +1 -1
index 29c5c32c16c3..907bd233c6c1 100644
@@ -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
Signature · 1 line
2.50.1
author maintainer
#1 lore raw
Quoted 16 lines · Xin Li (Intel)

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 <[email protected]> and other contributors from Arizona State University whose work led to this change.

Quoted 7 lines

Sorry, forgot to put CC stable.

Quoted 17 lines
---
  arch/x86/entry/entry_64_fred.S | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/entry_64_fred.S +1 -1
index 29c5c32c16c3..907bd233c6c1 100644
@@ -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 lore raw
Quoted 25 lines · Xin Li
Quoted 16 lines · Xin Li (Intel)

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 <[email protected]> and other contributors from Arizona State University whose work led to this change.

Quoted 7 lines
Quoted 1 line

Sorry, forgot to put CC stable.

Fixes 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")

Right?

Quoted 18 lines
Quoted 17 lines
---
  arch/x86/entry/entry_64_fred.S | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/entry_64_fred.S +1 -1
index 29c5c32c16c3..907bd233c6c1 100644
@@ -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
author maintainer
#3 lore raw
Quoted 25 lines · Peter Zijlstra
Quoted 24 lines · Xin Li
Quoted 23 lines · Xin Li (Intel)

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<[email protected]> and other contributors from Arizona State University whose work led to this change.

Quoted 4 lines
Quoted 1 line

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.

#4 lore raw
In reply to Xin Li (Intel)
Quoted 4 lines · Xin Li (Intel)

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.

Quoted 12 lines

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 <[email protected]> and other contributors from Arizona State University whose work led to this change.

Quoted 7 lines

Preferably with an adjusted commit message, Reviewed-by Andrew Cooper <[email protected]>

Any idea when an updated SIMICS will be available?

~Andrew

author maintainer
#5 lore raw
Quoted 6 lines · Andrew Cooper
Quoted 4 lines · Xin Li (Intel)

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.

Quoted 8 lines

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 ;)

Quoted 21 lines
Quoted 13 lines

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 <[email protected]> and other contributors from Arizona State University whose work led to this change.

Quoted 7 lines
Quoted 2 lines

Preferably with an adjusted commit message, Reviewed-by Andrew Cooper <[email protected]>

Thanks, will add in v3 later today (Sent out v2 just now).

Quoted 2 lines

Any idea when an updated SIMICS will be available?

The FRED testing is more focused on hardware now :).

Anyway, let me check here.