Skip to content

Commit be0fffa

Browse files
author
Peter Zijlstra
committed
x86/alternative: Rename apply_ibt_endbr()
The current name doesn't reflect what it does very well. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Sami Tolvanen <samitolvanen@google.com> Link: https://lkml.kernel.org/r/20230622144321.427441595%40infradead.org
1 parent 0479a42 commit be0fffa

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

arch/um/kernel/um_arch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ void __init arch_cpu_finalize_init(void)
437437
os_check_bugs();
438438
}
439439

440-
void apply_ibt_endbr(s32 *start, s32 *end)
440+
void apply_seal_endbr(s32 *start, s32 *end)
441441
{
442442
}
443443

arch/x86/include/asm/alternative.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ extern void alternative_instructions(void);
9696
extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
9797
extern void apply_retpolines(s32 *start, s32 *end);
9898
extern void apply_returns(s32 *start, s32 *end);
99-
extern void apply_ibt_endbr(s32 *start, s32 *end);
99+
extern void apply_seal_endbr(s32 *start, s32 *end);
100100
extern void apply_fineibt(s32 *start_retpoline, s32 *end_retpoine,
101101
s32 *start_cfi, s32 *end_cfi);
102102

arch/x86/include/asm/ibt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/*
3535
* Create a dummy function pointer reference to prevent objtool from marking
3636
* the function as needing to be "sealed" (i.e. ENDBR converted to NOP by
37-
* apply_ibt_endbr()).
37+
* apply_seal_endbr()).
3838
*/
3939
#define IBT_NOSEAL(fname) \
4040
".pushsection .discard.ibt_endbr_noseal\n\t" \

arch/x86/kernel/alternative.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ static void __init_or_module poison_endbr(void *addr, bool warn)
803803
/*
804804
* Generated by: objtool --ibt
805805
*/
806-
void __init_or_module noinline apply_ibt_endbr(s32 *start, s32 *end)
806+
void __init_or_module noinline apply_seal_endbr(s32 *start, s32 *end)
807807
{
808808
s32 *s;
809809

@@ -818,7 +818,7 @@ void __init_or_module noinline apply_ibt_endbr(s32 *start, s32 *end)
818818

819819
#else
820820

821-
void __init_or_module apply_ibt_endbr(s32 *start, s32 *end) { }
821+
void __init_or_module apply_seal_endbr(s32 *start, s32 *end) { }
822822

823823
#endif /* CONFIG_X86_KERNEL_IBT */
824824

@@ -1565,7 +1565,10 @@ void __init alternative_instructions(void)
15651565
*/
15661566
callthunks_patch_builtin_calls();
15671567

1568-
apply_ibt_endbr(__ibt_endbr_seal, __ibt_endbr_seal_end);
1568+
/*
1569+
* Seal all functions that do not have their address taken.
1570+
*/
1571+
apply_seal_endbr(__ibt_endbr_seal, __ibt_endbr_seal_end);
15691572

15701573
#ifdef CONFIG_SMP
15711574
/* Patch to UP if other cpus not imminent. */

arch/x86/kernel/module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ int module_finalize(const Elf_Ehdr *hdr,
358358
}
359359
if (ibt_endbr) {
360360
void *iseg = (void *)ibt_endbr->sh_addr;
361-
apply_ibt_endbr(iseg, iseg + ibt_endbr->sh_size);
361+
apply_seal_endbr(iseg, iseg + ibt_endbr->sh_size);
362362
}
363363
if (locks) {
364364
void *lseg = (void *)locks->sh_addr;

0 commit comments

Comments
 (0)