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.

prctl: rename branch landing pad implementation functions to be more explicit

Per Linus' comments about the unreadability of abbreviations such as
"indir_br_lp", rename the three prctl() implementation functions to be more
explicit. This involves renaming "indir_br_lp_status" in the function
names to "branch_landing_pad_state".

While here, add _prctl_ into the function names, following the
speculation control prctl implementation functions.

Link: https://lore.kernel.org/linux-riscv/CAHk-=whhSLGZAx3N5jJpb4GLFDqH_QvS07D+6BnkPWmCEzTAgw@mail.gmail.com/
Cc: Deepak Gupta <debug@rivosinc.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Paul Walmsley <pjw@kernel.org>

+19 -18
+8 -8
arch/riscv/kernel/usercfi.c
··· 457 457 return 0; 458 458 } 459 459 460 - int arch_get_indir_br_lp_status(struct task_struct *t, unsigned long __user *status) 460 + int arch_prctl_get_branch_landing_pad_state(struct task_struct *t, 461 + unsigned long __user *state) 461 462 { 462 463 unsigned long fcfi_status = 0; 463 464 ··· 468 467 /* indirect branch tracking is enabled on the task or not */ 469 468 fcfi_status |= (is_indir_lp_enabled(t) ? PR_INDIR_BR_LP_ENABLE : 0); 470 469 471 - return copy_to_user(status, &fcfi_status, sizeof(fcfi_status)) ? -EFAULT : 0; 470 + return copy_to_user(state, &fcfi_status, sizeof(fcfi_status)) ? -EFAULT : 0; 472 471 } 473 472 474 - int arch_set_indir_br_lp_status(struct task_struct *t, unsigned long status) 473 + int arch_prctl_set_branch_landing_pad_state(struct task_struct *t, unsigned long state) 475 474 { 476 475 bool enable_indir_lp = false; 477 476 ··· 483 482 return -EINVAL; 484 483 485 484 /* Reject unknown flags */ 486 - if (status & ~PR_INDIR_BR_LP_ENABLE) 485 + if (state & ~PR_INDIR_BR_LP_ENABLE) 487 486 return -EINVAL; 488 487 489 - enable_indir_lp = (status & PR_INDIR_BR_LP_ENABLE); 488 + enable_indir_lp = (state & PR_INDIR_BR_LP_ENABLE); 490 489 set_indir_lp_status(t, enable_indir_lp); 491 490 492 491 return 0; 493 492 } 494 493 495 - int arch_lock_indir_br_lp_status(struct task_struct *task, 496 - unsigned long arg) 494 + int arch_prctl_lock_branch_landing_pad_state(struct task_struct *task) 497 495 { 498 496 /* 499 497 * If indirect branch tracking is not supported or not enabled on task, 500 498 * nothing to lock here 501 499 */ 502 500 if (!is_user_lpad_enabled() || 503 - !is_indir_lp_enabled(task) || arg != 0) 501 + !is_indir_lp_enabled(task)) 504 502 return -EINVAL; 505 503 506 504 set_indir_lp_lock(task, true);
+3 -3
include/linux/cpu.h
··· 229 229 #define smt_mitigations SMT_MITIGATIONS_OFF 230 230 #endif 231 231 232 - int arch_get_indir_br_lp_status(struct task_struct *t, unsigned long __user *status); 233 - int arch_set_indir_br_lp_status(struct task_struct *t, unsigned long status); 234 - int arch_lock_indir_br_lp_status(struct task_struct *t, unsigned long status); 232 + int arch_prctl_get_branch_landing_pad_state(struct task_struct *t, unsigned long __user *state); 233 + int arch_prctl_set_branch_landing_pad_state(struct task_struct *t, unsigned long state); 234 + int arch_prctl_lock_branch_landing_pad_state(struct task_struct *t); 235 235 236 236 #endif /* _LINUX_CPU_H_ */
+8 -7
kernel/sys.c
··· 2388 2388 return -EINVAL; 2389 2389 } 2390 2390 2391 - int __weak arch_get_indir_br_lp_status(struct task_struct *t, unsigned long __user *status) 2391 + int __weak arch_prctl_get_branch_landing_pad_state(struct task_struct *t, 2392 + unsigned long __user *state) 2392 2393 { 2393 2394 return -EINVAL; 2394 2395 } 2395 2396 2396 - int __weak arch_set_indir_br_lp_status(struct task_struct *t, unsigned long status) 2397 + int __weak arch_prctl_set_branch_landing_pad_state(struct task_struct *t, unsigned long state) 2397 2398 { 2398 2399 return -EINVAL; 2399 2400 } 2400 2401 2401 - int __weak arch_lock_indir_br_lp_status(struct task_struct *t, unsigned long status) 2402 + int __weak arch_prctl_lock_branch_landing_pad_state(struct task_struct *t) 2402 2403 { 2403 2404 return -EINVAL; 2404 2405 } ··· 2892 2891 case PR_GET_INDIR_BR_LP_STATUS: 2893 2892 if (arg3 || arg4 || arg5) 2894 2893 return -EINVAL; 2895 - error = arch_get_indir_br_lp_status(me, (unsigned long __user *)arg2); 2894 + error = arch_prctl_get_branch_landing_pad_state(me, (unsigned long __user *)arg2); 2896 2895 break; 2897 2896 case PR_SET_INDIR_BR_LP_STATUS: 2898 2897 if (arg3 || arg4 || arg5) 2899 2898 return -EINVAL; 2900 - error = arch_set_indir_br_lp_status(me, arg2); 2899 + error = arch_prctl_set_branch_landing_pad_state(me, arg2); 2901 2900 break; 2902 2901 case PR_LOCK_INDIR_BR_LP_STATUS: 2903 - if (arg3 || arg4 || arg5) 2902 + if (arg2 || arg3 || arg4 || arg5) 2904 2903 return -EINVAL; 2905 - error = arch_lock_indir_br_lp_status(me, arg2); 2904 + error = arch_prctl_lock_branch_landing_pad_state(me); 2906 2905 break; 2907 2906 default: 2908 2907 trace_task_prctl_unknown(option, arg2, arg3, arg4, arg5);