Skip to content

Commit 2527452

Browse files
chleroympe
authored andcommitted
powerpc/audit: Fix syscall_get_arch()
Commit 770cec1 ("powerpc/audit: Simplify syscall_get_arch()") and commit 898a1ef ("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: 770cec1 ("powerpc/audit: Simplify syscall_get_arch()") Fixes: 898a1ef ("powerpc/audit: Avoid unneccessary #ifdef in syscall_get_arguments()") Cc: [email protected] Reported-by: Dmitry V. Levin <[email protected]> Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/c55cddb8f65713bf5859ed675d75a50cb37d5995.1642159570.git.christophe.leroy@csgroup.eu
1 parent 3f5f766 commit 2527452

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

arch/powerpc/include/asm/syscall.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
9090
unsigned long val, mask = -1UL;
9191
unsigned int n = 6;
9292

93-
if (is_32bit_task())
93+
if (is_tsk_32bit_task(task))
9494
mask = 0xffffffff;
9595

9696
while (n--) {
@@ -105,7 +105,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
105105

106106
static inline int syscall_get_arch(struct task_struct *task)
107107
{
108-
if (is_32bit_task())
108+
if (is_tsk_32bit_task(task))
109109
return AUDIT_ARCH_PPC;
110110
else if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN))
111111
return AUDIT_ARCH_PPC64LE;

arch/powerpc/include/asm/thread_info.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,10 @@ static inline bool test_thread_local_flags(unsigned int flags)
168168

169169
#ifdef CONFIG_COMPAT
170170
#define is_32bit_task() (test_thread_flag(TIF_32BIT))
171+
#define is_tsk_32bit_task(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT))
171172
#else
172173
#define is_32bit_task() (IS_ENABLED(CONFIG_PPC32))
174+
#define is_tsk_32bit_task(tsk) (IS_ENABLED(CONFIG_PPC32))
173175
#endif
174176

175177
#if defined(CONFIG_PPC64)

0 commit comments

Comments
 (0)