Re: [PATCH 3/4] seccomp: Support atomic "addfd + send reply"
From: Tycho Andersen
Date: Tue May 11 2021 - 17:51:22 EST
Hi,
On Sat, May 01, 2021 at 05:18:50PM -0700, Sargun Dhillon wrote:
[snip]
> Other patches in this series add a way to block signals when a syscall
> is put to wait by seccomp.
I guess we can drop this bit from the message if the series is split.
> The struct seccomp_notif_resp, used when doing SECCOMP_IOCTL_NOTIF_SEND
> ioctl() to send a response to the target, has three more fields that we
> don't allow to set when doing the addfd ioctl() to also return. The
> reasons to disallow each field are:
> * val: This will be set to the new allocated fd. No point taking it
> from userspace in this case.
> * error: If this is non-zero, the value is ignored. Therefore,
> it is pointless in this case as we want to return the value.
> * flags: The only flag is to let userspace continue to execute the
> syscall. This seems pointless, as we want the syscall to return the
> allocated fd.
>
> This is why those fields are not possible to set when using this new
> flag.
I don't quite understand this; you don't need a NOTIF_SEND at all
with the way this currently works, right?
> @@ -1113,7 +1136,7 @@ static int seccomp_do_user_notification(int this_syscall,
> struct seccomp_kaddfd, list);
> /* Check if we were woken up by a addfd message */
> if (addfd)
> - seccomp_handle_addfd(addfd);
> + seccomp_handle_addfd(addfd, &n);
>
> } while (n.state != SECCOMP_NOTIFY_REPLIED);
>
This while() bit is introduced in the previous patch, can we fold this
deletion into that somehow?
Thanks,
Tycho