[PATCH v3 08/14] parisc: mask compat syscall arguments in syscall_get_arguments()
Ricardo Robaina
rrobaina at redhat.com
Tue Sep 22 12:20:00 PDT 2026
A 32-bit compat task may leave garbage in the upper 32 bits of the
argument registers. Mask it off in syscall_get_arguments() so that
in-kernel consumers such as seccomp and audit observe the same values
the syscall actually used.
This previously happened for audit in the parisc do_syscall_trace_enter()
compat path; do it in the helper so all callers benefit and to prepare
for passing pt_regs to audit_syscall_entry().
Signed-off-by: Ricardo Robaina <rrobaina at redhat.com>
---
arch/parisc/include/asm/syscall.h | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/parisc/include/asm/syscall.h b/arch/parisc/include/asm/syscall.h
index c11222798ab2..9d10fada3b48 100644
--- a/arch/parisc/include/asm/syscall.h
+++ b/arch/parisc/include/asm/syscall.h
@@ -28,12 +28,18 @@ static inline void syscall_get_arguments(struct task_struct *tsk,
struct pt_regs *regs,
unsigned long *args)
{
- args[5] = regs->gr[21];
- args[4] = regs->gr[22];
- args[3] = regs->gr[23];
- args[2] = regs->gr[24];
- args[1] = regs->gr[25];
- args[0] = regs->gr[26];
+ unsigned long mask = -1UL;
+
+ /* Mask off garbage in the upper 32 bits for compat tasks. */
+ if (__is_compat_task(tsk))
+ mask = 0xffffffff;
+
+ args[5] = regs->gr[21] & mask;
+ args[4] = regs->gr[22] & mask;
+ args[3] = regs->gr[23] & mask;
+ args[2] = regs->gr[24] & mask;
+ args[1] = regs->gr[25] & mask;
+ args[0] = regs->gr[26] & mask;
}
static inline void syscall_set_arguments(struct task_struct *tsk,
--
2.55.0
More information about the linux-arm-kernel
mailing list