From: Rich Felker <dalias@libc.org>
To: Sargun Dhillon <sargun@sargun.me>
Cc: Kees Cook <keescook@chromium.org>,
Camille Mougey <commial@gmail.com>,
lkml <linux-kernel@vger.kernel.org>, Jann Horn <jannh@google.com>,
Tycho Andersen <tycho@tycho.pizza>,
Christian Brauner <christian.brauner@ubuntu.com>,
"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
Denis Efremov <efremov@linux.com>,
Andy Lutomirski <luto@kernel.org>
Subject: Re: [seccomp] Request for a "enable on execve" mode for Seccomp filters
Date: Thu, 29 Oct 2020 09:56:17 -0400 [thread overview]
Message-ID: <20201029135614.GM534@brightrain.aerifal.cx> (raw)
In-Reply-To: <20201029075841.GB29881@ircssh-2.c.rugged-nimbus-611.internal>
On Thu, Oct 29, 2020 at 07:58:42AM +0000, Sargun Dhillon wrote:
> A mechanism for the thing listening on the listener FD to turn itself on or off
> and indicate that it is no longer interested in receiving notifications and to
> always continue / return an error code, or that it has taken an interest now,
> and it would like to return to handling these events. The idea of an action
> other than ENOSYS (specifically SECCOMP_USER_NOTIF_FLAG_CONTINUE) if the
> listener goes away is attractive as well, in case the supervisor crashes. EPERM
> is somewhat "cleaner" of an error code than ENOSYS (most people don't write
> handling for ENOSYS on connect).
This is a common misconception that really needs to be addressed.
EPERM is not a suitable error code for as-yet-unknown seccomp-blocked
syscalls, and is not suitable for a large portion of currently known
ones either. It use has actively broken lots of things that would have
worked fine with ENOSYS returned. This is because a caller will react
to ENOSYS by attempting to do whatever it wanted to do in another way,
one which your policy might handlle better (for example, if your
filter is outdated and blocking clock_gettime64 but not clock_gettime,
or blocking statx but not stat64) while it will react to EPERM as an
indication that your filter understands the abstract operation it was
trying to perform and considers that action forbidden. We hit issues
like this with virtually every seccomp-using application while moving
to time64 because the wrong idiom is so widespread, and further vdso
prevented it from being caught right away (only users without vdso hit
it later).
From a standards perspective (and thus of programming to them), POSIX
does permit implementations to define additional errors for any
interface that already has errors defined, but does not permit
overloading the standard errors defined, so if EPERM is already
defined for an interface, returning it is probably not ok. (IMO it is
defensible if the seccomp policy can be thought of as an extension of
the permission model that would cause the standaed EPERM, but it's not
defensible if the policy is just "we don't know about this syscall
yet" since the syscall might just be a new/better way of implementing
some existing operation that makes the policy appear inconsistent.)
In your example of connect, I think either is semantically defensible;
one is "you lack suitable privilege to perform the operation" and the
other is "you're running on a type of system that doesn't have socket
connect functionality" (because it's a minimal execution environment).
Rich
prev parent reply other threads:[~2020-10-29 13:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-28 11:18 Camille Mougey
2020-10-28 12:42 ` Jann Horn
2020-10-28 16:49 ` Rich Felker
2020-10-28 17:34 ` Jann Horn
2020-10-28 17:52 ` Rich Felker
2020-10-28 18:25 ` Jann Horn
2020-10-28 18:35 ` Rich Felker
2020-10-28 18:39 ` Jann Horn
2020-10-28 18:50 ` Rich Felker
2020-10-28 22:03 ` Kees Cook
2020-10-28 22:00 ` Kees Cook
2020-10-28 22:47 ` Kees Cook
2020-10-28 23:59 ` Andy Lutomirski
2020-10-29 7:58 ` Sargun Dhillon
2020-10-29 13:56 ` Rich Felker [this message]
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=20201029135614.GM534@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=christian.brauner@ubuntu.com \
--cc=commial@gmail.com \
--cc=efremov@linux.com \
--cc=jannh@google.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=sargun@sargun.me \
--cc=tycho@tycho.pizza \
/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®