[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190814205040.d7shwe6u3jz6qmcc@wittgenstein>
Date: Wed, 14 Aug 2019 22:50:41 +0200
From: Christian Brauner <christian.brauner@...ntu.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: linux-kernel@...r.kernel.org, libc-alpha@...rceware.org,
alistair23@...il.com, ebiederm@...ssion.com, arnd@...db.de,
dalias@...c.org, torvalds@...ux-foundation.org,
adhemerval.zanella@...aro.org, fweimer@...hat.com,
palmer@...ive.com, macro@....com, zongbox@...il.com,
akpm@...ux-foundation.org, viro@...iv.linux.org.uk, hpa@...or.com
Subject: Re: [PATCH v3 1/1] waitid: Add support for waiting for the current
process group
On Wed, Aug 14, 2019 at 06:09:17PM +0200, Oleg Nesterov wrote:
> On 08/14, Christian Brauner wrote:
> >
> > and a signal could come in between the system call that
> > retrieved the process gorup and the call to waitid that changes the
> ^^^^^
> > current process group.
>
> I noticed this typo only because I spent 2 minutes or more trying to
> understand this sentence ;) But yes, a signal handler or another thread
> can change pgrp in between.
>
> Reviewed-by: Oleg Nesterov <oleg@...hat.com>
Applied-to:
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=pidfd
on top of P_PIDFD changes (cf. [1]) with merge conflict resolved (cf. [2]).
(All changes on top of v5.3-rc1.)
Merged-into:
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=for-next
and should show up in linux-next tomorrow.
Thanks!
Christian
/* References */
[1]: https://lore.kernel.org/r/20190727222229.6516-2-christian@brauner.io
[2]: patch after resolved merge-conflict:
kernel/exit.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index 64bb6893a37d..d2d74a7b81d1 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1596,10 +1596,13 @@ static long kernel_waitid(int which, pid_t upid, struct waitid_info *infop,
break;
case P_PGID:
type = PIDTYPE_PGID;
- if (upid <= 0)
+ if (upid < 0)
return -EINVAL;
- pid = find_get_pid(upid);
+ if (upid)
+ pid = find_get_pid(upid);
+ else
+ pid = get_task_pid(current, PIDTYPE_PGID);
break;
case P_PIDFD:
type = PIDTYPE_PID;
Powered by blists - more mailing lists