linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO
@ 2019-01-09 12:40 Dmitry V. Levin
  2019-01-09 12:42 ` [PATCH 01/14] Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h Dmitry V. Levin
                   ` (14 more replies)
  0 siblings, 15 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:40 UTC (permalink / raw)
  To: Paul Moore
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, linux-audit, linux-kernel

syscall_get_arch() is required to be implemented on all architectures in order
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.

This patchset began as a series called "Prepare for PTRACE_GET_SYSCALL_INFO",
then I merged it into a series called "ptrace: add PTRACE_GET_SYSCALL_INFO request"
that also contains ptrace-specific changes.

The ptrace-specific part, however, needs more attention to workaround problems
on niche architectures like alpha, while the syscall_get_arch() part is
straightforward, so I decided to split it out into a separate patchset that
just prepares syscall_get_arch() for PTRACE_GET_SYSCALL_INFO: it adds
syscall_get_arch() to those architectures that haven't implemented it yet,
and then adds "struct task_struct *" argument to syscall_get_arch()
on all architectures.

All patches from this patchset have been already reviewed, so it's ready
to be merged without waiting for the ptrace-specific part.  As it's all
about syscall_get_arch(), it should probably go via audit tree.

Dmitry V. Levin (14):
  Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h
  arc: define syscall_get_arch()
  c6x: define syscall_get_arch()
  h8300: define syscall_get_arch()
  Move EM_HEXAGON to uapi/linux/elf-em.h
  hexagon: define syscall_get_arch()
  m68k: define syscall_get_arch()
  Move EM_NDS32 to uapi/linux/elf-em.h
  nds32: define syscall_get_arch()
  nios2: define syscall_get_arch()
  riscv: define syscall_get_arch()
  Move EM_UNICORE to uapi/linux/elf-em.h
  unicore32: define syscall_get_arch()
  syscall_get_arch: add "struct task_struct *" argument

 arch/alpha/include/asm/syscall.h      |  2 +-
 arch/arc/include/asm/elf.h            |  6 +-----
 arch/arc/include/asm/syscall.h        | 11 +++++++++++
 arch/arm/include/asm/syscall.h        |  2 +-
 arch/arm64/include/asm/syscall.h      |  4 ++--
 arch/c6x/include/asm/syscall.h        |  7 +++++++
 arch/csky/include/asm/syscall.h       |  2 +-
 arch/h8300/include/asm/syscall.h      |  6 ++++++
 arch/hexagon/include/asm/elf.h        |  6 +-----
 arch/hexagon/include/asm/syscall.h    |  8 ++++++++
 arch/ia64/include/asm/syscall.h       |  2 +-
 arch/m68k/include/asm/syscall.h       | 12 ++++++++++++
 arch/microblaze/include/asm/syscall.h |  2 +-
 arch/mips/include/asm/syscall.h       |  6 +++---
 arch/mips/kernel/ptrace.c             |  2 +-
 arch/nds32/include/asm/elf.h          |  3 +--
 arch/nds32/include/asm/syscall.h      |  9 +++++++++
 arch/nios2/include/asm/syscall.h      |  6 ++++++
 arch/openrisc/include/asm/syscall.h   |  2 +-
 arch/parisc/include/asm/syscall.h     |  4 ++--
 arch/powerpc/include/asm/syscall.h    | 10 ++++++++--
 arch/riscv/include/asm/syscall.h      | 10 ++++++++++
 arch/s390/include/asm/syscall.h       |  4 ++--
 arch/sh/include/asm/syscall_32.h      |  2 +-
 arch/sh/include/asm/syscall_64.h      |  2 +-
 arch/sparc/include/asm/syscall.h      |  5 +++--
 arch/unicore32/include/asm/elf.h      |  3 +--
 arch/unicore32/include/asm/syscall.h  | 12 ++++++++++++
 arch/x86/include/asm/syscall.h        |  8 +++++---
 arch/x86/um/asm/syscall.h             |  2 +-
 arch/xtensa/include/asm/syscall.h     |  2 +-
 include/asm-generic/syscall.h         |  5 +++--
 include/uapi/linux/audit.h            | 14 ++++++++++++++
 include/uapi/linux/elf-em.h           |  6 ++++++
 kernel/auditsc.c                      |  4 ++--
 kernel/seccomp.c                      |  4 ++--
 36 files changed, 148 insertions(+), 47 deletions(-)
 create mode 100644 arch/m68k/include/asm/syscall.h
 create mode 100644 arch/unicore32/include/asm/syscall.h

-- 
ldv

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 01/14] Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
@ 2019-01-09 12:42 ` Dmitry V. Levin
  2019-01-09 12:42 ` [PATCH 02/14] arc: define syscall_get_arch() Dmitry V. Levin
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:42 UTC (permalink / raw)
  To: Paul Moore
  Cc: Vineet Gupta, Elvira Khabirova, Eugene Syromyatnikov,
	Alexey Brodkin, Oleg Nesterov, Andy Lutomirski, linux-snps-arc,
	linux-audit, linux-kernel

These should never have been defined in the arch tree to begin with, and
now uapi/linux/audit.h header is going to use EM_ARCOMPACT and EM_ARCV2
in order to define AUDIT_ARCH_ARCOMPACT and AUDIT_ARCH_ARCV2 which are
needed to implement syscall_get_arch() which in turn is required to
extend the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/arc/include/asm/elf.h  | 6 +-----
 include/uapi/linux/elf-em.h | 2 ++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/arc/include/asm/elf.h b/arch/arc/include/asm/elf.h
index aa2d6da9d187..2b80c184c9c8 100644
--- a/arch/arc/include/asm/elf.h
+++ b/arch/arc/include/asm/elf.h
@@ -10,13 +10,9 @@
 #define __ASM_ARC_ELF_H
 
 #include <linux/types.h>
+#include <linux/elf-em.h>
 #include <uapi/asm/elf.h>
 
-/* These ELF defines belong to uapi but libc elf.h already defines them */
-#define EM_ARCOMPACT		93
-
-#define EM_ARCV2		195	/* ARCv2 Cores */
-
 #define EM_ARC_INUSE		(IS_ENABLED(CONFIG_ISA_ARCOMPACT) ? \
 					EM_ARCOMPACT : EM_ARCV2)
 
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index 0c3000faedba..081675ed89cb 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -34,6 +34,7 @@
 #define EM_M32R		88	/* Renesas M32R */
 #define EM_MN10300	89	/* Panasonic/MEI MN10300, AM33 */
 #define EM_OPENRISC     92     /* OpenRISC 32-bit embedded processor */
+#define EM_ARCOMPACT	93	/* ARCompact processor */
 #define EM_XTENSA	94	/* Tensilica Xtensa Architecture */
 #define EM_BLACKFIN     106     /* ADI Blackfin Processor */
 #define EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
@@ -42,6 +43,7 @@
 #define EM_TILEPRO	188	/* Tilera TILEPro */
 #define EM_MICROBLAZE	189	/* Xilinx MicroBlaze */
 #define EM_TILEGX	191	/* Tilera TILE-Gx */
+#define EM_ARCV2	195	/* ARCv2 Cores */
 #define EM_RISCV	243	/* RISC-V */
 #define EM_BPF		247	/* Linux BPF - in-kernel virtual machine */
 #define EM_CSKY		252	/* C-SKY */
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/14] arc: define syscall_get_arch()
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
  2019-01-09 12:42 ` [PATCH 01/14] Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h Dmitry V. Levin
@ 2019-01-09 12:42 ` Dmitry V. Levin
  2019-01-09 12:42 ` [PATCH 03/14] c6x: " Dmitry V. Levin
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:42 UTC (permalink / raw)
  To: Paul Moore
  Cc: Vineet Gupta, Alexey Brodkin, Elvira Khabirova,
	Eugene Syromyatnikov, Oleg Nesterov, Andy Lutomirski,
	linux-snps-arc, linux-audit, linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/arc/include/asm/syscall.h | 11 +++++++++++
 include/uapi/linux/audit.h     |  4 ++++
 2 files changed, 15 insertions(+)

diff --git a/arch/arc/include/asm/syscall.h b/arch/arc/include/asm/syscall.h
index 29de09804306..c7fc4c0c3bcb 100644
--- a/arch/arc/include/asm/syscall.h
+++ b/arch/arc/include/asm/syscall.h
@@ -9,6 +9,7 @@
 #ifndef _ASM_ARC_SYSCALL_H
 #define _ASM_ARC_SYSCALL_H  1
 
+#include <uapi/linux/audit.h>
 #include <linux/err.h>
 #include <linux/sched.h>
 #include <asm/unistd.h>
@@ -68,4 +69,14 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
 	}
 }
 
+static inline int
+syscall_get_arch(void)
+{
+	return IS_ENABLED(CONFIG_ISA_ARCOMPACT)
+		? (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
+			? AUDIT_ARCH_ARCOMPACTBE : AUDIT_ARCH_ARCOMPACT)
+		: (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
+			? AUDIT_ARCH_ARCV2BE : AUDIT_ARCH_ARCV2);
+}
+
 #endif
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 36a7e3f18e69..41d8fa80ebad 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -375,6 +375,10 @@ enum {
 
 #define AUDIT_ARCH_AARCH64	(EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_ALPHA	(EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_ARCOMPACT	(EM_ARCOMPACT|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_ARCOMPACTBE	(EM_ARCOMPACT)
+#define AUDIT_ARCH_ARCV2	(EM_ARCV2|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_ARCV2BE	(EM_ARCV2)
 #define AUDIT_ARCH_ARM		(EM_ARM|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_ARMEB	(EM_ARM)
 #define AUDIT_ARCH_CRIS		(EM_CRIS|__AUDIT_ARCH_LE)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/14] c6x: define syscall_get_arch()
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
  2019-01-09 12:42 ` [PATCH 01/14] Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h Dmitry V. Levin
  2019-01-09 12:42 ` [PATCH 02/14] arc: define syscall_get_arch() Dmitry V. Levin
@ 2019-01-09 12:42 ` Dmitry V. Levin
  2019-01-09 12:42 ` [PATCH 04/14] h8300: " Dmitry V. Levin
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:42 UTC (permalink / raw)
  To: Paul Moore
  Cc: Mark Salter, Elvira Khabirova, Eugene Syromyatnikov,
	Aurelien Jacquiot, Oleg Nesterov, Andy Lutomirski, linux-c6x-dev,
	linux-audit, linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Mark Salter <msalter@redhat.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Aurelien Jacquiot <jacquiot.aurelien@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-c6x-dev@linux-c6x.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/c6x/include/asm/syscall.h | 7 +++++++
 include/uapi/linux/audit.h     | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/arch/c6x/include/asm/syscall.h b/arch/c6x/include/asm/syscall.h
index ae2be315ee9c..39dbd1ef994c 100644
--- a/arch/c6x/include/asm/syscall.h
+++ b/arch/c6x/include/asm/syscall.h
@@ -11,6 +11,7 @@
 #ifndef __ASM_C6X_SYSCALL_H
 #define __ASM_C6X_SYSCALL_H
 
+#include <uapi/linux/audit.h>
 #include <linux/err.h>
 #include <linux/sched.h>
 
@@ -120,4 +121,10 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	}
 }
 
+static inline int syscall_get_arch(void)
+{
+	return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
+		? AUDIT_ARCH_C6XBE : AUDIT_ARCH_C6X;
+}
+
 #endif /* __ASM_C6X_SYSCALLS_H */
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 41d8fa80ebad..e3d0255b4fc2 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -381,6 +381,8 @@ enum {
 #define AUDIT_ARCH_ARCV2BE	(EM_ARCV2)
 #define AUDIT_ARCH_ARM		(EM_ARM|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_ARMEB	(EM_ARM)
+#define AUDIT_ARCH_C6X		(EM_TI_C6000|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_C6XBE	(EM_TI_C6000)
 #define AUDIT_ARCH_CRIS		(EM_CRIS|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_CSKY		(EM_CSKY|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_FRV		(EM_FRV)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/14] h8300: define syscall_get_arch()
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (2 preceding siblings ...)
  2019-01-09 12:42 ` [PATCH 03/14] c6x: " Dmitry V. Levin
@ 2019-01-09 12:42 ` Dmitry V. Levin
  2019-02-27 15:29   ` Dmitry V. Levin
  2019-01-09 12:43 ` [PATCH 05/14] Move EM_HEXAGON to uapi/linux/elf-em.h Dmitry V. Levin
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:42 UTC (permalink / raw)
  To: Paul Moore
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Yoshinori Sato,
	Oleg Nesterov, Andy Lutomirski, uclinux-h8-devel, linux-audit,
	linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: uclinux-h8-devel@lists.sourceforge.jp
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/h8300/include/asm/syscall.h | 6 ++++++
 include/uapi/linux/audit.h       | 1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/h8300/include/asm/syscall.h b/arch/h8300/include/asm/syscall.h
index 924990401237..5135910616e2 100644
--- a/arch/h8300/include/asm/syscall.h
+++ b/arch/h8300/include/asm/syscall.h
@@ -8,6 +8,7 @@
 #include <linux/linkage.h>
 #include <linux/types.h>
 #include <linux/ptrace.h>
+#include <uapi/linux/audit.h>
 
 static inline int
 syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
@@ -47,6 +48,11 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
 	}
 }
 
+static inline int
+syscall_get_arch(void)
+{
+	return AUDIT_ARCH_H8300;
+}
 
 
 /* Misc syscall related bits */
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index e3d0255b4fc2..c6a6e3a9ec9a 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -386,6 +386,7 @@ enum {
 #define AUDIT_ARCH_CRIS		(EM_CRIS|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_CSKY		(EM_CSKY|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_FRV		(EM_FRV)
+#define AUDIT_ARCH_H8300	(EM_H8_300)
 #define AUDIT_ARCH_I386		(EM_386|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_IA64		(EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_M32R		(EM_M32R)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/14] Move EM_HEXAGON to uapi/linux/elf-em.h
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (3 preceding siblings ...)
  2019-01-09 12:42 ` [PATCH 04/14] h8300: " Dmitry V. Levin
@ 2019-01-09 12:43 ` Dmitry V. Levin
  2019-02-27 15:29   ` Dmitry V. Levin
  2019-01-09 12:43 ` [PATCH 06/14] hexagon: define syscall_get_arch() Dmitry V. Levin
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, Richard Kuo, linux-hexagon, linux-audit,
	linux-kernel

This should never have been defined in the arch tree to begin with,
and now uapi/linux/audit.h header is going to use EM_HEXAGON
in order to define AUDIT_ARCH_HEXAGON which is needed to implement
syscall_get_arch() which in turn is required to extend
the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: linux-hexagon@vger.kernel.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/hexagon/include/asm/elf.h | 6 +-----
 include/uapi/linux/elf-em.h    | 1 +
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/hexagon/include/asm/elf.h b/arch/hexagon/include/asm/elf.h
index 80311e7b8ca6..d10fbd54ae51 100644
--- a/arch/hexagon/include/asm/elf.h
+++ b/arch/hexagon/include/asm/elf.h
@@ -23,11 +23,7 @@
 
 #include <asm/ptrace.h>
 #include <asm/user.h>
-
-/*
- * This should really be in linux/elf-em.h.
- */
-#define EM_HEXAGON	164   /* QUALCOMM Hexagon */
+#include <linux/elf-em.h>
 
 struct elf32_hdr;
 
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index 081675ed89cb..bd02325028d8 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -39,6 +39,7 @@
 #define EM_BLACKFIN     106     /* ADI Blackfin Processor */
 #define EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
 #define EM_TI_C6000	140	/* TI C6X DSPs */
+#define EM_HEXAGON	164	/* QUALCOMM Hexagon */
 #define EM_AARCH64	183	/* ARM 64 bit */
 #define EM_TILEPRO	188	/* Tilera TILEPro */
 #define EM_MICROBLAZE	189	/* Xilinx MicroBlaze */
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/14] hexagon: define syscall_get_arch()
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (4 preceding siblings ...)
  2019-01-09 12:43 ` [PATCH 05/14] Move EM_HEXAGON to uapi/linux/elf-em.h Dmitry V. Levin
@ 2019-01-09 12:43 ` Dmitry V. Levin
  2019-02-27 15:30   ` Dmitry V. Levin
  2019-01-09 12:43 ` [PATCH 07/14] m68k: " Dmitry V. Levin
                   ` (8 subsequent siblings)
  14 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Richard Kuo,
	Oleg Nesterov, Andy Lutomirski, linux-hexagon, linux-audit,
	linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-hexagon@vger.kernel.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/hexagon/include/asm/syscall.h | 8 ++++++++
 include/uapi/linux/audit.h         | 1 +
 2 files changed, 9 insertions(+)

diff --git a/arch/hexagon/include/asm/syscall.h b/arch/hexagon/include/asm/syscall.h
index 4af9c7b6f13a..de3917aad3fd 100644
--- a/arch/hexagon/include/asm/syscall.h
+++ b/arch/hexagon/include/asm/syscall.h
@@ -21,6 +21,8 @@
 #ifndef _ASM_HEXAGON_SYSCALL_H
 #define _ASM_HEXAGON_SYSCALL_H
 
+#include <uapi/linux/audit.h>
+
 typedef long (*syscall_fn)(unsigned long, unsigned long,
 	unsigned long, unsigned long,
 	unsigned long, unsigned long);
@@ -43,4 +45,10 @@ static inline void syscall_get_arguments(struct task_struct *task,
 	BUG_ON(i + n > 6);
 	memcpy(args, &(&regs->r00)[i], n * sizeof(args[0]));
 }
+
+static inline int syscall_get_arch(void)
+{
+	return AUDIT_ARCH_HEXAGON;
+}
+
 #endif
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index c6a6e3a9ec9a..b1602dcc13bc 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -387,6 +387,7 @@ enum {
 #define AUDIT_ARCH_CSKY		(EM_CSKY|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_FRV		(EM_FRV)
 #define AUDIT_ARCH_H8300	(EM_H8_300)
+#define AUDIT_ARCH_HEXAGON	(EM_HEXAGON)
 #define AUDIT_ARCH_I386		(EM_386|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_IA64		(EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_M32R		(EM_M32R)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/14] m68k: define syscall_get_arch()
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (5 preceding siblings ...)
  2019-01-09 12:43 ` [PATCH 06/14] hexagon: define syscall_get_arch() Dmitry V. Levin
@ 2019-01-09 12:43 ` Dmitry V. Levin
  2019-01-09 12:43 ` [PATCH 08/14] Move EM_NDS32 to uapi/linux/elf-em.h Dmitry V. Levin
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Geert Uytterhoeven, Elvira Khabirova, Eugene Syromyatnikov,
	Oleg Nesterov, Andy Lutomirski, linux-m68k, linux-audit,
	linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/m68k/include/asm/syscall.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 arch/m68k/include/asm/syscall.h

diff --git a/arch/m68k/include/asm/syscall.h b/arch/m68k/include/asm/syscall.h
new file mode 100644
index 000000000000..d4d7deda8d50
--- /dev/null
+++ b/arch/m68k/include/asm/syscall.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_M68K_SYSCALL_H
+#define _ASM_M68K_SYSCALL_H
+
+#include <uapi/linux/audit.h>
+
+static inline int syscall_get_arch(void)
+{
+	return AUDIT_ARCH_M68K;
+}
+
+#endif	/* _ASM_M68K_SYSCALL_H */
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/14] Move EM_NDS32 to uapi/linux/elf-em.h
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (6 preceding siblings ...)
  2019-01-09 12:43 ` [PATCH 07/14] m68k: " Dmitry V. Levin
@ 2019-01-09 12:43 ` Dmitry V. Levin
  2019-02-27 15:30   ` Dmitry V. Levin
  2019-01-09 12:43 ` [PATCH 09/14] nds32: define syscall_get_arch() Dmitry V. Levin
                   ` (6 subsequent siblings)
  14 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Greentime Hu, Vincent Chen, Elvira Khabirova,
	Eugene Syromyatnikov, Oleg Nesterov, Andy Lutomirski,
	linux-audit, linux-kernel

This should never have been defined in the arch tree to begin with,
and now uapi/linux/audit.h header is going to use EM_NDS32
in order to define AUDIT_ARCH_NDS32 which is needed to implement
syscall_get_arch() which in turn is required to extend
the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/nds32/include/asm/elf.h | 3 +--
 include/uapi/linux/elf-em.h  | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/nds32/include/asm/elf.h b/arch/nds32/include/asm/elf.h
index 95f3ea253e4c..02250626b9f0 100644
--- a/arch/nds32/include/asm/elf.h
+++ b/arch/nds32/include/asm/elf.h
@@ -10,14 +10,13 @@
 
 #include <asm/ptrace.h>
 #include <asm/fpu.h>
+#include <linux/elf-em.h>
 
 typedef unsigned long elf_greg_t;
 typedef unsigned long elf_freg_t[3];
 
 extern unsigned int elf_hwcap;
 
-#define EM_NDS32			167
-
 #define R_NDS32_NONE			0
 #define R_NDS32_16_RELA			19
 #define R_NDS32_32_RELA			20
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index bd02325028d8..4b8df722330e 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -40,6 +40,8 @@
 #define EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
 #define EM_TI_C6000	140	/* TI C6X DSPs */
 #define EM_HEXAGON	164	/* QUALCOMM Hexagon */
+#define EM_NDS32	167	/* Andes Technology compact code size
+				   embedded RISC processor family */
 #define EM_AARCH64	183	/* ARM 64 bit */
 #define EM_TILEPRO	188	/* Tilera TILEPro */
 #define EM_MICROBLAZE	189	/* Xilinx MicroBlaze */
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/14] nds32: define syscall_get_arch()
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (7 preceding siblings ...)
  2019-01-09 12:43 ` [PATCH 08/14] Move EM_NDS32 to uapi/linux/elf-em.h Dmitry V. Levin
@ 2019-01-09 12:43 ` Dmitry V. Levin
  2019-02-27 15:30   ` Dmitry V. Levin
  2019-01-09 12:43 ` [PATCH 10/14] nios2: " Dmitry V. Levin
                   ` (5 subsequent siblings)
  14 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Greentime Hu,
	Vincent Chen, Oleg Nesterov, Andy Lutomirski, linux-audit,
	linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/nds32/include/asm/syscall.h | 9 +++++++++
 include/uapi/linux/audit.h       | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
index f7e5e86765fe..cc56a3962f8b 100644
--- a/arch/nds32/include/asm/syscall.h
+++ b/arch/nds32/include/asm/syscall.h
@@ -5,6 +5,7 @@
 #ifndef _ASM_NDS32_SYSCALL_H
 #define _ASM_NDS32_SYSCALL_H	1
 
+#include <uapi/linux/audit.h>
 #include <linux/err.h>
 struct task_struct;
 struct pt_regs;
@@ -185,4 +186,12 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
 
 	memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
 }
+
+static inline int
+syscall_get_arch(void)
+{
+	return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
+		? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
+}
+
 #endif /* _ASM_NDS32_SYSCALL_H */
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index b1602dcc13bc..1568ddc1c945 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -401,6 +401,8 @@ enum {
 #define AUDIT_ARCH_MIPSEL64	(EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_MIPSEL64N32	(EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
 				 __AUDIT_ARCH_CONVENTION_MIPS64_N32)
+#define AUDIT_ARCH_NDS32	(EM_NDS32|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_NDS32BE	(EM_NDS32)
 #define AUDIT_ARCH_OPENRISC	(EM_OPENRISC)
 #define AUDIT_ARCH_PARISC	(EM_PARISC)
 #define AUDIT_ARCH_PARISC64	(EM_PARISC|__AUDIT_ARCH_64BIT)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/14] nios2: define syscall_get_arch()
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (8 preceding siblings ...)
  2019-01-09 12:43 ` [PATCH 09/14] nds32: define syscall_get_arch() Dmitry V. Levin
@ 2019-01-09 12:43 ` Dmitry V. Levin
  2019-02-27 15:31   ` Dmitry V. Levin
  2019-01-09 12:43 ` [PATCH 11/14] riscv: " Dmitry V. Levin
                   ` (4 subsequent siblings)
  14 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Ley Foon Tan,
	Oleg Nesterov, Andy Lutomirski, nios2-dev, linux-audit,
	linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: nios2-dev@lists.rocketboards.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/nios2/include/asm/syscall.h | 6 ++++++
 include/uapi/linux/audit.h       | 1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/nios2/include/asm/syscall.h b/arch/nios2/include/asm/syscall.h
index 9de220854c4a..cf35e210fc4d 100644
--- a/arch/nios2/include/asm/syscall.h
+++ b/arch/nios2/include/asm/syscall.h
@@ -17,6 +17,7 @@
 #ifndef __ASM_NIOS2_SYSCALL_H__
 #define __ASM_NIOS2_SYSCALL_H__
 
+#include <uapi/linux/audit.h>
 #include <linux/err.h>
 #include <linux/sched.h>
 
@@ -135,4 +136,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	}
 }
 
+static inline int syscall_get_arch(void)
+{
+	return AUDIT_ARCH_NIOS2;
+}
+
 #endif
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 1568ddc1c945..efeb0bbd6c4d 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -403,6 +403,7 @@ enum {
 				 __AUDIT_ARCH_CONVENTION_MIPS64_N32)
 #define AUDIT_ARCH_NDS32	(EM_NDS32|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_NDS32BE	(EM_NDS32)
+#define AUDIT_ARCH_NIOS2	(EM_ALTERA_NIOS2|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_OPENRISC	(EM_OPENRISC)
 #define AUDIT_ARCH_PARISC	(EM_PARISC)
 #define AUDIT_ARCH_PARISC64	(EM_PARISC|__AUDIT_ARCH_64BIT)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 11/14] riscv: define syscall_get_arch()
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (9 preceding siblings ...)
  2019-01-09 12:43 ` [PATCH 10/14] nios2: " Dmitry V. Levin
@ 2019-01-09 12:43 ` Dmitry V. Levin
  2019-01-09 12:43 ` [PATCH 12/14] Move EM_UNICORE to uapi/linux/elf-em.h Dmitry V. Levin
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Palmer Dabbelt, Elvira Khabirova, Eugene Syromyatnikov,
	Oleg Nesterov, Andy Lutomirski, Albert Ou, linux-riscv,
	linux-audit, linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Based-on-patch-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: linux-riscv@lists.infradead.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/riscv/include/asm/syscall.h | 10 ++++++++++
 include/uapi/linux/audit.h       |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/arch/riscv/include/asm/syscall.h b/arch/riscv/include/asm/syscall.h
index 8d25f8904c00..bba3da6ef157 100644
--- a/arch/riscv/include/asm/syscall.h
+++ b/arch/riscv/include/asm/syscall.h
@@ -18,6 +18,7 @@
 #ifndef _ASM_RISCV_SYSCALL_H
 #define _ASM_RISCV_SYSCALL_H
 
+#include <uapi/linux/audit.h>
 #include <linux/sched.h>
 #include <linux/err.h>
 
@@ -99,4 +100,13 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	memcpy(&regs->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));
 }
 
+static inline int syscall_get_arch(void)
+{
+#ifdef CONFIG_64BIT
+	return AUDIT_ARCH_RISCV64;
+#else
+	return AUDIT_ARCH_RISCV32;
+#endif
+}
+
 #endif	/* _ASM_RISCV_SYSCALL_H */
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index efeb0bbd6c4d..bcc0619b046f 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -411,6 +411,8 @@ enum {
 /* do not define AUDIT_ARCH_PPCLE since it is not supported by audit */
 #define AUDIT_ARCH_PPC64	(EM_PPC64|__AUDIT_ARCH_64BIT)
 #define AUDIT_ARCH_PPC64LE	(EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_RISCV32	(EM_RISCV|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_RISCV64	(EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_S390		(EM_S390)
 #define AUDIT_ARCH_S390X	(EM_S390|__AUDIT_ARCH_64BIT)
 #define AUDIT_ARCH_SH		(EM_SH)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/14] Move EM_UNICORE to uapi/linux/elf-em.h
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (10 preceding siblings ...)
  2019-01-09 12:43 ` [PATCH 11/14] riscv: " Dmitry V. Levin
@ 2019-01-09 12:43 ` Dmitry V. Levin
  2019-02-27 15:31   ` Dmitry V. Levin
  2019-01-09 12:43 ` [PATCH 13/14] unicore32: define syscall_get_arch() Dmitry V. Levin
                   ` (2 subsequent siblings)
  14 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Guan Xuetao, Elvira Khabirova, Eugene Syromyatnikov,
	Oleg Nesterov, Andy Lutomirski, linux-audit, linux-kernel

This should never have been defined in the arch tree to begin with,
and now uapi/linux/audit.h header is going to use EM_UNICORE
in order to define AUDIT_ARCH_UNICORE which is needed to implement
syscall_get_arch() which in turn is required to extend
the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/unicore32/include/asm/elf.h | 3 +--
 include/uapi/linux/elf-em.h      | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/unicore32/include/asm/elf.h b/arch/unicore32/include/asm/elf.h
index 829042d07722..ae66dc1be49e 100644
--- a/arch/unicore32/include/asm/elf.h
+++ b/arch/unicore32/include/asm/elf.h
@@ -19,6 +19,7 @@
  * ELF register definitions..
  */
 #include <asm/ptrace.h>
+#include <linux/elf-em.h>
 
 typedef unsigned long elf_greg_t;
 typedef unsigned long elf_freg_t[3];
@@ -28,8 +29,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
 typedef struct fp_state elf_fpregset_t;
 
-#define EM_UNICORE		110
-
 #define R_UNICORE_NONE		0
 #define R_UNICORE_PC24		1
 #define R_UNICORE_ABS32		2
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index 4b8df722330e..f47e853546fa 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -37,6 +37,7 @@
 #define EM_ARCOMPACT	93	/* ARCompact processor */
 #define EM_XTENSA	94	/* Tensilica Xtensa Architecture */
 #define EM_BLACKFIN     106     /* ADI Blackfin Processor */
+#define EM_UNICORE	110	/* UniCore-32 */
 #define EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
 #define EM_TI_C6000	140	/* TI C6X DSPs */
 #define EM_HEXAGON	164	/* QUALCOMM Hexagon */
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/14] unicore32: define syscall_get_arch()
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (11 preceding siblings ...)
  2019-01-09 12:43 ` [PATCH 12/14] Move EM_UNICORE to uapi/linux/elf-em.h Dmitry V. Levin
@ 2019-01-09 12:43 ` Dmitry V. Levin
  2019-02-27 15:31   ` Dmitry V. Levin
  2019-01-09 12:43 ` [PATCH 14/14] syscall_get_arch: add "struct task_struct *" argument Dmitry V. Levin
  2019-01-17 20:34 ` [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Richard Guy Briggs
  14 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Guan Xuetao,
	Oleg Nesterov, Andy Lutomirski, linux-audit, linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 arch/unicore32/include/asm/syscall.h | 12 ++++++++++++
 include/uapi/linux/audit.h           |  1 +
 2 files changed, 13 insertions(+)
 create mode 100644 arch/unicore32/include/asm/syscall.h

diff --git a/arch/unicore32/include/asm/syscall.h b/arch/unicore32/include/asm/syscall.h
new file mode 100644
index 000000000000..3a6b885476b4
--- /dev/null
+++ b/arch/unicore32/include/asm/syscall.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_UNICORE_SYSCALL_H
+#define _ASM_UNICORE_SYSCALL_H
+
+#include <uapi/linux/audit.h>
+
+static inline int syscall_get_arch(void)
+{
+	return AUDIT_ARCH_UNICORE;
+}
+
+#endif	/* _ASM_UNICORE_SYSCALL_H */
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index bcc0619b046f..3901c51c0b93 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -424,6 +424,7 @@ enum {
 #define AUDIT_ARCH_TILEGX	(EM_TILEGX|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_TILEGX32	(EM_TILEGX|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_TILEPRO	(EM_TILEPRO|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_UNICORE	(EM_UNICORE|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_X86_64	(EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_XTENSA	(EM_XTENSA)
 
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 14/14] syscall_get_arch: add "struct task_struct *" argument
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (12 preceding siblings ...)
  2019-01-09 12:43 ` [PATCH 13/14] unicore32: define syscall_get_arch() Dmitry V. Levin
@ 2019-01-09 12:43 ` Dmitry V. Levin
  2019-01-17 20:34 ` [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Richard Guy Briggs
  14 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-01-09 12:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Andy Lutomirski, Palmer Dabbelt, Paul Burton, Michael Ellerman,
	Kees Cook, Mark Salter, Elvira Khabirova, Eugene Syromyatnikov,
	Oleg Nesterov, x86, linux-alpha, linux-snps-arc,
	linux-arm-kernel, linux-c6x-dev, uclinux-h8-devel, linux-hexagon,
	linux-ia64, linux-m68k, linux-mips, nios2-dev, openrisc,
	linux-parisc, linuxppc-dev, linux-riscv, linux-s390, linux-sh,
	sparclinux, linux-um, linux-xtensa, linux-arch, linux-audit,
	linux-kernel

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: 5e937a9ae913 ("syscall_get_arch: remove useless function arguments")
Reverts: 1002d94d3076 ("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>
---
 arch/alpha/include/asm/syscall.h      |  2 +-
 arch/arc/include/asm/syscall.h        |  2 +-
 arch/arm/include/asm/syscall.h        |  2 +-
 arch/arm64/include/asm/syscall.h      |  4 ++--
 arch/c6x/include/asm/syscall.h        |  2 +-
 arch/csky/include/asm/syscall.h       |  2 +-
 arch/h8300/include/asm/syscall.h      |  2 +-
 arch/hexagon/include/asm/syscall.h    |  2 +-
 arch/ia64/include/asm/syscall.h       |  2 +-
 arch/m68k/include/asm/syscall.h       |  2 +-
 arch/microblaze/include/asm/syscall.h |  2 +-
 arch/mips/include/asm/syscall.h       |  6 +++---
 arch/mips/kernel/ptrace.c             |  2 +-
 arch/nds32/include/asm/syscall.h      |  2 +-
 arch/nios2/include/asm/syscall.h      |  2 +-
 arch/openrisc/include/asm/syscall.h   |  2 +-
 arch/parisc/include/asm/syscall.h     |  4 ++--
 arch/powerpc/include/asm/syscall.h    | 10 ++++++++--
 arch/riscv/include/asm/syscall.h      |  2 +-
 arch/s390/include/asm/syscall.h       |  4 ++--
 arch/sh/include/asm/syscall_32.h      |  2 +-
 arch/sh/include/asm/syscall_64.h      |  2 +-
 arch/sparc/include/asm/syscall.h      |  5 +++--
 arch/unicore32/include/asm/syscall.h  |  2 +-
 arch/x86/include/asm/syscall.h        |  8 +++++---
 arch/x86/um/asm/syscall.h             |  2 +-
 arch/xtensa/include/asm/syscall.h     |  2 +-
 include/asm-generic/syscall.h         |  5 +++--
 kernel/auditsc.c                      |  4 ++--
 kernel/seccomp.c                      |  4 ++--
 30 files changed, 52 insertions(+), 42 deletions(-)

diff --git a/arch/alpha/include/asm/syscall.h b/arch/alpha/include/asm/syscall.h
index d73a6fcb519c..11c688c1d7ec 100644
--- a/arch/alpha/include/asm/syscall.h
+++ b/arch/alpha/include/asm/syscall.h
@@ -4,7 +4,7 @@
 
 #include <uapi/linux/audit.h>
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_ALPHA;
 }
diff --git a/arch/arc/include/asm/syscall.h b/arch/arc/include/asm/syscall.h
index c7fc4c0c3bcb..caf2697ef5b7 100644
--- a/arch/arc/include/asm/syscall.h
+++ b/arch/arc/include/asm/syscall.h
@@ -70,7 +70,7 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
 }
 
 static inline int
-syscall_get_arch(void)
+syscall_get_arch(struct task_struct *task)
 {
 	return IS_ENABLED(CONFIG_ISA_ARCOMPACT)
 		? (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
index 06dea6bce293..3940ceac0bdc 100644
--- a/arch/arm/include/asm/syscall.h
+++ b/arch/arm/include/asm/syscall.h
@@ -104,7 +104,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0]));
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	/* ARM tasks don't change audit architectures on the fly. */
 	return AUDIT_ARCH_ARM;
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index ad8be16a39c9..1870df03f774 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -117,9 +117,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
  * We don't care about endianness (__AUDIT_ARCH_LE bit) here because
  * AArch64 has the same system calls both on little- and big- endian.
  */
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
-	if (is_compat_task())
+	if (is_compat_thread(task_thread_info(task)))
 		return AUDIT_ARCH_ARM;
 
 	return AUDIT_ARCH_AARCH64;
diff --git a/arch/c6x/include/asm/syscall.h b/arch/c6x/include/asm/syscall.h
index 39dbd1ef994c..595057191c9c 100644
--- a/arch/c6x/include/asm/syscall.h
+++ b/arch/c6x/include/asm/syscall.h
@@ -121,7 +121,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	}
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
 		? AUDIT_ARCH_C6XBE : AUDIT_ARCH_C6X;
diff --git a/arch/csky/include/asm/syscall.h b/arch/csky/include/asm/syscall.h
index d637445737b7..150ffb894fa2 100644
--- a/arch/csky/include/asm/syscall.h
+++ b/arch/csky/include/asm/syscall.h
@@ -70,7 +70,7 @@ syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
 }
 
 static inline int
-syscall_get_arch(void)
+syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_CSKY;
 }
diff --git a/arch/h8300/include/asm/syscall.h b/arch/h8300/include/asm/syscall.h
index 5135910616e2..d316c3d40d4e 100644
--- a/arch/h8300/include/asm/syscall.h
+++ b/arch/h8300/include/asm/syscall.h
@@ -49,7 +49,7 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
 }
 
 static inline int
-syscall_get_arch(void)
+syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_H8300;
 }
diff --git a/arch/hexagon/include/asm/syscall.h b/arch/hexagon/include/asm/syscall.h
index de3917aad3fd..47b0bc3f16be 100644
--- a/arch/hexagon/include/asm/syscall.h
+++ b/arch/hexagon/include/asm/syscall.h
@@ -46,7 +46,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
 	memcpy(args, &(&regs->r00)[i], n * sizeof(args[0]));
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_HEXAGON;
 }
diff --git a/arch/ia64/include/asm/syscall.h b/arch/ia64/include/asm/syscall.h
index 1d0b875fec44..47ab33f5448a 100644
--- a/arch/ia64/include/asm/syscall.h
+++ b/arch/ia64/include/asm/syscall.h
@@ -81,7 +81,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_IA64;
 }
diff --git a/arch/m68k/include/asm/syscall.h b/arch/m68k/include/asm/syscall.h
index d4d7deda8d50..465ac039be09 100644
--- a/arch/m68k/include/asm/syscall.h
+++ b/arch/m68k/include/asm/syscall.h
@@ -4,7 +4,7 @@
 
 #include <uapi/linux/audit.h>
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_M68K;
 }
diff --git a/arch/microblaze/include/asm/syscall.h b/arch/microblaze/include/asm/syscall.h
index 220decd605a4..77a86fafa974 100644
--- a/arch/microblaze/include/asm/syscall.h
+++ b/arch/microblaze/include/asm/syscall.h
@@ -101,7 +101,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
 asmlinkage unsigned long do_syscall_trace_enter(struct pt_regs *regs);
 asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_MICROBLAZE;
 }
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index 6cf8ffb5367e..6a22c9352ef6 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -140,14 +140,14 @@ extern const unsigned long sys_call_table[];
 extern const unsigned long sys32_call_table[];
 extern const unsigned long sysn32_call_table[];
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	int arch = AUDIT_ARCH_MIPS;
 #ifdef CONFIG_64BIT
-	if (!test_thread_flag(TIF_32BIT_REGS)) {
+	if (!test_tsk_thread_flag(task, TIF_32BIT_REGS)) {
 		arch |= __AUDIT_ARCH_64BIT;
 		/* N32 sets only TIF_32BIT_ADDR */
-		if (test_thread_flag(TIF_32BIT_ADDR))
+		if (test_tsk_thread_flag(task, TIF_32BIT_ADDR))
 			arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
 	}
 #endif
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 0057c910bc2f..2ead6ff919b7 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -1418,7 +1418,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
 		unsigned long args[6];
 
 		sd.nr = syscall;
-		sd.arch = syscall_get_arch();
+		sd.arch = syscall_get_arch(current);
 		syscall_get_arguments(current, regs, 0, 6, args);
 		for (i = 0; i < 6; i++)
 			sd.args[i] = args[i];
diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
index cc56a3962f8b..7501e376a6b1 100644
--- a/arch/nds32/include/asm/syscall.h
+++ b/arch/nds32/include/asm/syscall.h
@@ -188,7 +188,7 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
 }
 
 static inline int
-syscall_get_arch(void)
+syscall_get_arch(struct task_struct *task)
 {
 	return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
 		? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
diff --git a/arch/nios2/include/asm/syscall.h b/arch/nios2/include/asm/syscall.h
index cf35e210fc4d..f0f6ae208e78 100644
--- a/arch/nios2/include/asm/syscall.h
+++ b/arch/nios2/include/asm/syscall.h
@@ -136,7 +136,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	}
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_NIOS2;
 }
diff --git a/arch/openrisc/include/asm/syscall.h b/arch/openrisc/include/asm/syscall.h
index 2db9f1cf0694..46b10c674bd2 100644
--- a/arch/openrisc/include/asm/syscall.h
+++ b/arch/openrisc/include/asm/syscall.h
@@ -72,7 +72,7 @@ syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
 	memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_OPENRISC;
 }
diff --git a/arch/parisc/include/asm/syscall.h b/arch/parisc/include/asm/syscall.h
index 8bff1a58c97f..c04ffc6ac928 100644
--- a/arch/parisc/include/asm/syscall.h
+++ b/arch/parisc/include/asm/syscall.h
@@ -62,11 +62,11 @@ static inline void syscall_rollback(struct task_struct *task,
 	/* do nothing */
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	int arch = AUDIT_ARCH_PARISC;
 #ifdef CONFIG_64BIT
-	if (!is_compat_task())
+	if (!__is_compat_task(task))
 		arch = AUDIT_ARCH_PARISC64;
 #endif
 	return arch;
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index 1a0e7a8b1c81..efb50429c9f4 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -99,9 +99,15 @@ static inline void syscall_set_arguments(struct task_struct *task,
 		regs->orig_gpr3 = args[0];
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
-	int arch = is_32bit_task() ? AUDIT_ARCH_PPC : AUDIT_ARCH_PPC64;
+	int arch;
+
+	if (IS_ENABLED(CONFIG_PPC64) && !test_tsk_thread_flag(task, TIF_32BIT))
+		arch = AUDIT_ARCH_PPC64;
+	else
+		arch = AUDIT_ARCH_PPC;
+
 #ifdef __LITTLE_ENDIAN__
 	arch |= __AUDIT_ARCH_LE;
 #endif
diff --git a/arch/riscv/include/asm/syscall.h b/arch/riscv/include/asm/syscall.h
index bba3da6ef157..ca120a36a037 100644
--- a/arch/riscv/include/asm/syscall.h
+++ b/arch/riscv/include/asm/syscall.h
@@ -100,7 +100,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	memcpy(&regs->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 #ifdef CONFIG_64BIT
 	return AUDIT_ARCH_RISCV64;
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index 96f9a9151fde..5a40ea8b90ea 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -92,10 +92,10 @@ static inline void syscall_set_arguments(struct task_struct *task,
 		regs->orig_gpr2 = args[0];
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 #ifdef CONFIG_COMPAT
-	if (test_tsk_thread_flag(current, TIF_31BIT))
+	if (test_tsk_thread_flag(task, TIF_31BIT))
 		return AUDIT_ARCH_S390;
 #endif
 	return AUDIT_ARCH_S390X;
diff --git a/arch/sh/include/asm/syscall_32.h b/arch/sh/include/asm/syscall_32.h
index 6e118799831c..08de429eccd4 100644
--- a/arch/sh/include/asm/syscall_32.h
+++ b/arch/sh/include/asm/syscall_32.h
@@ -95,7 +95,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	}
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	int arch = AUDIT_ARCH_SH;
 
diff --git a/arch/sh/include/asm/syscall_64.h b/arch/sh/include/asm/syscall_64.h
index 43882580c7f9..9b62a2404531 100644
--- a/arch/sh/include/asm/syscall_64.h
+++ b/arch/sh/include/asm/syscall_64.h
@@ -63,7 +63,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	memcpy(&regs->regs[2 + i], args, n * sizeof(args[0]));
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	int arch = AUDIT_ARCH_SH;
 
diff --git a/arch/sparc/include/asm/syscall.h b/arch/sparc/include/asm/syscall.h
index 053989e3f6a6..9ffb367c17fd 100644
--- a/arch/sparc/include/asm/syscall.h
+++ b/arch/sparc/include/asm/syscall.h
@@ -128,10 +128,11 @@ static inline void syscall_set_arguments(struct task_struct *task,
 		regs->u_regs[UREG_I0 + i + j] = args[j];
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 #if defined(CONFIG_SPARC64) && defined(CONFIG_COMPAT)
-	return in_compat_syscall() ? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64;
+	return test_tsk_thread_flag(task, TIF_32BIT)
+		? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64;
 #elif defined(CONFIG_SPARC64)
 	return AUDIT_ARCH_SPARC64;
 #else
diff --git a/arch/unicore32/include/asm/syscall.h b/arch/unicore32/include/asm/syscall.h
index 3a6b885476b4..607961797fff 100644
--- a/arch/unicore32/include/asm/syscall.h
+++ b/arch/unicore32/include/asm/syscall.h
@@ -4,7 +4,7 @@
 
 #include <uapi/linux/audit.h>
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_UNICORE;
 }
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index d653139857af..435f3f09279c 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -107,7 +107,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	memcpy(&regs->bx + i, args, n * sizeof(args[0]));
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_I386;
 }
@@ -236,10 +236,12 @@ static inline void syscall_set_arguments(struct task_struct *task,
 		}
 }
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	/* x32 tasks should be considered AUDIT_ARCH_X86_64. */
-	return in_ia32_syscall() ? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64;
+	return (IS_ENABLED(CONFIG_IA32_EMULATION) &&
+		task->thread_info.status & TS_COMPAT)
+		? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64;
 }
 #endif	/* CONFIG_X86_32 */
 
diff --git a/arch/x86/um/asm/syscall.h b/arch/x86/um/asm/syscall.h
index ef898af102d1..56a2f0913e3c 100644
--- a/arch/x86/um/asm/syscall.h
+++ b/arch/x86/um/asm/syscall.h
@@ -9,7 +9,7 @@ typedef asmlinkage long (*sys_call_ptr_t)(unsigned long, unsigned long,
 					  unsigned long, unsigned long,
 					  unsigned long, unsigned long);
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 #ifdef CONFIG_X86_32
 	return AUDIT_ARCH_I386;
diff --git a/arch/xtensa/include/asm/syscall.h b/arch/xtensa/include/asm/syscall.h
index a168bf81c7f4..0681ca656809 100644
--- a/arch/xtensa/include/asm/syscall.h
+++ b/arch/xtensa/include/asm/syscall.h
@@ -14,7 +14,7 @@
 #include <asm/ptrace.h>
 #include <uapi/linux/audit.h>
 
-static inline int syscall_get_arch(void)
+static inline int syscall_get_arch(struct task_struct *task)
 {
 	return AUDIT_ARCH_XTENSA;
 }
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index 0c938a4354f6..e0d060b43321 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -144,14 +144,15 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
 
 /**
  * syscall_get_arch - return the AUDIT_ARCH for the current system call
+ * @task:	task of interest, must be blocked
  *
  * Returns the AUDIT_ARCH_* based on the system call convention in use.
  *
- * It's only valid to call this when current is stopped on entry to a system
+ * It's only valid to call this when @task is stopped on entry to a system
  * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP.
  *
  * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
  * provide an implementation of this.
  */
-int syscall_get_arch(void);
+int syscall_get_arch(struct task_struct *task);
 #endif	/* _ASM_SYSCALL_H */
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 6593a5207fb0..919fe4ef4314 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1505,7 +1505,7 @@ void __audit_syscall_entry(int major, unsigned long a1, unsigned long a2,
 			return;
 	}
 
-	context->arch	    = syscall_get_arch();
+	context->arch	    = syscall_get_arch(current);
 	context->major      = major;
 	context->argv[0]    = a1;
 	context->argv[1]    = a2;
@@ -2480,7 +2480,7 @@ void audit_seccomp(unsigned long syscall, long signr, int code)
 		return;
 	audit_log_task(ab);
 	audit_log_format(ab, " sig=%ld arch=%x syscall=%ld compat=%d ip=0x%lx code=0x%x",
-			 signr, syscall_get_arch(), syscall,
+			 signr, syscall_get_arch(current), syscall,
 			 in_compat_syscall(), KSTK_EIP(current), code);
 	audit_log_end(ab);
 }
diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index d7f538847b84..803a69e6af37 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -148,7 +148,7 @@ static void populate_seccomp_data(struct seccomp_data *sd)
 	unsigned long args[6];
 
 	sd->nr = syscall_get_nr(task, regs);
-	sd->arch = syscall_get_arch();
+	sd->arch = syscall_get_arch(task);
 	syscall_get_arguments(task, regs, 0, 6, args);
 	sd->args[0] = args[0];
 	sd->args[1] = args[1];
@@ -589,7 +589,7 @@ static void seccomp_init_siginfo(kernel_siginfo_t *info, int syscall, int reason
 	info->si_code = SYS_SECCOMP;
 	info->si_call_addr = (void __user *)KSTK_EIP(current);
 	info->si_errno = reason;
-	info->si_arch = syscall_get_arch();
+	info->si_arch = syscall_get_arch(current);
 	info->si_syscall = syscall;
 }
 
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO
  2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
                   ` (13 preceding siblings ...)
  2019-01-09 12:43 ` [PATCH 14/14] syscall_get_arch: add "struct task_struct *" argument Dmitry V. Levin
@ 2019-01-17 20:34 ` Richard Guy Briggs
  2019-02-08 22:22   ` Dmitry V. Levin
  14 siblings, 1 reply; 32+ messages in thread
From: Richard Guy Briggs @ 2019-01-17 20:34 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: Paul Moore, Elvira Khabirova, linux-kernel, Eugene Syromyatnikov,
	linux-audit, Andy Lutomirski, Oleg Nesterov

On 2019-01-09 15:40, Dmitry V. Levin wrote:
> syscall_get_arch() is required to be implemented on all architectures in order
> 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.
> 
> This patchset began as a series called "Prepare for PTRACE_GET_SYSCALL_INFO",
> then I merged it into a series called "ptrace: add PTRACE_GET_SYSCALL_INFO request"
> that also contains ptrace-specific changes.
> 
> The ptrace-specific part, however, needs more attention to workaround problems
> on niche architectures like alpha, while the syscall_get_arch() part is
> straightforward, so I decided to split it out into a separate patchset that
> just prepares syscall_get_arch() for PTRACE_GET_SYSCALL_INFO: it adds
> syscall_get_arch() to those architectures that haven't implemented it yet,
> and then adds "struct task_struct *" argument to syscall_get_arch()
> on all architectures.

Glad to see syscall_get_arch() added to the remaining arches.  As Paul
said, it gets us closer to auditing syscalls on those remaining
unsupported arches and getting rid of the extra CONFIG_AUDITSYSCALL.
A little ironic that Eric (Paris) and I purged task_struct from
syscall_get_arch() 5 years ago since everything could use current.

> All patches from this patchset have been already reviewed, so it's ready
> to be merged without waiting for the ptrace-specific part.  As it's all
> about syscall_get_arch(), it should probably go via audit tree.

ACK.

Thanks Dmitry.

> Dmitry V. Levin (14):
>   Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h
>   arc: define syscall_get_arch()
>   c6x: define syscall_get_arch()
>   h8300: define syscall_get_arch()
>   Move EM_HEXAGON to uapi/linux/elf-em.h
>   hexagon: define syscall_get_arch()
>   m68k: define syscall_get_arch()
>   Move EM_NDS32 to uapi/linux/elf-em.h
>   nds32: define syscall_get_arch()
>   nios2: define syscall_get_arch()
>   riscv: define syscall_get_arch()
>   Move EM_UNICORE to uapi/linux/elf-em.h
>   unicore32: define syscall_get_arch()
>   syscall_get_arch: add "struct task_struct *" argument
> 
>  arch/alpha/include/asm/syscall.h      |  2 +-
>  arch/arc/include/asm/elf.h            |  6 +-----
>  arch/arc/include/asm/syscall.h        | 11 +++++++++++
>  arch/arm/include/asm/syscall.h        |  2 +-
>  arch/arm64/include/asm/syscall.h      |  4 ++--
>  arch/c6x/include/asm/syscall.h        |  7 +++++++
>  arch/csky/include/asm/syscall.h       |  2 +-
>  arch/h8300/include/asm/syscall.h      |  6 ++++++
>  arch/hexagon/include/asm/elf.h        |  6 +-----
>  arch/hexagon/include/asm/syscall.h    |  8 ++++++++
>  arch/ia64/include/asm/syscall.h       |  2 +-
>  arch/m68k/include/asm/syscall.h       | 12 ++++++++++++
>  arch/microblaze/include/asm/syscall.h |  2 +-
>  arch/mips/include/asm/syscall.h       |  6 +++---
>  arch/mips/kernel/ptrace.c             |  2 +-
>  arch/nds32/include/asm/elf.h          |  3 +--
>  arch/nds32/include/asm/syscall.h      |  9 +++++++++
>  arch/nios2/include/asm/syscall.h      |  6 ++++++
>  arch/openrisc/include/asm/syscall.h   |  2 +-
>  arch/parisc/include/asm/syscall.h     |  4 ++--
>  arch/powerpc/include/asm/syscall.h    | 10 ++++++++--
>  arch/riscv/include/asm/syscall.h      | 10 ++++++++++
>  arch/s390/include/asm/syscall.h       |  4 ++--
>  arch/sh/include/asm/syscall_32.h      |  2 +-
>  arch/sh/include/asm/syscall_64.h      |  2 +-
>  arch/sparc/include/asm/syscall.h      |  5 +++--
>  arch/unicore32/include/asm/elf.h      |  3 +--
>  arch/unicore32/include/asm/syscall.h  | 12 ++++++++++++
>  arch/x86/include/asm/syscall.h        |  8 +++++---
>  arch/x86/um/asm/syscall.h             |  2 +-
>  arch/xtensa/include/asm/syscall.h     |  2 +-
>  include/asm-generic/syscall.h         |  5 +++--
>  include/uapi/linux/audit.h            | 14 ++++++++++++++
>  include/uapi/linux/elf-em.h           |  6 ++++++
>  kernel/auditsc.c                      |  4 ++--
>  kernel/seccomp.c                      |  4 ++--
>  36 files changed, 148 insertions(+), 47 deletions(-)
>  create mode 100644 arch/m68k/include/asm/syscall.h
>  create mode 100644 arch/unicore32/include/asm/syscall.h
> 
> -- 
> ldv

- RGB

--
Richard Guy Briggs <rgb@redhat.com>
Sr. S/W Engineer, Kernel Security, Base Operating Systems
Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO
  2019-01-17 20:34 ` [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Richard Guy Briggs
@ 2019-02-08 22:22   ` Dmitry V. Levin
  2019-02-27 14:13     ` Dmitry V. Levin
  0 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-02-08 22:22 UTC (permalink / raw)
  To: Paul Moore, Richard Guy Briggs
  Cc: linux-kernel, linux-audit, Elvira Khabirova,
	Eugene Syromyatnikov, Andy Lutomirski, Oleg Nesterov

[-- Attachment #1: Type: text/plain, Size: 4952 bytes --]

On Thu, Jan 17, 2019 at 03:34:44PM -0500, Richard Guy Briggs wrote:
> On 2019-01-09 15:40, Dmitry V. Levin wrote:
> > syscall_get_arch() is required to be implemented on all architectures in order
> > 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.
> > 
> > This patchset began as a series called "Prepare for PTRACE_GET_SYSCALL_INFO",
> > then I merged it into a series called "ptrace: add PTRACE_GET_SYSCALL_INFO request"
> > that also contains ptrace-specific changes.
> > 
> > The ptrace-specific part, however, needs more attention to workaround problems
> > on niche architectures like alpha, while the syscall_get_arch() part is
> > straightforward, so I decided to split it out into a separate patchset that
> > just prepares syscall_get_arch() for PTRACE_GET_SYSCALL_INFO: it adds
> > syscall_get_arch() to those architectures that haven't implemented it yet,
> > and then adds "struct task_struct *" argument to syscall_get_arch()
> > on all architectures.
> 
> Glad to see syscall_get_arch() added to the remaining arches.  As Paul
> said, it gets us closer to auditing syscalls on those remaining
> unsupported arches and getting rid of the extra CONFIG_AUDITSYSCALL.
> A little ironic that Eric (Paris) and I purged task_struct from
> syscall_get_arch() 5 years ago since everything could use current.
> 
> > All patches from this patchset have been already reviewed, so it's ready
> > to be merged without waiting for the ptrace-specific part.  As it's all
> > about syscall_get_arch(), it should probably go via audit tree.
> 
> ACK.
> 
> Thanks Dmitry.

Thanks.
Please let me know if some action related to this patch series is expected from me.

> > Dmitry V. Levin (14):
> >   Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h
> >   arc: define syscall_get_arch()
> >   c6x: define syscall_get_arch()
> >   h8300: define syscall_get_arch()
> >   Move EM_HEXAGON to uapi/linux/elf-em.h
> >   hexagon: define syscall_get_arch()
> >   m68k: define syscall_get_arch()
> >   Move EM_NDS32 to uapi/linux/elf-em.h
> >   nds32: define syscall_get_arch()
> >   nios2: define syscall_get_arch()
> >   riscv: define syscall_get_arch()
> >   Move EM_UNICORE to uapi/linux/elf-em.h
> >   unicore32: define syscall_get_arch()
> >   syscall_get_arch: add "struct task_struct *" argument
> > 
> >  arch/alpha/include/asm/syscall.h      |  2 +-
> >  arch/arc/include/asm/elf.h            |  6 +-----
> >  arch/arc/include/asm/syscall.h        | 11 +++++++++++
> >  arch/arm/include/asm/syscall.h        |  2 +-
> >  arch/arm64/include/asm/syscall.h      |  4 ++--
> >  arch/c6x/include/asm/syscall.h        |  7 +++++++
> >  arch/csky/include/asm/syscall.h       |  2 +-
> >  arch/h8300/include/asm/syscall.h      |  6 ++++++
> >  arch/hexagon/include/asm/elf.h        |  6 +-----
> >  arch/hexagon/include/asm/syscall.h    |  8 ++++++++
> >  arch/ia64/include/asm/syscall.h       |  2 +-
> >  arch/m68k/include/asm/syscall.h       | 12 ++++++++++++
> >  arch/microblaze/include/asm/syscall.h |  2 +-
> >  arch/mips/include/asm/syscall.h       |  6 +++---
> >  arch/mips/kernel/ptrace.c             |  2 +-
> >  arch/nds32/include/asm/elf.h          |  3 +--
> >  arch/nds32/include/asm/syscall.h      |  9 +++++++++
> >  arch/nios2/include/asm/syscall.h      |  6 ++++++
> >  arch/openrisc/include/asm/syscall.h   |  2 +-
> >  arch/parisc/include/asm/syscall.h     |  4 ++--
> >  arch/powerpc/include/asm/syscall.h    | 10 ++++++++--
> >  arch/riscv/include/asm/syscall.h      | 10 ++++++++++
> >  arch/s390/include/asm/syscall.h       |  4 ++--
> >  arch/sh/include/asm/syscall_32.h      |  2 +-
> >  arch/sh/include/asm/syscall_64.h      |  2 +-
> >  arch/sparc/include/asm/syscall.h      |  5 +++--
> >  arch/unicore32/include/asm/elf.h      |  3 +--
> >  arch/unicore32/include/asm/syscall.h  | 12 ++++++++++++
> >  arch/x86/include/asm/syscall.h        |  8 +++++---
> >  arch/x86/um/asm/syscall.h             |  2 +-
> >  arch/xtensa/include/asm/syscall.h     |  2 +-
> >  include/asm-generic/syscall.h         |  5 +++--
> >  include/uapi/linux/audit.h            | 14 ++++++++++++++
> >  include/uapi/linux/elf-em.h           |  6 ++++++
> >  kernel/auditsc.c                      |  4 ++--
> >  kernel/seccomp.c                      |  4 ++--
> >  36 files changed, 148 insertions(+), 47 deletions(-)
> >  create mode 100644 arch/m68k/include/asm/syscall.h
> >  create mode 100644 arch/unicore32/include/asm/syscall.h

-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO
  2019-02-08 22:22   ` Dmitry V. Levin
@ 2019-02-27 14:13     ` Dmitry V. Levin
  2019-02-27 14:57       ` Paul Moore
  0 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-02-27 14:13 UTC (permalink / raw)
  To: Paul Moore, Richard Guy Briggs
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, linux-audit, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3155 bytes --]

On Sat, Feb 09, 2019 at 01:22:19AM +0300, Dmitry V. Levin wrote:
> On Thu, Jan 17, 2019 at 03:34:44PM -0500, Richard Guy Briggs wrote:
> > On 2019-01-09 15:40, Dmitry V. Levin wrote:
> > > syscall_get_arch() is required to be implemented on all architectures in order
> > > 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.
> > > 
> > > This patchset began as a series called "Prepare for PTRACE_GET_SYSCALL_INFO",
> > > then I merged it into a series called "ptrace: add PTRACE_GET_SYSCALL_INFO request"
> > > that also contains ptrace-specific changes.
> > > 
> > > The ptrace-specific part, however, needs more attention to workaround problems
> > > on niche architectures like alpha, while the syscall_get_arch() part is
> > > straightforward, so I decided to split it out into a separate patchset that
> > > just prepares syscall_get_arch() for PTRACE_GET_SYSCALL_INFO: it adds
> > > syscall_get_arch() to those architectures that haven't implemented it yet,
> > > and then adds "struct task_struct *" argument to syscall_get_arch()
> > > on all architectures.
> > 
> > Glad to see syscall_get_arch() added to the remaining arches.  As Paul
> > said, it gets us closer to auditing syscalls on those remaining
> > unsupported arches and getting rid of the extra CONFIG_AUDITSYSCALL.
> > A little ironic that Eric (Paris) and I purged task_struct from
> > syscall_get_arch() 5 years ago since everything could use current.
> > 
> > > All patches from this patchset have been already reviewed, so it's ready
> > > to be merged without waiting for the ptrace-specific part.  As it's all
> > > about syscall_get_arch(), it should probably go via audit tree.
> > 
> > ACK.
> > 
> > Thanks Dmitry.
> 
> Thanks.
> Please let me know if some action related to this patch series is expected from me.
> 
> > > Dmitry V. Levin (14):
> > >   Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h
> > >   arc: define syscall_get_arch()
> > >   c6x: define syscall_get_arch()
> > >   h8300: define syscall_get_arch()
> > >   Move EM_HEXAGON to uapi/linux/elf-em.h
> > >   hexagon: define syscall_get_arch()
> > >   m68k: define syscall_get_arch()
> > >   Move EM_NDS32 to uapi/linux/elf-em.h
> > >   nds32: define syscall_get_arch()
> > >   nios2: define syscall_get_arch()
> > >   riscv: define syscall_get_arch()
> > >   Move EM_UNICORE to uapi/linux/elf-em.h
> > >   unicore32: define syscall_get_arch()
> > >   syscall_get_arch: add "struct task_struct *" argument

This is just a gentle ping of the series which is still applicable
to v5.0-rc8 with one exception: "riscv: define syscall_get_arch()"
is no longer needed as riscv already has syscall_get_arch() now.


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO
  2019-02-27 14:13     ` Dmitry V. Levin
@ 2019-02-27 14:57       ` Paul Moore
  0 siblings, 0 replies; 32+ messages in thread
From: Paul Moore @ 2019-02-27 14:57 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: Richard Guy Briggs, Elvira Khabirova, Eugene Syromyatnikov,
	Oleg Nesterov, Andy Lutomirski, linux-audit, linux-kernel

On Wed, Feb 27, 2019 at 9:13 AM Dmitry V. Levin <ldv@altlinux.org> wrote:
> On Sat, Feb 09, 2019 at 01:22:19AM +0300, Dmitry V. Levin wrote:
> > On Thu, Jan 17, 2019 at 03:34:44PM -0500, Richard Guy Briggs wrote:
> > > On 2019-01-09 15:40, Dmitry V. Levin wrote:
> > > > syscall_get_arch() is required to be implemented on all architectures in order
> > > > 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.
> > > >
> > > > This patchset began as a series called "Prepare for PTRACE_GET_SYSCALL_INFO",
> > > > then I merged it into a series called "ptrace: add PTRACE_GET_SYSCALL_INFO request"
> > > > that also contains ptrace-specific changes.
> > > >
> > > > The ptrace-specific part, however, needs more attention to workaround problems
> > > > on niche architectures like alpha, while the syscall_get_arch() part is
> > > > straightforward, so I decided to split it out into a separate patchset that
> > > > just prepares syscall_get_arch() for PTRACE_GET_SYSCALL_INFO: it adds
> > > > syscall_get_arch() to those architectures that haven't implemented it yet,
> > > > and then adds "struct task_struct *" argument to syscall_get_arch()
> > > > on all architectures.
> > >
> > > Glad to see syscall_get_arch() added to the remaining arches.  As Paul
> > > said, it gets us closer to auditing syscalls on those remaining
> > > unsupported arches and getting rid of the extra CONFIG_AUDITSYSCALL.
> > > A little ironic that Eric (Paris) and I purged task_struct from
> > > syscall_get_arch() 5 years ago since everything could use current.
> > >
> > > > All patches from this patchset have been already reviewed, so it's ready
> > > > to be merged without waiting for the ptrace-specific part.  As it's all
> > > > about syscall_get_arch(), it should probably go via audit tree.
> > >
> > > ACK.
> > >
> > > Thanks Dmitry.
> >
> > Thanks.
> > Please let me know if some action related to this patch series is expected from me.
> >
> > > > Dmitry V. Levin (14):
> > > >   Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h
> > > >   arc: define syscall_get_arch()
> > > >   c6x: define syscall_get_arch()
> > > >   h8300: define syscall_get_arch()
> > > >   Move EM_HEXAGON to uapi/linux/elf-em.h
> > > >   hexagon: define syscall_get_arch()
> > > >   m68k: define syscall_get_arch()
> > > >   Move EM_NDS32 to uapi/linux/elf-em.h
> > > >   nds32: define syscall_get_arch()
> > > >   nios2: define syscall_get_arch()
> > > >   riscv: define syscall_get_arch()
> > > >   Move EM_UNICORE to uapi/linux/elf-em.h
> > > >   unicore32: define syscall_get_arch()
> > > >   syscall_get_arch: add "struct task_struct *" argument
>
> This is just a gentle ping of the series which is still applicable
> to v5.0-rc8 with one exception: "riscv: define syscall_get_arch()"
> is no longer needed as riscv already has syscall_get_arch() now.

Hi Dmitry,

I obviously think this patchset is a step in the right direction (I've
ACK'd it previously), and I have no problem merging this via the audit
tree, but I'm far from an expert on all the various arches listed, so
having the associated arch maintainer ACKs is important.  Based on the
mail I've seen, here is the current status of the maintainer ACKs:

* arc: good (vgupta@synopsys.com)
* c6x: good (msalter@redhat.com)
* h8300: missing
* hexagon: missing
* m68k: good (geert@linux-m68k.org)
* nds32: missing
* nios2: missing
* riscv: no longer needed
* unicore32: missing

... as you can see, we are missing a number of ACKs/reviews from some
of the smaller arches.  Granted, it has been over a month, and these
patches are relatively trivial, but if you could try one more time to
get the missing ACKs I would appreciate it.

If you still can't get a response from the various maintainers by the
time the upcoming merge window closes and -next opens for business,
I'll go ahead and merge the pile into audit/next and we'll cross our
fingers that nothing explodes.

It shouldn't.

I think :)

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 04/14] h8300: define syscall_get_arch()
  2019-01-09 12:42 ` [PATCH 04/14] h8300: " Dmitry V. Levin
@ 2019-02-27 15:29   ` Dmitry V. Levin
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-02-27 15:29 UTC (permalink / raw)
  To: Yoshinori Sato, uclinux-h8-devel
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, Paul Moore, linux-audit, linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: uclinux-h8-devel@lists.sourceforge.jp
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 This is just a gentle ping, the patch is unchanged.

 arch/h8300/include/asm/syscall.h | 6 ++++++
 include/uapi/linux/audit.h       | 1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/h8300/include/asm/syscall.h b/arch/h8300/include/asm/syscall.h
index 924990401237..5135910616e2 100644
--- a/arch/h8300/include/asm/syscall.h
+++ b/arch/h8300/include/asm/syscall.h
@@ -8,6 +8,7 @@
 #include <linux/linkage.h>
 #include <linux/types.h>
 #include <linux/ptrace.h>
+#include <uapi/linux/audit.h>
 
 static inline int
 syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
@@ -47,6 +48,11 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
 	}
 }
 
+static inline int
+syscall_get_arch(void)
+{
+	return AUDIT_ARCH_H8300;
+}
 
 
 /* Misc syscall related bits */
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index e3d0255b4fc2..c6a6e3a9ec9a 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -386,6 +386,7 @@ enum {
 #define AUDIT_ARCH_CRIS		(EM_CRIS|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_CSKY		(EM_CSKY|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_FRV		(EM_FRV)
+#define AUDIT_ARCH_H8300	(EM_H8_300)
 #define AUDIT_ARCH_I386		(EM_386|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_IA64		(EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_M32R		(EM_M32R)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/14] Move EM_HEXAGON to uapi/linux/elf-em.h
  2019-01-09 12:43 ` [PATCH 05/14] Move EM_HEXAGON to uapi/linux/elf-em.h Dmitry V. Levin
@ 2019-02-27 15:29   ` Dmitry V. Levin
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-02-27 15:29 UTC (permalink / raw)
  To: Richard Kuo, linux-hexagon
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, Paul Moore, linux-audit, linux-kernel

This should never have been defined in the arch tree to begin with,
and now uapi/linux/audit.h header is going to use EM_HEXAGON
in order to define AUDIT_ARCH_HEXAGON which is needed to implement
syscall_get_arch() which in turn is required to extend
the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: linux-hexagon@vger.kernel.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 This is just a gentle ping, the patch is unchanged.

 arch/hexagon/include/asm/elf.h | 6 +-----
 include/uapi/linux/elf-em.h    | 1 +
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/hexagon/include/asm/elf.h b/arch/hexagon/include/asm/elf.h
index 80311e7b8ca6..d10fbd54ae51 100644
--- a/arch/hexagon/include/asm/elf.h
+++ b/arch/hexagon/include/asm/elf.h
@@ -23,11 +23,7 @@
 
 #include <asm/ptrace.h>
 #include <asm/user.h>
-
-/*
- * This should really be in linux/elf-em.h.
- */
-#define EM_HEXAGON	164   /* QUALCOMM Hexagon */
+#include <linux/elf-em.h>
 
 struct elf32_hdr;
 
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index 081675ed89cb..bd02325028d8 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -39,6 +39,7 @@
 #define EM_BLACKFIN     106     /* ADI Blackfin Processor */
 #define EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
 #define EM_TI_C6000	140	/* TI C6X DSPs */
+#define EM_HEXAGON	164	/* QUALCOMM Hexagon */
 #define EM_AARCH64	183	/* ARM 64 bit */
 #define EM_TILEPRO	188	/* Tilera TILEPro */
 #define EM_MICROBLAZE	189	/* Xilinx MicroBlaze */
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/14] hexagon: define syscall_get_arch()
  2019-01-09 12:43 ` [PATCH 06/14] hexagon: define syscall_get_arch() Dmitry V. Levin
@ 2019-02-27 15:30   ` Dmitry V. Levin
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-02-27 15:30 UTC (permalink / raw)
  To: Richard Kuo, linux-hexagon
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, Paul Moore, linux-audit, linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-hexagon@vger.kernel.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 This is just a gentle ping, the patch is unchanged.

 arch/hexagon/include/asm/syscall.h | 8 ++++++++
 include/uapi/linux/audit.h         | 1 +
 2 files changed, 9 insertions(+)

diff --git a/arch/hexagon/include/asm/syscall.h b/arch/hexagon/include/asm/syscall.h
index 4af9c7b6f13a..de3917aad3fd 100644
--- a/arch/hexagon/include/asm/syscall.h
+++ b/arch/hexagon/include/asm/syscall.h
@@ -21,6 +21,8 @@
 #ifndef _ASM_HEXAGON_SYSCALL_H
 #define _ASM_HEXAGON_SYSCALL_H
 
+#include <uapi/linux/audit.h>
+
 typedef long (*syscall_fn)(unsigned long, unsigned long,
 	unsigned long, unsigned long,
 	unsigned long, unsigned long);
@@ -43,4 +45,10 @@ static inline void syscall_get_arguments(struct task_struct *task,
 	BUG_ON(i + n > 6);
 	memcpy(args, &(&regs->r00)[i], n * sizeof(args[0]));
 }
+
+static inline int syscall_get_arch(void)
+{
+	return AUDIT_ARCH_HEXAGON;
+}
+
 #endif
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index c6a6e3a9ec9a..b1602dcc13bc 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -387,6 +387,7 @@ enum {
 #define AUDIT_ARCH_CSKY		(EM_CSKY|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_FRV		(EM_FRV)
 #define AUDIT_ARCH_H8300	(EM_H8_300)
+#define AUDIT_ARCH_HEXAGON	(EM_HEXAGON)
 #define AUDIT_ARCH_I386		(EM_386|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_IA64		(EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_M32R		(EM_M32R)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/14] Move EM_NDS32 to uapi/linux/elf-em.h
  2019-01-09 12:43 ` [PATCH 08/14] Move EM_NDS32 to uapi/linux/elf-em.h Dmitry V. Levin
@ 2019-02-27 15:30   ` Dmitry V. Levin
  2019-03-05  0:26     ` Vincent Chen
  0 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-02-27 15:30 UTC (permalink / raw)
  To: Greentime Hu, Vincent Chen
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, Paul Moore, linux-audit, linux-kernel

This should never have been defined in the arch tree to begin with,
and now uapi/linux/audit.h header is going to use EM_NDS32
in order to define AUDIT_ARCH_NDS32 which is needed to implement
syscall_get_arch() which in turn is required to extend
the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 This is just a gentle ping, the patch is unchanged.

 arch/nds32/include/asm/elf.h | 3 +--
 include/uapi/linux/elf-em.h  | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/nds32/include/asm/elf.h b/arch/nds32/include/asm/elf.h
index 95f3ea253e4c..02250626b9f0 100644
--- a/arch/nds32/include/asm/elf.h
+++ b/arch/nds32/include/asm/elf.h
@@ -10,14 +10,13 @@
 
 #include <asm/ptrace.h>
 #include <asm/fpu.h>
+#include <linux/elf-em.h>
 
 typedef unsigned long elf_greg_t;
 typedef unsigned long elf_freg_t[3];
 
 extern unsigned int elf_hwcap;
 
-#define EM_NDS32			167
-
 #define R_NDS32_NONE			0
 #define R_NDS32_16_RELA			19
 #define R_NDS32_32_RELA			20
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index bd02325028d8..4b8df722330e 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -40,6 +40,8 @@
 #define EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
 #define EM_TI_C6000	140	/* TI C6X DSPs */
 #define EM_HEXAGON	164	/* QUALCOMM Hexagon */
+#define EM_NDS32	167	/* Andes Technology compact code size
+				   embedded RISC processor family */
 #define EM_AARCH64	183	/* ARM 64 bit */
 #define EM_TILEPRO	188	/* Tilera TILEPro */
 #define EM_MICROBLAZE	189	/* Xilinx MicroBlaze */
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/14] nds32: define syscall_get_arch()
  2019-01-09 12:43 ` [PATCH 09/14] nds32: define syscall_get_arch() Dmitry V. Levin
@ 2019-02-27 15:30   ` Dmitry V. Levin
  2019-03-04 23:49     ` Vincent Chen
  0 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-02-27 15:30 UTC (permalink / raw)
  To: Greentime Hu, Vincent Chen
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, Paul Moore, linux-audit, linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 This is just a gentle ping, the patch is unchanged.

 arch/nds32/include/asm/syscall.h | 9 +++++++++
 include/uapi/linux/audit.h       | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
index f7e5e86765fe..cc56a3962f8b 100644
--- a/arch/nds32/include/asm/syscall.h
+++ b/arch/nds32/include/asm/syscall.h
@@ -5,6 +5,7 @@
 #ifndef _ASM_NDS32_SYSCALL_H
 #define _ASM_NDS32_SYSCALL_H	1
 
+#include <uapi/linux/audit.h>
 #include <linux/err.h>
 struct task_struct;
 struct pt_regs;
@@ -185,4 +186,12 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
 
 	memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
 }
+
+static inline int
+syscall_get_arch(void)
+{
+	return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
+		? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
+}
+
 #endif /* _ASM_NDS32_SYSCALL_H */
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index b1602dcc13bc..1568ddc1c945 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -401,6 +401,8 @@ enum {
 #define AUDIT_ARCH_MIPSEL64	(EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_MIPSEL64N32	(EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
 				 __AUDIT_ARCH_CONVENTION_MIPS64_N32)
+#define AUDIT_ARCH_NDS32	(EM_NDS32|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_NDS32BE	(EM_NDS32)
 #define AUDIT_ARCH_OPENRISC	(EM_OPENRISC)
 #define AUDIT_ARCH_PARISC	(EM_PARISC)
 #define AUDIT_ARCH_PARISC64	(EM_PARISC|__AUDIT_ARCH_64BIT)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/14] nios2: define syscall_get_arch()
  2019-01-09 12:43 ` [PATCH 10/14] nios2: " Dmitry V. Levin
@ 2019-02-27 15:31   ` Dmitry V. Levin
  2019-03-01  7:30     ` Ley Foon Tan
  0 siblings, 1 reply; 32+ messages in thread
From: Dmitry V. Levin @ 2019-02-27 15:31 UTC (permalink / raw)
  To: Ley Foon Tan, nios2-dev
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, Paul Moore, linux-audit, linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: nios2-dev@lists.rocketboards.org
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 This is just a gentle ping, the patch is unchanged.

 arch/nios2/include/asm/syscall.h | 6 ++++++
 include/uapi/linux/audit.h       | 1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/nios2/include/asm/syscall.h b/arch/nios2/include/asm/syscall.h
index 9de220854c4a..cf35e210fc4d 100644
--- a/arch/nios2/include/asm/syscall.h
+++ b/arch/nios2/include/asm/syscall.h
@@ -17,6 +17,7 @@
 #ifndef __ASM_NIOS2_SYSCALL_H__
 #define __ASM_NIOS2_SYSCALL_H__
 
+#include <uapi/linux/audit.h>
 #include <linux/err.h>
 #include <linux/sched.h>
 
@@ -135,4 +136,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
 	}
 }
 
+static inline int syscall_get_arch(void)
+{
+	return AUDIT_ARCH_NIOS2;
+}
+
 #endif
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 1568ddc1c945..efeb0bbd6c4d 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -403,6 +403,7 @@ enum {
 				 __AUDIT_ARCH_CONVENTION_MIPS64_N32)
 #define AUDIT_ARCH_NDS32	(EM_NDS32|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_NDS32BE	(EM_NDS32)
+#define AUDIT_ARCH_NIOS2	(EM_ALTERA_NIOS2|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_OPENRISC	(EM_OPENRISC)
 #define AUDIT_ARCH_PARISC	(EM_PARISC)
 #define AUDIT_ARCH_PARISC64	(EM_PARISC|__AUDIT_ARCH_64BIT)
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/14] Move EM_UNICORE to uapi/linux/elf-em.h
  2019-01-09 12:43 ` [PATCH 12/14] Move EM_UNICORE to uapi/linux/elf-em.h Dmitry V. Levin
@ 2019-02-27 15:31   ` Dmitry V. Levin
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-02-27 15:31 UTC (permalink / raw)
  To: Guan Xuetao
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, Paul Moore, linux-audit, linux-kernel

This should never have been defined in the arch tree to begin with,
and now uapi/linux/audit.h header is going to use EM_UNICORE
in order to define AUDIT_ARCH_UNICORE which is needed to implement
syscall_get_arch() which in turn is required to extend
the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 This is just a gentle ping, the patch is unchanged.

 arch/unicore32/include/asm/elf.h | 3 +--
 include/uapi/linux/elf-em.h      | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/unicore32/include/asm/elf.h b/arch/unicore32/include/asm/elf.h
index 829042d07722..ae66dc1be49e 100644
--- a/arch/unicore32/include/asm/elf.h
+++ b/arch/unicore32/include/asm/elf.h
@@ -19,6 +19,7 @@
  * ELF register definitions..
  */
 #include <asm/ptrace.h>
+#include <linux/elf-em.h>
 
 typedef unsigned long elf_greg_t;
 typedef unsigned long elf_freg_t[3];
@@ -28,8 +29,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
 typedef struct fp_state elf_fpregset_t;
 
-#define EM_UNICORE		110
-
 #define R_UNICORE_NONE		0
 #define R_UNICORE_PC24		1
 #define R_UNICORE_ABS32		2
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index 4b8df722330e..f47e853546fa 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -37,6 +37,7 @@
 #define EM_ARCOMPACT	93	/* ARCompact processor */
 #define EM_XTENSA	94	/* Tensilica Xtensa Architecture */
 #define EM_BLACKFIN     106     /* ADI Blackfin Processor */
+#define EM_UNICORE	110	/* UniCore-32 */
 #define EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
 #define EM_TI_C6000	140	/* TI C6X DSPs */
 #define EM_HEXAGON	164	/* QUALCOMM Hexagon */
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/14] unicore32: define syscall_get_arch()
  2019-01-09 12:43 ` [PATCH 13/14] unicore32: define syscall_get_arch() Dmitry V. Levin
@ 2019-02-27 15:31   ` Dmitry V. Levin
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2019-02-27 15:31 UTC (permalink / raw)
  To: Guan Xuetao
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, Paul Moore, linux-audit, linux-kernel

syscall_get_arch() is required to be implemented on all architectures
in addition to already implemented syscall_get_nr(),
syscall_get_arguments(), syscall_get_error(), and
syscall_get_return_value() functions in order to extend the generic
ptrace API with PTRACE_GET_SYSCALL_INFO request.

Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: Eugene Syromyatnikov <esyr@redhat.com>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: linux-audit@redhat.com
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 This is just a gentle ping, the patch is unchanged.

 arch/unicore32/include/asm/syscall.h | 12 ++++++++++++
 include/uapi/linux/audit.h           |  1 +
 2 files changed, 13 insertions(+)
 create mode 100644 arch/unicore32/include/asm/syscall.h

diff --git a/arch/unicore32/include/asm/syscall.h b/arch/unicore32/include/asm/syscall.h
new file mode 100644
index 000000000000..3a6b885476b4
--- /dev/null
+++ b/arch/unicore32/include/asm/syscall.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_UNICORE_SYSCALL_H
+#define _ASM_UNICORE_SYSCALL_H
+
+#include <uapi/linux/audit.h>
+
+static inline int syscall_get_arch(void)
+{
+	return AUDIT_ARCH_UNICORE;
+}
+
+#endif	/* _ASM_UNICORE_SYSCALL_H */
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index bcc0619b046f..3901c51c0b93 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -424,6 +424,7 @@ enum {
 #define AUDIT_ARCH_TILEGX	(EM_TILEGX|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_TILEGX32	(EM_TILEGX|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_TILEPRO	(EM_TILEPRO|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_UNICORE	(EM_UNICORE|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_X86_64	(EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_XTENSA	(EM_XTENSA)
 
-- 
ldv

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 10/14] nios2: define syscall_get_arch()
  2019-02-27 15:31   ` Dmitry V. Levin
@ 2019-03-01  7:30     ` Ley Foon Tan
  0 siblings, 0 replies; 32+ messages in thread
From: Ley Foon Tan @ 2019-03-01  7:30 UTC (permalink / raw)
  To: Dmitry V. Levin, Ley Foon Tan, nios2-dev
  Cc: Elvira Khabirova, Eugene Syromyatnikov, Oleg Nesterov,
	Andy Lutomirski, Paul Moore, linux-audit, linux-kernel

On Wed, 2019-02-27 at 18:31 +0300, Dmitry V. Levin wrote:
> syscall_get_arch() is required to be implemented on all architectures
> in addition to already implemented syscall_get_nr(),
> syscall_get_arguments(), syscall_get_error(), and
> syscall_get_return_value() functions in order to extend the generic
> ptrace API with PTRACE_GET_SYSCALL_INFO request.
> 
> Acked-by: Paul Moore <paul@paul-moore.com>
> Cc: Elvira Khabirova <lineprinter@altlinux.org>
> Cc: Eugene Syromyatnikov <esyr@redhat.com>
> Cc: Ley Foon Tan <lftan@altera.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: nios2-dev@lists.rocketboards.org
> Cc: linux-audit@redhat.com
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>

Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>

Regards
Ley Foon

> ---
>  This is just a gentle ping, the patch is unchanged.
> 
>  arch/nios2/include/asm/syscall.h | 6 ++++++
>  include/uapi/linux/audit.h       | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/arch/nios2/include/asm/syscall.h
> b/arch/nios2/include/asm/syscall.h
> index 9de220854c4a..cf35e210fc4d 100644
> --- a/arch/nios2/include/asm/syscall.h
> +++ b/arch/nios2/include/asm/syscall.h
> @@ -17,6 +17,7 @@
>  #ifndef __ASM_NIOS2_SYSCALL_H__
>  #define __ASM_NIOS2_SYSCALL_H__
> 
> +#include <uapi/linux/audit.h>
>  #include <linux/err.h>
>  #include <linux/sched.h>
> 
> @@ -135,4 +136,9 @@ static inline void syscall_set_arguments(struct
> task_struct *task,
>         }
>  }
> 
> +static inline int syscall_get_arch(void)
> +{
> +       return AUDIT_ARCH_NIOS2;
> +}
> +
>  #endif
> diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
> index 1568ddc1c945..efeb0bbd6c4d 100644
> --- a/include/uapi/linux/audit.h
> +++ b/include/uapi/linux/audit.h
> @@ -403,6 +403,7 @@ enum {
>                                  __AUDIT_ARCH_CONVENTION_MIPS64_N32)
>  #define AUDIT_ARCH_NDS32       (EM_NDS32|__AUDIT_ARCH_LE)
>  #define AUDIT_ARCH_NDS32BE     (EM_NDS32)
> +#define AUDIT_ARCH_NIOS2       (EM_ALTERA_NIOS2|__AUDIT_ARCH_LE)
>  #define AUDIT_ARCH_OPENRISC    (EM_OPENRISC)
>  #define AUDIT_ARCH_PARISC      (EM_PARISC)
>  #define AUDIT_ARCH_PARISC64    (EM_PARISC|__AUDIT_ARCH_64BIT)
> --
> ldv
> 
> ________________________________
> 
> Confidentiality Notice.
> This message may contain information that is confidential or
> otherwise protected from disclosure. If you are not the intended
> recipient, you are hereby notified that any use, disclosure,
> dissemination, distribution, or copying of this message, or any
> attachments, is strictly prohibited. If you have received this
> message in error, please advise the sender by reply e-mail, and
> delete the message and any attachments. Thank you.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 09/14] nds32: define syscall_get_arch()
  2019-02-27 15:30   ` Dmitry V. Levin
@ 2019-03-04 23:49     ` Vincent Chen
  2019-03-06  6:26       ` Greentime Hu
  0 siblings, 1 reply; 32+ messages in thread
From: Vincent Chen @ 2019-03-04 23:49 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: Greentime Hu, Elvira Khabirova, Eugene Syromyatnikov,
	Oleg Nesterov, Andy Lutomirski, Paul Moore, linux-audit,
	Linux Kernel Mailing List

Dmitry V. Levin <ldv@altlinux.org> 於 2019年2月27日 週三 下午11:30寫道:

>
> syscall_get_arch() is required to be implemented on all architectures
> in addition to already implemented syscall_get_nr(),
> syscall_get_arguments(), syscall_get_error(), and
> syscall_get_return_value() functions in order to extend the generic
> ptrace API with PTRACE_GET_SYSCALL_INFO request.
>
> Acked-by: Paul Moore <paul@paul-moore.com>
> Cc: Elvira Khabirova <lineprinter@altlinux.org>
> Cc: Eugene Syromyatnikov <esyr@redhat.com>
> Cc: Greentime Hu <green.hu@gmail.com>
> Cc: Vincent Chen <deanbo422@gmail.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: linux-audit@redhat.com
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
>  This is just a gentle ping, the patch is unchanged.
>
>  arch/nds32/include/asm/syscall.h | 9 +++++++++
>  include/uapi/linux/audit.h       | 2 ++
>  2 files changed, 11 insertions(+)
>
> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index f7e5e86765fe..cc56a3962f8b 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -5,6 +5,7 @@
>  #ifndef _ASM_NDS32_SYSCALL_H
>  #define _ASM_NDS32_SYSCALL_H   1
>
> +#include <uapi/linux/audit.h>
>  #include <linux/err.h>
>  struct task_struct;
>  struct pt_regs;
> @@ -185,4 +186,12 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
>
>         memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
>  }
> +
> +static inline int
> +syscall_get_arch(void)
> +{
> +       return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
> +               ? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
> +}
> +
>  #endif /* _ASM_NDS32_SYSCALL_H */
> diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
> index b1602dcc13bc..1568ddc1c945 100644
> --- a/include/uapi/linux/audit.h
> +++ b/include/uapi/linux/audit.h
> @@ -401,6 +401,8 @@ enum {
>  #define AUDIT_ARCH_MIPSEL64    (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
>  #define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
>                                  __AUDIT_ARCH_CONVENTION_MIPS64_N32)
> +#define AUDIT_ARCH_NDS32       (EM_NDS32|__AUDIT_ARCH_LE)
> +#define AUDIT_ARCH_NDS32BE     (EM_NDS32)
>  #define AUDIT_ARCH_OPENRISC    (EM_OPENRISC)
>  #define AUDIT_ARCH_PARISC      (EM_PARISC)
>  #define AUDIT_ARCH_PARISC64    (EM_PARISC|__AUDIT_ARCH_64BIT)
> --
> ldv

Thanks for fixing this.

Acked-by Vincent Chen

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 08/14] Move EM_NDS32 to uapi/linux/elf-em.h
  2019-02-27 15:30   ` Dmitry V. Levin
@ 2019-03-05  0:26     ` Vincent Chen
  2019-03-06  6:27       ` Greentime Hu
  0 siblings, 1 reply; 32+ messages in thread
From: Vincent Chen @ 2019-03-05  0:26 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: Greentime Hu, Elvira Khabirova, Eugene Syromyatnikov,
	Oleg Nesterov, Andy Lutomirski, Paul Moore, linux-audit,
	Linux Kernel Mailing List

Dmitry V. Levin <ldv@altlinux.org> 於 2019年2月27日 週三 下午11:30寫道:


>
> This should never have been defined in the arch tree to begin with,
> and now uapi/linux/audit.h header is going to use EM_NDS32
> in order to define AUDIT_ARCH_NDS32 which is needed to implement
> syscall_get_arch() which in turn is required to extend
> the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.
>
> Acked-by: Paul Moore <paul@paul-moore.com>
> Cc: Greentime Hu <green.hu@gmail.com>
> Cc: Vincent Chen <deanbo422@gmail.com>
> Cc: Elvira Khabirova <lineprinter@altlinux.org>
> Cc: Eugene Syromyatnikov <esyr@redhat.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: linux-audit@redhat.com
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
>  This is just a gentle ping, the patch is unchanged.
>
>  arch/nds32/include/asm/elf.h | 3 +--
>  include/uapi/linux/elf-em.h  | 2 ++
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/nds32/include/asm/elf.h b/arch/nds32/include/asm/elf.h
> index 95f3ea253e4c..02250626b9f0 100644
> --- a/arch/nds32/include/asm/elf.h
> +++ b/arch/nds32/include/asm/elf.h
> @@ -10,14 +10,13 @@
>
>  #include <asm/ptrace.h>
>  #include <asm/fpu.h>
> +#include <linux/elf-em.h>
>
>  typedef unsigned long elf_greg_t;
>  typedef unsigned long elf_freg_t[3];
>
>  extern unsigned int elf_hwcap;
>
> -#define EM_NDS32                       167
> -
>  #define R_NDS32_NONE                   0
>  #define R_NDS32_16_RELA                        19
>  #define R_NDS32_32_RELA                        20
> diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
> index bd02325028d8..4b8df722330e 100644
> --- a/include/uapi/linux/elf-em.h
> +++ b/include/uapi/linux/elf-em.h
> @@ -40,6 +40,8 @@
>  #define EM_ALTERA_NIOS2        113     /* Altera Nios II soft-core processor */
>  #define EM_TI_C6000    140     /* TI C6X DSPs */
>  #define EM_HEXAGON     164     /* QUALCOMM Hexagon */
> +#define EM_NDS32       167     /* Andes Technology compact code size
> +                                  embedded RISC processor family */
>  #define EM_AARCH64     183     /* ARM 64 bit */
>  #define EM_TILEPRO     188     /* Tilera TILEPro */
>  #define EM_MICROBLAZE  189     /* Xilinx MicroBlaze */
> --
> ldv

Thanks for fixing this.

Acked-by Vincent Chen

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 09/14] nds32: define syscall_get_arch()
  2019-03-04 23:49     ` Vincent Chen
@ 2019-03-06  6:26       ` Greentime Hu
  0 siblings, 0 replies; 32+ messages in thread
From: Greentime Hu @ 2019-03-06  6:26 UTC (permalink / raw)
  To: Vincent Chen
  Cc: Dmitry V. Levin, Elvira Khabirova, Eugene Syromyatnikov,
	Oleg Nesterov, Andy Lutomirski, Paul Moore, linux-audit,
	Linux Kernel Mailing List

Vincent Chen <deanbo422@gmail.com> 於 2019年3月5日 週二 上午7:50寫道:
>
> Dmitry V. Levin <ldv@altlinux.org> 於 2019年2月27日 週三 下午11:30寫道:
>
> >
> > syscall_get_arch() is required to be implemented on all architectures
> > in addition to already implemented syscall_get_nr(),
> > syscall_get_arguments(), syscall_get_error(), and
> > syscall_get_return_value() functions in order to extend the generic
> > ptrace API with PTRACE_GET_SYSCALL_INFO request.
> >
> > Acked-by: Paul Moore <paul@paul-moore.com>
> > Cc: Elvira Khabirova <lineprinter@altlinux.org>
> > Cc: Eugene Syromyatnikov <esyr@redhat.com>
> > Cc: Greentime Hu <green.hu@gmail.com>
> > Cc: Vincent Chen <deanbo422@gmail.com>
> > Cc: Oleg Nesterov <oleg@redhat.com>
> > Cc: Andy Lutomirski <luto@kernel.org>
> > Cc: linux-audit@redhat.com
> > Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> > ---
> >  This is just a gentle ping, the patch is unchanged.
> >
> >  arch/nds32/include/asm/syscall.h | 9 +++++++++
> >  include/uapi/linux/audit.h       | 2 ++
> >  2 files changed, 11 insertions(+)
> >
> > diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> > index f7e5e86765fe..cc56a3962f8b 100644
> > --- a/arch/nds32/include/asm/syscall.h
> > +++ b/arch/nds32/include/asm/syscall.h
> > @@ -5,6 +5,7 @@
> >  #ifndef _ASM_NDS32_SYSCALL_H
> >  #define _ASM_NDS32_SYSCALL_H   1
> >
> > +#include <uapi/linux/audit.h>
> >  #include <linux/err.h>
> >  struct task_struct;
> >  struct pt_regs;
> > @@ -185,4 +186,12 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> >
> >         memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> >  }
> > +
> > +static inline int
> > +syscall_get_arch(void)
> > +{
> > +       return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
> > +               ? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
> > +}
> > +
> >  #endif /* _ASM_NDS32_SYSCALL_H */
> > diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
> > index b1602dcc13bc..1568ddc1c945 100644
> > --- a/include/uapi/linux/audit.h
> > +++ b/include/uapi/linux/audit.h
> > @@ -401,6 +401,8 @@ enum {
> >  #define AUDIT_ARCH_MIPSEL64    (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
> >  #define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
> >                                  __AUDIT_ARCH_CONVENTION_MIPS64_N32)
> > +#define AUDIT_ARCH_NDS32       (EM_NDS32|__AUDIT_ARCH_LE)
> > +#define AUDIT_ARCH_NDS32BE     (EM_NDS32)
> >  #define AUDIT_ARCH_OPENRISC    (EM_OPENRISC)
> >  #define AUDIT_ARCH_PARISC      (EM_PARISC)
> >  #define AUDIT_ARCH_PARISC64    (EM_PARISC|__AUDIT_ARCH_64BIT)
> > --
> > ldv
>
> Thanks for fixing this.
>
> Acked-by Vincent Chen

Thank you. I add his email address. :P

Acked-by: Vincent Chen <vincentc@andestech.com>
Acked-by: Greentime Hu <greentime@andestech.com>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 08/14] Move EM_NDS32 to uapi/linux/elf-em.h
  2019-03-05  0:26     ` Vincent Chen
@ 2019-03-06  6:27       ` Greentime Hu
  0 siblings, 0 replies; 32+ messages in thread
From: Greentime Hu @ 2019-03-06  6:27 UTC (permalink / raw)
  To: Vincent Chen
  Cc: Dmitry V. Levin, Elvira Khabirova, Eugene Syromyatnikov,
	Oleg Nesterov, Andy Lutomirski, Paul Moore, linux-audit,
	Linux Kernel Mailing List

Vincent Chen <deanbo422@gmail.com> 於 2019年3月5日 週二 上午8:26寫道:
>
> Dmitry V. Levin <ldv@altlinux.org> 於 2019年2月27日 週三 下午11:30寫道:
>
>
> >
> > This should never have been defined in the arch tree to begin with,
> > and now uapi/linux/audit.h header is going to use EM_NDS32
> > in order to define AUDIT_ARCH_NDS32 which is needed to implement
> > syscall_get_arch() which in turn is required to extend
> > the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.
> >
> > Acked-by: Paul Moore <paul@paul-moore.com>
> > Cc: Greentime Hu <green.hu@gmail.com>
> > Cc: Vincent Chen <deanbo422@gmail.com>
> > Cc: Elvira Khabirova <lineprinter@altlinux.org>
> > Cc: Eugene Syromyatnikov <esyr@redhat.com>
> > Cc: Oleg Nesterov <oleg@redhat.com>
> > Cc: Andy Lutomirski <luto@kernel.org>
> > Cc: linux-audit@redhat.com
> > Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> > ---
> >  This is just a gentle ping, the patch is unchanged.
> >
> >  arch/nds32/include/asm/elf.h | 3 +--
> >  include/uapi/linux/elf-em.h  | 2 ++
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/nds32/include/asm/elf.h b/arch/nds32/include/asm/elf.h
> > index 95f3ea253e4c..02250626b9f0 100644
> > --- a/arch/nds32/include/asm/elf.h
> > +++ b/arch/nds32/include/asm/elf.h
> > @@ -10,14 +10,13 @@
> >
> >  #include <asm/ptrace.h>
> >  #include <asm/fpu.h>
> > +#include <linux/elf-em.h>
> >
> >  typedef unsigned long elf_greg_t;
> >  typedef unsigned long elf_freg_t[3];
> >
> >  extern unsigned int elf_hwcap;
> >
> > -#define EM_NDS32                       167
> > -
> >  #define R_NDS32_NONE                   0
> >  #define R_NDS32_16_RELA                        19
> >  #define R_NDS32_32_RELA                        20
> > diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
> > index bd02325028d8..4b8df722330e 100644
> > --- a/include/uapi/linux/elf-em.h
> > +++ b/include/uapi/linux/elf-em.h
> > @@ -40,6 +40,8 @@
> >  #define EM_ALTERA_NIOS2        113     /* Altera Nios II soft-core processor */
> >  #define EM_TI_C6000    140     /* TI C6X DSPs */
> >  #define EM_HEXAGON     164     /* QUALCOMM Hexagon */
> > +#define EM_NDS32       167     /* Andes Technology compact code size
> > +                                  embedded RISC processor family */
> >  #define EM_AARCH64     183     /* ARM 64 bit */
> >  #define EM_TILEPRO     188     /* Tilera TILEPro */
> >  #define EM_MICROBLAZE  189     /* Xilinx MicroBlaze */
> > --
> > ldv
>
> Thanks for fixing this.
>
> Acked-by Vincent Chen

Thank you. I add his email address. :P

Acked-by: Vincent Chen <vincentc@andestech.com>
Acked-by: Greentime Hu <greentime@andestech.com>

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2019-03-06  6:28 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 12:40 [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
2019-01-09 12:42 ` [PATCH 01/14] Move EM_ARCOMPACT and EM_ARCV2 to uapi/linux/elf-em.h Dmitry V. Levin
2019-01-09 12:42 ` [PATCH 02/14] arc: define syscall_get_arch() Dmitry V. Levin
2019-01-09 12:42 ` [PATCH 03/14] c6x: " Dmitry V. Levin
2019-01-09 12:42 ` [PATCH 04/14] h8300: " Dmitry V. Levin
2019-02-27 15:29   ` Dmitry V. Levin
2019-01-09 12:43 ` [PATCH 05/14] Move EM_HEXAGON to uapi/linux/elf-em.h Dmitry V. Levin
2019-02-27 15:29   ` Dmitry V. Levin
2019-01-09 12:43 ` [PATCH 06/14] hexagon: define syscall_get_arch() Dmitry V. Levin
2019-02-27 15:30   ` Dmitry V. Levin
2019-01-09 12:43 ` [PATCH 07/14] m68k: " Dmitry V. Levin
2019-01-09 12:43 ` [PATCH 08/14] Move EM_NDS32 to uapi/linux/elf-em.h Dmitry V. Levin
2019-02-27 15:30   ` Dmitry V. Levin
2019-03-05  0:26     ` Vincent Chen
2019-03-06  6:27       ` Greentime Hu
2019-01-09 12:43 ` [PATCH 09/14] nds32: define syscall_get_arch() Dmitry V. Levin
2019-02-27 15:30   ` Dmitry V. Levin
2019-03-04 23:49     ` Vincent Chen
2019-03-06  6:26       ` Greentime Hu
2019-01-09 12:43 ` [PATCH 10/14] nios2: " Dmitry V. Levin
2019-02-27 15:31   ` Dmitry V. Levin
2019-03-01  7:30     ` Ley Foon Tan
2019-01-09 12:43 ` [PATCH 11/14] riscv: " Dmitry V. Levin
2019-01-09 12:43 ` [PATCH 12/14] Move EM_UNICORE to uapi/linux/elf-em.h Dmitry V. Levin
2019-02-27 15:31   ` Dmitry V. Levin
2019-01-09 12:43 ` [PATCH 13/14] unicore32: define syscall_get_arch() Dmitry V. Levin
2019-02-27 15:31   ` Dmitry V. Levin
2019-01-09 12:43 ` [PATCH 14/14] syscall_get_arch: add "struct task_struct *" argument Dmitry V. Levin
2019-01-17 20:34 ` [PATCH 00/14] Prepare syscall_get_arch for PTRACE_GET_SYSCALL_INFO Richard Guy Briggs
2019-02-08 22:22   ` Dmitry V. Levin
2019-02-27 14:13     ` Dmitry V. Levin
2019-02-27 14:57       ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).