summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-04-10 17:27:08 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-04-10 17:27:08 -0700
commite774d5f1bc27a85f858bce7688509e866f8e8a4e (patch)
tree8d689ac21221c3fd067a411e21e71991a5cdf49a /kernel
parentc43adb3613a8b1be0396d0a38a8ab6be633d48d8 (diff)
parent08ee1559052be302f1d3752f48360b89517d9f8d (diff)
Merge tag 'riscv-for-linus-v7.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linuxHEADmaster
Pull RISC-V updates from Paul Walmsley: "Before v7.0 is released, fix a few issues with the CFI patchset, merged earlier in v7.0-rc, that primarily affect interfaces to non-kernel code: - Improve the prctl() interface for per-task indirect branch landing pad control to expand abbreviations and to resemble the speculation control prctl() interface - Expand the "LP" and "SS" abbreviations in the ptrace uapi header file to "branch landing pad" and "shadow stack", to improve readability - Fix a typo in a CFI-related macro name in the ptrace uapi header file - Ensure that the indirect branch tracking state and shadow stack state are unlocked immediately after an exec() on the new task so that libc subsequently can control it - While working in this area, clean up the kernel-internal, cross-architecture prctl() function names by expanding the abbreviations mentioned above" * tag 'riscv-for-linus-v7.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: prctl: cfi: change the branch landing pad prctl()s to be more descriptive riscv: ptrace: cfi: expand "SS" references to "shadow stack" in uapi headers prctl: rename branch landing pad implementation functions to be more explicit riscv: ptrace: expand "LP" references to "branch landing pads" in uapi headers riscv: cfi: clear CFI lock status in start_thread() riscv: ptrace: cfi: fix "PRACE" typo in uapi header
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sys.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index c86eba9aa7e9..62e842055cc9 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2388,17 +2388,18 @@ int __weak arch_lock_shadow_stack_status(struct task_struct *t, unsigned long st
return -EINVAL;
}
-int __weak arch_get_indir_br_lp_status(struct task_struct *t, unsigned long __user *status)
+int __weak arch_prctl_get_branch_landing_pad_state(struct task_struct *t,
+ unsigned long __user *state)
{
return -EINVAL;
}
-int __weak arch_set_indir_br_lp_status(struct task_struct *t, unsigned long status)
+int __weak arch_prctl_set_branch_landing_pad_state(struct task_struct *t, unsigned long state)
{
return -EINVAL;
}
-int __weak arch_lock_indir_br_lp_status(struct task_struct *t, unsigned long status)
+int __weak arch_prctl_lock_branch_landing_pad_state(struct task_struct *t)
{
return -EINVAL;
}
@@ -2888,20 +2889,23 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
return -EINVAL;
error = rseq_slice_extension_prctl(arg2, arg3);
break;
- case PR_GET_INDIR_BR_LP_STATUS:
- if (arg3 || arg4 || arg5)
+ case PR_GET_CFI:
+ if (arg2 != PR_CFI_BRANCH_LANDING_PADS)
return -EINVAL;
- error = arch_get_indir_br_lp_status(me, (unsigned long __user *)arg2);
- break;
- case PR_SET_INDIR_BR_LP_STATUS:
- if (arg3 || arg4 || arg5)
+ if (arg4 || arg5)
return -EINVAL;
- error = arch_set_indir_br_lp_status(me, arg2);
+ error = arch_prctl_get_branch_landing_pad_state(me, (unsigned long __user *)arg3);
break;
- case PR_LOCK_INDIR_BR_LP_STATUS:
- if (arg3 || arg4 || arg5)
+ case PR_SET_CFI:
+ if (arg2 != PR_CFI_BRANCH_LANDING_PADS)
return -EINVAL;
- error = arch_lock_indir_br_lp_status(me, arg2);
+ if (arg4 || arg5)
+ return -EINVAL;
+ error = arch_prctl_set_branch_landing_pad_state(me, arg3);
+ if (error)
+ break;
+ if (arg3 & PR_CFI_LOCK && !(arg3 & PR_CFI_DISABLE))
+ error = arch_prctl_lock_branch_landing_pad_state(me);
break;
default:
trace_task_prctl_unknown(option, arg2, arg3, arg4, arg5);