ARM/audit: use correct arch on audit_syscall_enter
Subsystems (2)
PATCH 1/1 ARM/audit: use correct arch on audit_syscall_enter
ARM has both LE and BE versions however the audit code was called as if it was always BE. If audit userspace were to try to interpret the bits it got from a LE system it would obviously do so incorrectly. Fix this by using the right arch flag on the right system.
--- arch/arm/kernel/ptrace.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/kernel/ptrace.c +6 -1
@@ -915,10 +915,15 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) ip = regs->ARM_ip; regs->ARM_ip = why; +#ifdef __ARMEB__ +#define AUDIT_ARCH_NR AUDIT_ARCH_ARMEB +#else +#define AUDIT_ARCH_NR AUDIT_ARCH_ARM +#endif if (!ip)audit_syscall_exit (regs);else -audit_syscall_entry (AUDIT_ARCH_ARMEB , scno, regs->ARM_r0, +audit_syscall_entry (AUDIT_ARCH_NR , scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2, regs->ARM_r3);if (!test_thread_flag (TIF_SYSCALL_TRACE ))
Signature · 1 line
1.7.1
PATCH 1/1 ARM/audit: use correct arch on audit_syscall_enter
Hi Eric,
Quoted 9 lines · Eric Paris
ARM has both LE and BE versions however the audit code was called as if it was always BE. If audit userspace were to try to interpret the bits it got from a LE system it would obviously do so incorrectly. Fix this by using the right arch flag on the right system.
Signed-off-by Eric Paris <[email protected]>--- arch/arm/kernel/ptrace.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
It might be worth adding the #include <linux/audit.h> in this patch as well, since they're both fixes for problems introduced by the same commit. That way we only need to deal with one patch as well.
arch/arm/kernel/ptrace.c asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) · line 922
Quoted 13 lines
arch/arm/kernel/ptrace.c +5
-0@@ -915,10 +915,15 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) ip = regs->ARM_ip; regs->ARM_ip = why; +#ifdef __ARMEB__ +#define AUDIT_ARCH_NR AUDIT_ARCH_ARMEB +#else +#define AUDIT_ARCH_NR AUDIT_ARCH_ARM +#endif
Pedantry, but I prefer the #defines outside of the function scope (I'd probably just stick them before the function given that they're not used anywhere else).
arch/arm/kernel/ptrace.c asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) · line 929
Quoted 8 lines
arch/arm/kernel/ptrace.c +1
-1if (!ip)audit_syscall_exit (regs);else -audit_syscall_entry (AUDIT_ARCH_ARMEB , scno, regs->ARM_r0, +audit_syscall_entry (AUDIT_ARCH_NR , scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2, regs->ARM_r3);if (!test_thread_flag (TIF_SYSCALL_TRACE ))
Cheers,
Will
PATCH 1/1 ARM/audit: use correct arch on audit_syscall_enter
Quoted 8 lines · Will Deacon
Hi Eric,
Quoted 5 lines · Eric Paris
ARM has both LE and BE versions however the audit code was called as if it was always BE. If audit userspace were to try to interpret the bits it got from a LE system it would obviously do so incorrectly. Fix this by using the right arch flag on the right system.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Eric Paris <[email protected]>--- arch/arm/kernel/ptrace.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)It might be worth adding the #include <
linux/audit.h> in this patch as well, since they're both fixes for problems introduced by the same commit. That way we only need to deal with one patch as well.
Doing that fixes two distinct bugs in one patch, which most subsystems frown upon, but I guess your reason makes sense and we can be sure one of them doesn't get lost. I'll resend.
Quoted 8 lines
Quoted 8 lines
arch/arm/kernel/ptrace.c +0
-0@@ -915,10 +915,15 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) ip = regs->ARM_ip; regs->ARM_ip = why;
Quoted 8 lines
arch/arm/kernel/ptrace.c asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) · line 922
Quoted 5 lines
arch/arm/kernel/ptrace.c +5
-0+#ifdef __ARMEB__ +#define AUDIT_ARCH_NR AUDIT_ARCH_ARMEB +#else +#define AUDIT_ARCH_NR AUDIT_ARCH_ARM +#endif Pedantry, but I prefer the #defines outside of the function scope (I'd probably just stick them before the function given that they're not used anywhere else).
Fair enough. Will do.
Quoted 12 lines
arch/arm/kernel/ptrace.c asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) · line 929
Quoted 8 lines
arch/arm/kernel/ptrace.c +1
-1if (!ip)audit_syscall_exit (regs);else -audit_syscall_entry (AUDIT_ARCH_ARMEB , scno, regs->ARM_r0, +audit_syscall_entry (AUDIT_ARCH_NR , scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2, regs->ARM_r3);if (!test_thread_flag (TIF_SYSCALL_TRACE ))Cheers,
Will