Commit 25274524 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/audit: Fix syscall_get_arch()

Commit 770cec16 ("powerpc/audit: Simplify syscall_get_arch()")
and commit 898a1ef0 ("powerpc/audit: Avoid unneccessary #ifdef
in syscall_get_arguments()")
replaced test_tsk_thread_flag(task, TIF_32BIT)) by is_32bit_task().

But is_32bit_task() applies on current task while be want the test
done on task 'task'

So add a new macro is_tsk_32bit_task() to check any task.

Fixes: 770cec16 ("powerpc/audit: Simplify syscall_get_arch()")
Fixes: 898a1ef0 ("powerpc/audit: Avoid unneccessary #ifdef in syscall_get_arguments()")
Cc: stable@vger.kernel.org
Reported-by: default avatarDmitry V. Levin <ldv@altlinux.org>
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/c55cddb8f65713bf5859ed675d75a50cb37d5995.1642159570.git.christophe.leroy@csgroup.eu
parent 3f5f766d
...@@ -90,7 +90,7 @@ static inline void syscall_get_arguments(struct task_struct *task, ...@@ -90,7 +90,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
unsigned long val, mask = -1UL; unsigned long val, mask = -1UL;
unsigned int n = 6; unsigned int n = 6;
if (is_32bit_task()) if (is_tsk_32bit_task(task))
mask = 0xffffffff; mask = 0xffffffff;
while (n--) { while (n--) {
...@@ -105,7 +105,7 @@ static inline void syscall_get_arguments(struct task_struct *task, ...@@ -105,7 +105,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
static inline int syscall_get_arch(struct task_struct *task) static inline int syscall_get_arch(struct task_struct *task)
{ {
if (is_32bit_task()) if (is_tsk_32bit_task(task))
return AUDIT_ARCH_PPC; return AUDIT_ARCH_PPC;
else if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN)) else if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN))
return AUDIT_ARCH_PPC64LE; return AUDIT_ARCH_PPC64LE;
......
...@@ -168,8 +168,10 @@ static inline bool test_thread_local_flags(unsigned int flags) ...@@ -168,8 +168,10 @@ static inline bool test_thread_local_flags(unsigned int flags)
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
#define is_32bit_task() (test_thread_flag(TIF_32BIT)) #define is_32bit_task() (test_thread_flag(TIF_32BIT))
#define is_tsk_32bit_task(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT))
#else #else
#define is_32bit_task() (IS_ENABLED(CONFIG_PPC32)) #define is_32bit_task() (IS_ENABLED(CONFIG_PPC32))
#define is_tsk_32bit_task(tsk) (IS_ENABLED(CONFIG_PPC32))
#endif #endif
#if defined(CONFIG_PPC64) #if defined(CONFIG_PPC64)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment