Skip to content

Commit 16add41

Browse files
ldv-altpcmoore
authored andcommitted
syscall_get_arch: add "struct task_struct *" argument
This argument is required to extend the generic ptrace API with PTRACE_GET_SYSCALL_INFO request: syscall_get_arch() is going to be called from ptrace_request() along with syscall_get_nr(), syscall_get_arguments(), syscall_get_error(), and syscall_get_return_value() functions with a tracee as their argument. The primary intent is that the triple (audit_arch, syscall_nr, arg1..arg6) should describe what system call is being called and what its arguments are. Reverts: 5e937a9 ("syscall_get_arch: remove useless function arguments") Reverts: 1002d94 ("syscall.h: fix doc text for syscall_get_arch()") Reviewed-by: Andy Lutomirski <luto@kernel.org> # for x86 Reviewed-by: Palmer Dabbelt <palmer@sifive.com> Acked-by: Paul Moore <paul@paul-moore.com> Acked-by: Paul Burton <paul.burton@mips.com> # MIPS parts Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Acked-by: Kees Cook <keescook@chromium.org> # seccomp parts Acked-by: Mark Salter <msalter@redhat.com> # for the c6x bit Cc: Elvira Khabirova <lineprinter@altlinux.org> Cc: Eugene Syromyatnikov <esyr@redhat.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: x86@kernel.org Cc: linux-alpha@vger.kernel.org Cc: linux-snps-arc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-c6x-dev@linux-c6x.org Cc: uclinux-h8-devel@lists.sourceforge.jp Cc: linux-hexagon@vger.kernel.org Cc: linux-ia64@vger.kernel.org Cc: linux-m68k@lists.linux-m68k.org Cc: linux-mips@vger.kernel.org Cc: nios2-dev@lists.rocketboards.org Cc: openrisc@lists.librecores.org Cc: linux-parisc@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-riscv@lists.infradead.org Cc: linux-s390@vger.kernel.org Cc: linux-sh@vger.kernel.org Cc: sparclinux@vger.kernel.org Cc: linux-um@lists.infradead.org Cc: linux-xtensa@linux-xtensa.org Cc: linux-arch@vger.kernel.org Cc: linux-audit@redhat.com Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent b15fe94 commit 16add41

30 files changed

Lines changed: 52 additions & 42 deletions

File tree

‎arch/alpha/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <uapi/linux/audit.h>
66

7-
static inline int syscall_get_arch(void)
7+
static inline int syscall_get_arch(struct task_struct *task)
88
{
99
return AUDIT_ARCH_ALPHA;
1010
}

‎arch/arc/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
7070
}
7171

7272
static inline int
73-
syscall_get_arch(void)
73+
syscall_get_arch(struct task_struct *task)
7474
{
7575
return IS_ENABLED(CONFIG_ISA_ARCOMPACT)
7676
? (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)

‎arch/arm/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
104104
memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0]));
105105
}
106106

107-
static inline int syscall_get_arch(void)
107+
static inline int syscall_get_arch(struct task_struct *task)
108108
{
109109
/* ARM tasks don't change audit architectures on the fly. */
110110
return AUDIT_ARCH_ARM;

‎arch/arm64/include/asm/syscall.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
117117
* We don't care about endianness (__AUDIT_ARCH_LE bit) here because
118118
* AArch64 has the same system calls both on little- and big- endian.
119119
*/
120-
static inline int syscall_get_arch(void)
120+
static inline int syscall_get_arch(struct task_struct *task)
121121
{
122-
if (is_compat_task())
122+
if (is_compat_thread(task_thread_info(task)))
123123
return AUDIT_ARCH_ARM;
124124

125125
return AUDIT_ARCH_AARCH64;

‎arch/c6x/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
121121
}
122122
}
123123

124-
static inline int syscall_get_arch(void)
124+
static inline int syscall_get_arch(struct task_struct *task)
125125
{
126126
return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
127127
? AUDIT_ARCH_C6XBE : AUDIT_ARCH_C6X;

‎arch/csky/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
7070
}
7171

7272
static inline int
73-
syscall_get_arch(void)
73+
syscall_get_arch(struct task_struct *task)
7474
{
7575
return AUDIT_ARCH_CSKY;
7676
}

‎arch/h8300/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
4949
}
5050

5151
static inline int
52-
syscall_get_arch(void)
52+
syscall_get_arch(struct task_struct *task)
5353
{
5454
return AUDIT_ARCH_H8300;
5555
}

‎arch/hexagon/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
4646
memcpy(args, &(&regs->r00)[i], n * sizeof(args[0]));
4747
}
4848

49-
static inline int syscall_get_arch(void)
49+
static inline int syscall_get_arch(struct task_struct *task)
5050
{
5151
return AUDIT_ARCH_HEXAGON;
5252
}

‎arch/ia64/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
8181
ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
8282
}
8383

84-
static inline int syscall_get_arch(void)
84+
static inline int syscall_get_arch(struct task_struct *task)
8585
{
8686
return AUDIT_ARCH_IA64;
8787
}

‎arch/m68k/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <uapi/linux/audit.h>
66

7-
static inline int syscall_get_arch(void)
7+
static inline int syscall_get_arch(struct task_struct *task)
88
{
99
return AUDIT_ARCH_M68K;
1010
}

0 commit comments

Comments
 (0)