Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

riscv: use _BITUL macro rather than BIT() in ptrace uapi and kselftests

Fix the build of non-kernel code that includes the RISC-V ptrace uapi
header, and the RISC-V validate_v_ptrace.c kselftest, by using the
_BITUL() macro rather than BIT(). BIT() is not available outside
the kernel.

Based on patches and comments from Charlie Jenkins, Michael Neuling,
and Andreas Schwab.

Fixes: 30eb191c895b ("selftests: riscv: verify ptrace rejects invalid vector csr inputs")
Fixes: 2af7c9cf021c ("riscv/ptrace: expose riscv CFI status and state via ptrace and in core files")
Cc: Andreas Schwab <schwab@suse.de>
Cc: Michael Neuling <mikey@neuling.org>
Cc: Charlie Jenkins <thecharlesjenkins@gmail.com>
Link: https://patch.msgid.link/20260330024248.449292-1-mikey@neuling.org
Link: https://lore.kernel.org/linux-riscv/20260309-fix_selftests-v2-1-9d5a553a531e@gmail.com/
Link: https://lore.kernel.org/linux-riscv/20260309-fix_selftests-v2-3-9d5a553a531e@gmail.com/
Signed-off-by: Paul Walmsley <pjw@kernel.org>

+9 -8
+7 -6
arch/riscv/include/uapi/asm/ptrace.h
··· 9 9 #ifndef __ASSEMBLER__ 10 10 11 11 #include <linux/types.h> 12 + #include <linux/const.h> 12 13 13 14 #define PTRACE_GETFDPIC 33 14 15 ··· 139 138 #define PTRACE_CFI_SS_LOCK_BIT 4 140 139 #define PTRACE_CFI_SS_PTR_BIT 5 141 140 142 - #define PTRACE_CFI_LP_EN_STATE BIT(PTRACE_CFI_LP_EN_BIT) 143 - #define PTRACE_CFI_LP_LOCK_STATE BIT(PTRACE_CFI_LP_LOCK_BIT) 144 - #define PTRACE_CFI_ELP_STATE BIT(PTRACE_CFI_ELP_BIT) 145 - #define PTRACE_CFI_SS_EN_STATE BIT(PTRACE_CFI_SS_EN_BIT) 146 - #define PTRACE_CFI_SS_LOCK_STATE BIT(PTRACE_CFI_SS_LOCK_BIT) 147 - #define PTRACE_CFI_SS_PTR_STATE BIT(PTRACE_CFI_SS_PTR_BIT) 141 + #define PTRACE_CFI_LP_EN_STATE _BITUL(PTRACE_CFI_LP_EN_BIT) 142 + #define PTRACE_CFI_LP_LOCK_STATE _BITUL(PTRACE_CFI_LP_LOCK_BIT) 143 + #define PTRACE_CFI_ELP_STATE _BITUL(PTRACE_CFI_ELP_BIT) 144 + #define PTRACE_CFI_SS_EN_STATE _BITUL(PTRACE_CFI_SS_EN_BIT) 145 + #define PTRACE_CFI_SS_LOCK_STATE _BITUL(PTRACE_CFI_SS_LOCK_BIT) 146 + #define PTRACE_CFI_SS_PTR_STATE _BITUL(PTRACE_CFI_SS_PTR_BIT) 148 147 149 148 #define PRACE_CFI_STATE_INVALID_MASK ~(PTRACE_CFI_LP_EN_STATE | \ 150 149 PTRACE_CFI_LP_LOCK_STATE | \
+2 -2
tools/testing/selftests/riscv/vector/validate_v_ptrace.c
··· 346 346 { 347 347 } 348 348 349 - #define VECTOR_1_0 BIT(0) 350 - #define XTHEAD_VECTOR_0_7 BIT(1) 349 + #define VECTOR_1_0 _BITUL(0) 350 + #define XTHEAD_VECTOR_0_7 _BITUL(1) 351 351 352 352 #define vector_test(x) ((x) & VECTOR_1_0) 353 353 #define xthead_test(x) ((x) & XTHEAD_VECTOR_0_7)