Skip to content

Commit

Permalink
linux: Provide dummy seccomp(2)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
trasz committed Jan 28, 2022
1 parent 612d42e commit 99454d3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 0 additions & 2 deletions sys/compat/linux/linux_dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: */
Expand Down
16 changes: 16 additions & 0 deletions sys/compat/linux/linux_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
3 changes: 3 additions & 0 deletions sys/compat/linux/linux_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 99454d3

Please sign in to comment.