Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: syscall: Fix AUDIT value for O32 processes on MIPS64

On MIPS64, O32 processes set both TIF_32BIT_ADDR and
TIF_32BIT_REGS so the previous condition treated O32 applications
as N32 when evaluating seccomp filters. Fix the condition to check
both TIF_32BIT_{REGS, ADDR} for the N32 AUDIT flag.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Patchwork: http://patchwork.linux-mips.org/patch/7480/
Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: James Hogan <james.hogan@imgtec.com>

authored by

Markos Chandras and committed by
Ralf Baechle
8d74ea0e 7ff1740f

+5 -3
+5 -3
arch/mips/include/asm/syscall.h
··· 131 131 { 132 132 int arch = EM_MIPS; 133 133 #ifdef CONFIG_64BIT 134 - if (!test_thread_flag(TIF_32BIT_REGS)) 134 + if (!test_thread_flag(TIF_32BIT_REGS)) { 135 135 arch |= __AUDIT_ARCH_64BIT; 136 - if (test_thread_flag(TIF_32BIT_ADDR)) 137 - arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; 136 + /* N32 sets only TIF_32BIT_ADDR */ 137 + if (test_thread_flag(TIF_32BIT_ADDR)) 138 + arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; 139 + } 138 140 #endif 139 141 #if defined(__LITTLE_ENDIAN) 140 142 arch |= __AUDIT_ARCH_LE;