From: Linus Walleij <linus.walleij@linaro.org>
To: Kees Cook <kees@kernel.org>,
Andy Lutomirski <luto@amacapital.net>,
Will Drewry <wad@chromium.org>
Cc: linux-kernel@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH v2] seccomp: Stub for !HAVE_ARCH_SECCOMP_FILTER
Date: Tue, 22 Oct 2024 15:41:34 +0200 [thread overview]
Message-ID: <20241022-seccomp-compile-error-v2-1-c9f08a4f8ebb@linaro.org> (raw)
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 similar to how current ARM does
this by calling secure_computing_strict() in the absence
of secure_computing(). This is similar to what is done for
ARM in arch/arm/kernel/ptrace.c.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Changes in v2:
- Call secure_computing_strict() instead of providing
a dumb stub for __secure_computing().
- Link to v1: https://lore.kernel.org/r/20241008-seccomp-compile-error-v1-1-f87de4007095@linaro.org
---
include/linux/seccomp.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 709ad84809e1..341980599c71 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -32,6 +32,11 @@ static inline int secure_computing(void)
}
#else
extern void secure_computing_strict(int this_syscall);
+static inline int __secure_computing(const struct seccomp_data *sd)
+{
+ secure_computing_strict(sd->nr);
+ return 0;
+}
#endif
extern long prctl_get_seccomp(void);
---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20241008-seccomp-compile-error-83f367447d56
Best regards,
--
Linus Walleij <linus.walleij@linaro.org>
next reply other threads:[~2024-10-22 13:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 13:41 Linus Walleij [this message]
2024-10-22 19:37 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241022-seccomp-compile-error-v2-1-c9f08a4f8ebb@linaro.org \
--to=linus.walleij@linaro.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=wad@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®