* [PATCH] mm/pkeys: Remove unused tsk parameter from arch_set_user_pkey_access()
[not found] <CGME20260219063513epcas1p15c63c2cdc21afdc58de9e5dd5e741833@epcas1p1.samsung.com>
@ 2026-02-19 6:35 ` Seongsu Park
0 siblings, 0 replies; only message in thread
From: Seongsu Park @ 2026-02-19 6:35 UTC (permalink / raw)
To: catalin.marinas, will, maddy, mpe, tglx, mingo, bp, dave.hansen,
akpm, Liam.Howlett, lorenzo.stoakes
Cc: linux-arm-kernel, linux-kernel, linuxppc-dev, linux-mm, Seongsu Park
The tsk parameter in arch_set_user_pkey_access() is never used
in the function implementations across all architectures (arm64,
powerpc, x86).
Signed-off-by: Seongsu Park <sgsu.park@samsung.com>
---
arch/arm64/include/asm/pkeys.h | 3 +--
arch/arm64/mm/mmu.c | 2 +-
arch/powerpc/include/asm/pkeys.h | 8 +++-----
arch/powerpc/mm/book3s64/pkeys.c | 3 +--
arch/x86/include/asm/pkeys.h | 3 +--
arch/x86/kernel/fpu/xstate.c | 3 +--
arch/x86/mm/pkeys.c | 3 +--
mm/mprotect.c | 2 +-
8 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/arch/arm64/include/asm/pkeys.h b/arch/arm64/include/asm/pkeys.h
index 0ca5f83ce148..cd286d3a9c94 100644
--- a/arch/arm64/include/asm/pkeys.h
+++ b/arch/arm64/include/asm/pkeys.h
@@ -12,8 +12,7 @@
#define arch_max_pkey() 8
-int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
- unsigned long init_val);
+int arch_set_user_pkey_access(int pkey, unsigned long init_val);
static inline bool arch_pkeys_enabled(void)
{
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 9ae7ce00a7ef..3fc8566708ea 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -2207,7 +2207,7 @@ void __cpu_replace_ttbr1(pgd_t *pgdp, bool cnp)
}
#ifdef CONFIG_ARCH_HAS_PKEYS
-int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, unsigned long init_val)
+int arch_set_user_pkey_access(int pkey, unsigned long init_val)
{
u64 new_por;
u64 old_por;
diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h
index 28e752138996..bd20d4106471 100644
--- a/arch/powerpc/include/asm/pkeys.h
+++ b/arch/powerpc/include/asm/pkeys.h
@@ -143,10 +143,8 @@ static inline int arch_override_mprotect_pkey(struct vm_area_struct *vma,
return __arch_override_mprotect_pkey(vma, prot, pkey);
}
-extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
- unsigned long init_val);
-static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
- unsigned long init_val)
+extern int __arch_set_user_pkey_access(int pkey, unsigned long init_val);
+static inline int arch_set_user_pkey_access(int pkey, unsigned long init_val)
{
if (!mmu_has_feature(MMU_FTR_PKEY))
return -EINVAL;
@@ -160,7 +158,7 @@ static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
if (pkey == 0)
return init_val ? -EINVAL : 0;
- return __arch_set_user_pkey_access(tsk, pkey, init_val);
+ return __arch_set_user_pkey_access(pkey, init_val);
}
static inline bool arch_pkeys_enabled(void)
diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c
index a974baf8f327..2002331b05ba 100644
--- a/arch/powerpc/mm/book3s64/pkeys.c
+++ b/arch/powerpc/mm/book3s64/pkeys.c
@@ -335,8 +335,7 @@ static inline void init_iamr(int pkey, u8 init_bits)
* Set the access rights in AMR IAMR and UAMOR registers for @pkey to that
* specified in @init_val.
*/
-int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
- unsigned long init_val)
+int __arch_set_user_pkey_access(int pkey, unsigned long init_val)
{
u64 new_amr_bits = 0x0ul;
u64 new_iamr_bits = 0x0ul;
diff --git a/arch/x86/include/asm/pkeys.h b/arch/x86/include/asm/pkeys.h
index 2e6c04d8a45b..06ed2cd2592e 100644
--- a/arch/x86/include/asm/pkeys.h
+++ b/arch/x86/include/asm/pkeys.h
@@ -9,8 +9,7 @@
*/
#define arch_max_pkey() (cpu_feature_enabled(X86_FEATURE_OSPKE) ? 16 : 1)
-extern int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
- unsigned long init_val);
+extern int arch_set_user_pkey_access(int pkey, unsigned long init_val);
static inline bool arch_pkeys_enabled(void)
{
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 48113c5193aa..0caf91a7e062 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -1080,8 +1080,7 @@ void __user *get_xsave_addr_user(struct xregs_state __user *xsave, int xfeature_
* This will go out and modify PKRU register to set the access
* rights for @pkey to @init_val.
*/
-int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
- unsigned long init_val)
+int arch_set_user_pkey_access(int pkey, unsigned long init_val)
{
u32 old_pkru, new_pkru_bits = 0;
int pkey_shift;
diff --git a/arch/x86/mm/pkeys.c b/arch/x86/mm/pkeys.c
index 7418c367e328..1dfcfaf77e23 100644
--- a/arch/x86/mm/pkeys.c
+++ b/arch/x86/mm/pkeys.c
@@ -42,8 +42,7 @@ int __execute_only_pkey(struct mm_struct *mm)
* Set up PKRU so that it denies access for everything
* other than execution.
*/
- ret = arch_set_user_pkey_access(current, execute_only_pkey,
- PKEY_DISABLE_ACCESS);
+ ret = arch_set_user_pkey_access(execute_only_pkey, PKEY_DISABLE_ACCESS);
/*
* If the PKRU-set operation failed somehow, just return
* 0 and effectively disable execute-only support.
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 283889e4f1ce..fea7d56f55e3 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -978,7 +978,7 @@ SYSCALL_DEFINE2(pkey_alloc, unsigned long, flags, unsigned long, init_val)
if (pkey == -1)
goto out;
- ret = arch_set_user_pkey_access(current, pkey, init_val);
+ ret = arch_set_user_pkey_access(pkey, init_val);
if (ret) {
mm_pkey_free(current->mm, pkey);
goto out;
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread