git: 56981629f91f - main - linux: Provide dummy seccomp(2)

From: Edward Tomasz Napierala <trasz_at_FreeBSD.org>
Date: Tue, 25 Jan 2022 12:25:37 UTC
The branch main has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=56981629f91fcdd358ccb41081ff6dcc2edac12f

commit 56981629f91fcdd358ccb41081ff6dcc2edac12f
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2022-01-25 11:53:56 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2022-01-25 11:54:00 +0000

    linux: Provide dummy seccomp(2)
    
    Don't emit warnings; this isn't any different from a Linux kernel
    built without OPTIONS_SECCOMP, so the userspace already needs to know
    how to deal with it.  This is also similar with how we handle seccomp
    in linux_prctl().
    
    Sponsored By:   EPSRC
    Differential Revision: https://reviews.freebsd.org/D33808
---
 sys/compat/linux/linux_misc.c | 16 ++++++++++++++++
 sys/compat/linux/linux_misc.h |  3 +++
 2 files changed, 19 insertions(+)

diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index a8857eda680d..3287c64ab515 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -2880,3 +2880,19 @@ linux_poll(struct thread *td, struct linux_poll_args *args)
 	    tsp, NULL, 0));
 }
 #endif /* __i386__ || __amd64__ */
+
+int
+linux_seccomp(struct thread *td, struct linux_seccomp_args *args)
+{
+
+	switch (args->op) {
+	case LINUX_SECCOMP_GET_ACTION_AVAIL:
+		return (EOPNOTSUPP);
+	default:
+		/*
+		 * Ignore unknown operations, just like Linux kernel built
+		 * without CONFIG_SECCOMP.
+		 */
+		return (EINVAL);
+	}
+}
diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h
index 3bfc9843cda2..9a7cf89466a2 100644
--- a/sys/compat/linux/linux_misc.h
+++ b/sys/compat/linux/linux_misc.h
@@ -153,6 +153,9 @@ extern int stclohz;
 /* Linux syslog flags */
 #define	LINUX_SYSLOG_ACTION_READ_ALL	3
 
+/* Linux seccomp flags */
+#define	LINUX_SECCOMP_GET_ACTION_AVAIL	2
+
 #if defined(__aarch64__) || (defined(__amd64__) && !defined(COMPAT_LINUX32))
 int linux_ptrace_status(struct thread *td, int pid, int status);
 #endif