Re: [PATCH 1/5] seccomp: don't use semaphore and wait_queue together

From: Tycho Andersen
Date: Thu Jan 12 2023 - 10:10:56 EST


On Tue, Jan 10, 2023 at 01:30:06PM -0800, Andrei Vagin wrote:
> From: Andrei Vagin <avagin@xxxxxxxxx>
>
> The main reason is to use new wake_up helpers that will be added in the
> following patches. But here are a few other reasons:
>
> * if we use two different ways, we always need to call them both. This
> patch fixes seccomp_notify_recv where we forgot to call wake_up_poll
> in the error path.

[snip]

> @@ -1515,7 +1546,8 @@ static long seccomp_notify_recv(struct seccomp_filter *filter,
> if (should_sleep_killable(filter, knotif))
> complete(&knotif->ready);
> knotif->state = SECCOMP_NOTIFY_INIT;
> - up(&filter->notif->request);
> + atomic_add(1, &filter->notif->requests);
> + wake_up_poll(&filter->wqh, EPOLLIN | EPOLLRDNORM);
> }
> mutex_unlock(&filter->notify_lock);
> }

I wonder if this shouldn't be a separate patch that you can send now
independent of this series?

Tycho