Thread (35 messages) 35 messages, 6 authors, 2020-06-01

Re: [PATCH v2 2/3] seccomp: Introduce addfd ioctl to seccomp user notifier

From: Christian Brauner <hidden>
Date: 2020-05-30 13:58:44
Also in: lkml

On Sat, May 30, 2020 at 05:17:24AM +0200, Jann Horn wrote:
On Sat, May 30, 2020 at 4:43 AM Kees Cook [off-list ref] wrote:
quoted
I mean, yes, that's certainly better, but it just seems a shame that
everyone has to do the get_unused/put_unused dance just because of how
SCM_RIGHTS does this weird put_user() in the middle.

Can anyone clarify the expected failure mode from SCM_RIGHTS? Can we
move the put_user() after instead?
Honestly, I think trying to remove file descriptors and such after
-EFAULT is a waste of time. If userspace runs into -EFAULT, userspace
Agreed, we've never bothered with trying to recover from EFAULT. Just
look at kernel/fork.c:_do_fork():
	if (clone_flags & CLONE_PARENT_SETTID)
		put_user(nr, args->parent_tid);

we don't even bother even though we technically could.
is beyond saving and can't really do much other than exit immediately.
There are a bunch of places that will change state and then throw
-EFAULT at the end if userspace supplied an invalid address, because
trying to hold locks across userspace accesses just in case userspace
supplied a bogus address is kinda silly (and often borderline
impossible).

You can actually see that even scm_detach_fds() currently just
silently swallows errors if writing some header fields fails at the
end.
There's really no point in trying to save a broken scm message imho.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help