* [PATCH] pidfd: Add warning if exit_state is 0 during notification
@ 2019-07-24 16:48 Joel Fernandes (Google)
2019-07-24 16:53 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Joel Fernandes (Google) @ 2019-07-24 16:48 UTC (permalink / raw)
To: linux-kernel
Cc: Joel Fernandes (Google),
Andrew Morton, Arnd Bergmann, Christian Brauner,
Eric W. Biederman, Oleg Nesterov
Previously a condition got missed where the pidfd waiters are awakened
before the exit_state gets set. This can result in a missed notification
[1] and the polling thread waiting forever.
It is fixed now, however it would be nice to avoid this kind of issue
going unnoticed in the future. So just add a warning to catch it in the
future.
[1] https://lore.kernel.org/lkml/20190717172100.261204-1-joel@joelfernandes.org/
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
kernel/signal.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/signal.c b/kernel/signal.c
index 91b789dd6e72..349f5a67f100 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1885,6 +1885,7 @@ static void do_notify_pidfd(struct task_struct *task)
{
struct pid *pid;
+ WARN_ON(task->exit_state == 0);
pid = task_pid(task);
wake_up_all(&pid->wait_pidfd);
}
--
2.22.0.657.g960e92d24f-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pidfd: Add warning if exit_state is 0 during notification
2019-07-24 16:48 [PATCH] pidfd: Add warning if exit_state is 0 during notification Joel Fernandes (Google)
@ 2019-07-24 16:53 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2019-07-24 16:53 UTC (permalink / raw)
To: Joel Fernandes (Google), linux-kernel
Cc: Andrew Morton, Arnd Bergmann, Eric W. Biederman, Oleg Nesterov
On July 24, 2019 6:48:16 PM GMT+02:00, "Joel Fernandes (Google)" <joel@joelfernandes.org> wrote:
>Previously a condition got missed where the pidfd waiters are awakened
>before the exit_state gets set. This can result in a missed
>notification
>[1] and the polling thread waiting forever.
>
>It is fixed now, however it would be nice to avoid this kind of issue
>going unnoticed in the future. So just add a warning to catch it in the
>future.
>
>[1]
>https://lore.kernel.org/lkml/20190717172100.261204-1-joel@joelfernandes.org/
>
>Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
>---
> kernel/signal.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/kernel/signal.c b/kernel/signal.c
>index 91b789dd6e72..349f5a67f100 100644
>--- a/kernel/signal.c
>+++ b/kernel/signal.c
>@@ -1885,6 +1885,7 @@ static void do_notify_pidfd(struct task_struct
>*task)
> {
> struct pid *pid;
>
>+ WARN_ON(task->exit_state == 0);
> pid = task_pid(task);
> wake_up_all(&pid->wait_pidfd);
> }
Makes sense to me.
I'm picking this up unless someone sees a problem with this patch.
Reviewed-by: Christian Brauner <christian@brauner.io>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-24 16:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 16:48 [PATCH] pidfd: Add warning if exit_state is 0 during notification Joel Fernandes (Google)
2019-07-24 16:53 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).