Re: [PATCH v2 2/4] seccomp: Refactor notification handler to prepare for new semantics

Sargun Dhillon
2021-05-25T20:45:16Z

On Tue, May 25, 2021 at 9:04 AM Rodrigo Campos <rodrigo@kinvolk.io> wrote:
>
> On Mon, May 17, 2021 at 9:39 PM Sargun Dhillon <sargun@sargun.me> wrote:
> >
> > This refactors the user notification code to have a do / while loop around
> > the completion condition. This has a small change in semantic, in that
> > previously we ignored addfd calls upon wakeup if the notification had been
> > responded to, but instead with the new change we check for an outstanding
> > addfd calls prior to returning to userspace.
>
> I understand why this was a readability improvement on the old
> patchset (that included the wait_killable semantics), as it completely
> changed the loop. But now we only have the atomic addfd+send reply
> that does minimal changes to this part (add a param to a function).
>
> Is it worth changing the semantics?
>
I think that as we add more complexity around different things that
can cause the notification to change (status), that this is better,
but I understand wanting to hold off.

> > Rodrigo Campos also identified a bug that can result in addfd causing
> > an early return, when the supervisor didn't actually handle the
> > syscall [1].
> >
> > [1]: https://lore.kernel.org/lkml/20210413160151.3301-1-rodrigo@kinvolk.io/
>
> I was about to resend this, but I'd like to know what others think.
>
> I'm okay with applying any patches to solve the issue (mine linked
> there or this one), slightly in favor of mine as the diff is way
> simpler to backport (applies to 5.9+ kernels) and I don't see a reason
> to change semantics. But no strong opinion.
>
> Opinions?
>
>
> Best,
> Rodrigo