linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] seccomp: Add arm and arm64 bitmap support
@ 2020-10-28  0:19 Kees Cook
  2020-10-28  0:19 ` [PATCH 1/2] arm64: Enable seccomp architecture tracking Kees Cook
  2020-10-28  0:20 ` [PATCH 2/2] arm: " Kees Cook
  0 siblings, 2 replies; 5+ messages in thread
From: Kees Cook @ 2020-10-28  0:19 UTC (permalink / raw)
  To: YiFei Zhu
  Cc: Kees Cook, Russell King, Catalin Marinas, Will Deacon,
	Andy Lutomirski, Will Drewry, linux-arm-kernel, linux-kernel

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

-- 
2.25.1


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

* [PATCH 1/2] arm64: Enable seccomp architecture tracking
  2020-10-28  0:19 [PATCH 0/2] seccomp: Add arm and arm64 bitmap support Kees Cook
@ 2020-10-28  0:19 ` Kees Cook
  2020-11-10 17:26   ` Catalin Marinas
  2020-10-28  0:20 ` [PATCH 2/2] arm: " Kees Cook
  1 sibling, 1 reply; 5+ messages in thread
From: Kees Cook @ 2020-10-28  0:19 UTC (permalink / raw)
  To: YiFei Zhu
  Cc: Kees Cook, Russell King, Catalin Marinas, Will Deacon,
	Andy Lutomirski, Will Drewry, linux-arm-kernel, linux-kernel

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.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/arm64/include/asm/seccomp.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm64/include/asm/seccomp.h b/arch/arm64/include/asm/seccomp.h
index c36387170936..40f325e7a404 100644
--- a/arch/arm64/include/asm/seccomp.h
+++ b/arch/arm64/include/asm/seccomp.h
@@ -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 */
-- 
2.25.1


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

* [PATCH 2/2] arm: Enable seccomp architecture tracking
  2020-10-28  0:19 [PATCH 0/2] seccomp: Add arm and arm64 bitmap support Kees Cook
  2020-10-28  0:19 ` [PATCH 1/2] arm64: Enable seccomp architecture tracking Kees Cook
@ 2020-10-28  0:20 ` Kees Cook
  1 sibling, 0 replies; 5+ messages in thread
From: Kees Cook @ 2020-10-28  0:20 UTC (permalink / raw)
  To: YiFei Zhu
  Cc: Kees Cook, Russell King, Catalin Marinas, Will Deacon,
	Andy Lutomirski, Will Drewry, linux-arm-kernel, linux-kernel

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.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 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

diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 383635b68763..4a0848aef207 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -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
diff --git a/arch/arm/include/asm/seccomp.h b/arch/arm/include/asm/seccomp.h
new file mode 100644
index 000000000000..e9ad0f37d2ba
--- /dev/null
+++ b/arch/arm/include/asm/seccomp.h
@@ -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 */
-- 
2.25.1


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

* Re: [PATCH 1/2] arm64: Enable seccomp architecture tracking
  2020-10-28  0:19 ` [PATCH 1/2] arm64: Enable seccomp architecture tracking Kees Cook
@ 2020-11-10 17:26   ` Catalin Marinas
  2020-11-12  0:18     ` Kees Cook
  0 siblings, 1 reply; 5+ messages in thread
From: Catalin Marinas @ 2020-11-10 17:26 UTC (permalink / raw)
  To: Kees Cook
  Cc: YiFei Zhu, Russell King, Will Deacon, Andy Lutomirski,
	Will Drewry, linux-arm-kernel, linux-kernel

On Tue, Oct 27, 2020 at 05:19:59PM -0700, Kees Cook wrote:
> 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.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  arch/arm64/include/asm/seccomp.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/seccomp.h b/arch/arm64/include/asm/seccomp.h
> index c36387170936..40f325e7a404 100644
> --- a/arch/arm64/include/asm/seccomp.h
> +++ b/arch/arm64/include/asm/seccomp.h
> @@ -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)

> +# 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?

-- 
Catalin

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

* Re: [PATCH 1/2] arm64: Enable seccomp architecture tracking
  2020-11-10 17:26   ` Catalin Marinas
@ 2020-11-12  0:18     ` Kees Cook
  0 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2020-11-12  0:18 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: YiFei Zhu, Russell King, Will Deacon, Andy Lutomirski,
	Will Drewry, linux-arm-kernel, linux-kernel

On Tue, Nov 10, 2020 at 05:26:38PM +0000, Catalin Marinas wrote:
> On Tue, Oct 27, 2020 at 05:19:59PM -0700, Kees Cook wrote:
> > 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.
> > 
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> > ---
> >  arch/arm64/include/asm/seccomp.h | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/arch/arm64/include/asm/seccomp.h b/arch/arm64/include/asm/seccomp.h
> > index c36387170936..40f325e7a404 100644
> > --- a/arch/arm64/include/asm/seccomp.h
> > +++ b/arch/arm64/include/asm/seccomp.h
> > @@ -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)

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

> 
> > +# 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!

-- 
Kees Cook

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

end of thread, other threads:[~2020-11-12  1:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28  0:19 [PATCH 0/2] seccomp: Add arm and arm64 bitmap support Kees Cook
2020-10-28  0:19 ` [PATCH 1/2] arm64: Enable seccomp architecture tracking Kees Cook
2020-11-10 17:26   ` Catalin Marinas
2020-11-12  0:18     ` Kees Cook
2020-10-28  0:20 ` [PATCH 2/2] arm: " Kees Cook

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).