Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jun 2022 19:38:32 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d005a6f2c808 - stable/13 - linux: Provide dummy seccomp(2)
Message-ID:  <202206171938.25HJcWD7014826@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dchagin:

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

commit d005a6f2c8082fc4065a79f2890a564464186b5a
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2022-01-28 10:55:11 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:33:40 +0000

    linux: Provide dummy seccomp(2)
    
    Don't emit messages; 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
    
    (cherry picked from commit 99454d3e98ff205881aa7abef39234c9afc7600c)
---
 sys/compat/linux/linux_dummy.c |  2 --
 sys/compat/linux/linux_misc.c  | 16 ++++++++++++++++
 sys/compat/linux/linux_misc.h  |  3 +++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c
index 91a56616fc10..e254bf94c026 100644
--- a/sys/compat/linux/linux_dummy.c
+++ b/sys/compat/linux/linux_dummy.c
@@ -112,8 +112,6 @@ DUMMY(kcmp);
 DUMMY(finit_module);
 DUMMY(sched_setattr);
 DUMMY(sched_getattr);
-/* Linux 3.17: */
-DUMMY(seccomp);
 /* Linux 3.18: */
 DUMMY(bpf);
 /* Linux 3.19: */
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index aa18c222ac82..324708e9e3c7 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -2889,3 +2889,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206171938.25HJcWD7014826>