public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] seccomp: Stub for !HAVE_ARCH_SECCOMP_FILTER
@ 2024-10-08  8:29 Linus Walleij
  2024-10-14 20:54 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2024-10-08  8:29 UTC (permalink / raw)
  To: Kees Cook, Andy Lutomirski, Will Drewry; +Cc: linux-kernel, Linus Walleij

If we have CONFIG_SECCOMP but not CONFIG_HAVE_ARCH_SECCOMP_FILTER
we get a compilation error:

../kernel/entry/common.c: In function 'syscall_trace_enter':
../kernel/entry/common.c:55:23: error: implicit declaration of function '__secure_computing' [-Werror=implicit-function-declaration]
   55 |                 ret = __secure_computing(NULL);
      |                       ^~~~~~~~~~~~~~~~~~

This is because generic entry calls __secure_computing()
unconditionally.

Provide the needed stub.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 include/linux/seccomp.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 709ad84809e1..832c612c5b54 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -31,6 +31,7 @@ static inline int secure_computing(void)
 	return 0;
 }
 #else
+static inline int __secure_computing(const struct seccomp_data *sd) { return 0; }
 extern void secure_computing_strict(int this_syscall);
 #endif
 

---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20241008-seccomp-compile-error-83f367447d56

Best regards,
-- 
Linus Walleij <linus.walleij@linaro.org>


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

* Re: [PATCH] seccomp: Stub for !HAVE_ARCH_SECCOMP_FILTER
  2024-10-08  8:29 [PATCH] seccomp: Stub for !HAVE_ARCH_SECCOMP_FILTER Linus Walleij
@ 2024-10-14 20:54 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2024-10-14 20:54 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Andy Lutomirski, Will Drewry, linux-kernel

On Tue, Oct 08, 2024 at 10:29:43AM +0200, Linus Walleij wrote:
> If we have CONFIG_SECCOMP but not CONFIG_HAVE_ARCH_SECCOMP_FILTER
> we get a compilation error:
> [...]
> +static inline int __secure_computing(const struct seccomp_data *sd) { return 0; }

I don't think this is the right solution (for gaining ARM generic
syscall support). For example see how this is done currently on ARM:

#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
        if (secure_computing() == -1)
                return -1;
#else
        /* XXX: remove this once OABI gets fixed */
        secure_computing_strict(syscall_get_nr(current, regs));
#endif

If we just return 0, all of seccomp will get ignored. I think the
generic code needs to do something like the above...

-- 
Kees Cook

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

end of thread, other threads:[~2024-10-14 20:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08  8:29 [PATCH] seccomp: Stub for !HAVE_ARCH_SECCOMP_FILTER Linus Walleij
2024-10-14 20:54 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox