Skip to content

Commit 5d1b631

Browse files
brooniectmarinas
authored andcommitted
arm64: bti: Document behaviour for dynamically linked binaries
For dynamically linked binaries the interpreter is responsible for setting PROT_BTI on everything except itself. The dynamic linker needs to be aware of PROT_BTI, for example in order to avoid dropping that when marking executable pages read only after doing relocations, and doing everything in userspace ensures that we don't get any issues due to divergences in behaviour between the kernel and dynamic linker within a single executable. Add a comment indicating that this is intentional to the code to help people trying to understand what's going on. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent bf7f15c commit 5d1b631

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/arm64/kernel/process.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,11 @@ asmlinkage void __sched arm64_preempt_schedule_irq(void)
674674
int arch_elf_adjust_prot(int prot, const struct arch_elf_state *state,
675675
bool has_interp, bool is_interp)
676676
{
677+
/*
678+
* For dynamically linked executables the interpreter is
679+
* responsible for setting PROT_BTI on everything except
680+
* itself.
681+
*/
677682
if (is_interp != has_interp)
678683
return prot;
679684

0 commit comments

Comments
 (0)