diff options
author | Saleem Abdulrasool <abdulras@google.com> | 2021-08-04 17:32:14 +0000 |
---|---|---|
committer | Palmer Dabbelt <palmerdabbelt@google.com> | 2021-08-24 21:45:47 -0700 |
commit | fde9c59aebafb91caeed816cc510b56f14aa63ae (patch) | |
tree | 748dc2b57f1805edf486bed2a5d998d6f2f6450e /arch/riscv/include/asm/vdso.h | |
parent | 8341dcfbd8dda98a3b2836a421016f7d88e35b1c (diff) | |
download | lwn-fde9c59aebafb91caeed816cc510b56f14aa63ae.tar.gz lwn-fde9c59aebafb91caeed816cc510b56f14aa63ae.zip |
riscv: explicitly use symbol offsets for VDSO
The current implementation of the `__rt_sigaction` reference computed an
absolute offset relative to the mapped base of the VDSO. While this can
be handled in the medlow model, the medany model cannot handle this as
it is meant to be position independent. The current implementation
relied on the BFD linker relaxing the PC-relative relocation into an
absolute relocation as it was a near-zero address allowing it to be
referenced relative to `zero`.
We now extract the offsets and create a generated header allowing the
build with LLVM and lld to succeed as we no longer depend on the linker
rewriting address references near zero. This change was largely
modelled after the ARM64 target which does something similar.
Signed-off-by: Saleem Abdulrasool <abdulras@google.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/include/asm/vdso.h')
-rw-r--r-- | arch/riscv/include/asm/vdso.h | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/arch/riscv/include/asm/vdso.h b/arch/riscv/include/asm/vdso.h index 1453a2f563bc..d8d003c2b5a3 100644 --- a/arch/riscv/include/asm/vdso.h +++ b/arch/riscv/include/asm/vdso.h @@ -9,25 +9,15 @@ #define _ASM_RISCV_VDSO_H #include <linux/types.h> +#include <generated/vdso-offsets.h> #ifndef CONFIG_GENERIC_TIME_VSYSCALL struct vdso_data { }; #endif -/* - * The VDSO symbols are mapped into Linux so we can just use regular symbol - * addressing to get their offsets in userspace. The symbols are mapped at an - * offset of 0, but since the linker must support setting weak undefined - * symbols to the absolute address 0 it also happens to support other low - * addresses even when the code model suggests those low addresses would not - * otherwise be availiable. - */ #define VDSO_SYMBOL(base, name) \ -({ \ - extern const char __vdso_##name[]; \ - (void __user *)((unsigned long)(base) + __vdso_##name); \ -}) + (void __user *)((unsigned long)(base) + __vdso_##name##_offset) asmlinkage long sys_riscv_flush_icache(uintptr_t, uintptr_t, uintptr_t); |