Skip to contentSkip to conversation

seccomp: Add arm and arm64 bitmap support

PATCH In review Kees Cook 2 participants 5 messages Oct 28, 2020 – Nov 12, 2020

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

cover seccomp: Add arm and arm64 bitmap support

Hi,

I took a quick look at arm64 and arm for enabling bitmaps, and figured I'd send these patches to show it. I'll take this via the seccomp tree if no one sees a problem.

Thanks!

-Kees

Kees Cook (2):
arm64: Enable seccomp architecture tracking
arm: Enable seccomp architecture tracking

 arch/arm/include/asm/Kbuild      |  1 -
 arch/arm/include/asm/seccomp.h   | 11 +++++++++++
 arch/arm64/include/asm/seccomp.h | 15 +++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/seccomp.h
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#1 lore raw

PATCH 1/2 arm64: Enable seccomp architecture tracking

To enable seccomp constant action bitmaps, we need to have a static mapping to the audit architecture and system call table size. Add these for arm64.

---
 arch/arm64/include/asm/seccomp.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/include/asm/seccomp.h +15 -0
index c36387170936..40f325e7a404 100644
@@ -19,4 +19,19 @@
 
 #include <asm-generic/seccomp.h>
 
+#ifdef CONFIG_ARM64
+# define SECCOMP_ARCH_NATIVE		AUDIT_ARCH_AARCH64
+# define SECCOMP_ARCH_NATIVE_NR		NR_syscalls
+# define SECCOMP_ARCH_NATIVE_NAME	"arm64"
+# ifdef CONFIG_COMPAT
+#  define SECCOMP_ARCH_COMPAT		AUDIT_ARCH_ARM
+#  define SECCOMP_ARCH_COMPAT_NR	__NR_compat_syscalls
+#  define SECCOMP_ARCH_COMPAT_NAME	"arm"
+# endif
+#else /* !CONFIG_ARM64 */
+# define SECCOMP_ARCH_NATIVE		AUDIT_ARCH_ARM
+# define SECCOMP_ARCH_NATIVE_NR		NR_syscalls
+# define SECCOMP_ARCH_NATIVE_NAME	"arm"
+#endif
+
 #endif /* _ASM_SECCOMP_H */
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#2 lore raw

Re: [PATCH 1/2] arm64: Enable seccomp architecture tracking

Quoted 14 lines · Kees Cook

To enable seccomp constant action bitmaps, we need to have a static mapping to the audit architecture and system call table size. Add these for arm64.

---
 arch/arm64/include/asm/seccomp.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/include/asm/seccomp.h +0 -0
index c36387170936..40f325e7a404 100644

arch/arm64/include/asm/seccomp.h line 25

Quoted 7 lines
arch/arm64/include/asm/seccomp.h +4 -0
@@ -19,4 +19,19 @@
 
 #include <asm-generic/seccomp.h>
 
+#ifdef CONFIG_ARM64
+# define SECCOMP_ARCH_NATIVE		AUDIT_ARCH_AARCH64
+# define SECCOMP_ARCH_NATIVE_NR		NR_syscalls
+# define SECCOMP_ARCH_NATIVE_NAME	"arm64"

"aarch64"? (to match ELF_PLATFORM; not sure what this is used for as SECCOMP_ARCH_NATIVE_NAME is not defined in 5.10-rc3)

arch/arm64/include/asm/seccomp.h line 35

Quoted 10 lines
arch/arm64/include/asm/seccomp.h +10 -0
+# ifdef CONFIG_COMPAT
+#  define SECCOMP_ARCH_COMPAT		AUDIT_ARCH_ARM
+#  define SECCOMP_ARCH_COMPAT_NR	__NR_compat_syscalls
+#  define SECCOMP_ARCH_COMPAT_NAME	"arm"
+# endif
+#else /* !CONFIG_ARM64 */
+# define SECCOMP_ARCH_NATIVE		AUDIT_ARCH_ARM
+# define SECCOMP_ARCH_NATIVE_NR		NR_syscalls
+# define SECCOMP_ARCH_NATIVE_NAME	"arm"
+#endif

Why do we need a !CONFIG_ARM64 in an arm64 header file?

Signature · 1 line
Catalin
author
#3 lore raw

Re: [PATCH 1/2] arm64: Enable seccomp architecture tracking

Quoted 18 lines · Catalin Marinas
Quoted 17 lines · Kees Cook

To enable seccomp constant action bitmaps, we need to have a static mapping to the audit architecture and system call table size. Add these for arm64.

---
 arch/arm64/include/asm/seccomp.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/include/asm/seccomp.h +0 -0
index c36387170936..40f325e7a404 100644
@@ -19,4 +19,19 @@
 
 #include <asm-generic/seccomp.h>
 
Quoted 7 lines

arch/arm64/include/asm/seccomp.h line 25

Quoted 4 lines
arch/arm64/include/asm/seccomp.h +4 -0
+#ifdef CONFIG_ARM64
+# define SECCOMP_ARCH_NATIVE		AUDIT_ARCH_AARCH64
+# define SECCOMP_ARCH_NATIVE_NR		NR_syscalls
+# define SECCOMP_ARCH_NATIVE_NAME	"arm64"

"aarch64"? (to match ELF_PLATFORM; not sure what this is used for as SECCOMP_ARCH_NATIVE_NAME is not defined in 5.10-rc3)

Ah yes, I was thinking of the arch/arm64 name. :) I will fix this.

Quoted 13 lines

arch/arm64/include/asm/seccomp.h line 35

Quoted 11 lines
arch/arm64/include/asm/seccomp.h +10 -0
+# ifdef CONFIG_COMPAT
+#  define SECCOMP_ARCH_COMPAT		AUDIT_ARCH_ARM
+#  define SECCOMP_ARCH_COMPAT_NR	__NR_compat_syscalls
+#  define SECCOMP_ARCH_COMPAT_NAME	"arm"
+# endif
+#else /* !CONFIG_ARM64 */
+# define SECCOMP_ARCH_NATIVE		AUDIT_ARCH_ARM
+# define SECCOMP_ARCH_NATIVE_NR		NR_syscalls
+# define SECCOMP_ARCH_NATIVE_NAME	"arm"
+#endif

Why do we need a !CONFIG_ARM64 in an arm64 header file?

Heh, again, sorry -- I'm so used to the 32/64 being combined as I did the other architectures. I'll fix this too.

Thanks!

Signature · 6 lines
Kees Cook

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#4 lore raw

PATCH 2/2 arm: Enable seccomp architecture tracking

In reply to Kees Cook

To enable seccomp constant action bitmaps, we need to have a static mapping to the audit architecture and system call table size. Add these for arm.

---
 arch/arm/include/asm/Kbuild    |  1 -
 arch/arm/include/asm/seccomp.h | 11 +++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/seccomp.h
arch/arm/include/asm/Kbuild +0 -1
index 383635b68763..4a0848aef207 100644
@@ -4,7 +4,6 @@ generic-y += extable.h
 generic-y += flat.h
 generic-y += local64.h
 generic-y += parport.h
-generic-y += seccomp.h
 
 generated-y += mach-types.h
 generated-y += unistd-nr.h
arch/arm/include/asm/seccomp.h new file +11 -0
new file mode 100644
index 000000000000..e9ad0f37d2ba
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _ASM_SECCOMP_H
+#define _ASM_SECCOMP_H
+
+#include <asm-generic/seccomp.h>
+
+#define SECCOMP_ARCH_NATIVE		AUDIT_ARCH_ARM
+#define SECCOMP_ARCH_NATIVE_NR		NR_syscalls
+#define SECCOMP_ARCH_NATIVE_NAME	"arm"
+
+#endif /* _ASM_SECCOMP_H */
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel