Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1731744
| From | Jürg Billeter <j@bitron.ch> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC |
| Date | 2017-09-13 19:30 +0200 |
| Message-ID | <upjE6-1RR-31@gated-at.bofh.it> (permalink) |
| References | <unKyJ-3Do-1@gated-at.bofh.it> <uoWRd-43L-25@gated-at.bofh.it> <uoYzE-4ZA-9@gated-at.bofh.it> <upjuq-1Ow-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, 2017-09-13 at 19:11 +0200, Oleg Nesterov wrote: > On 09/12, Jürg Billeter wrote: > > > > On Tue, 2017-09-12 at 19:05 +0200, Oleg Nesterov wrote: > > > On 09/09, Jürg Billeter wrote: > > > > Unlike > > > > PR_SET_PDEATHSIG, this is inherited across fork to allow killing a whole > > > > subtree without race conditions. > > > > > > but I am still not sure this is right... at least I can't understand the > > > "without race conditions" above. > > > > > > IOW, the child can do prctl(PR_SET_PDEATHSIG_PROC, SIGKILL) right after fork(), > > > why this is not enough to kill a whole subtree without race conditions? > > > > What if the parent dies between fork() and prctl()? > > The child will be killed? Sorry, can't understand... If PR_SET_PDEATHSIG_PROC was not inherited across fork and the parent died between fork() and prctl(PR_SET_PDEATHSIG_PROC, SIGKILL) in the child, the child would not be killed. It would be reparented to init(1) or a subreaper, i.e., you end up with a runaway process. It would be possible to safe guard against this race condition in other ways but inheriting the setting avoids it nicely, and makes it easy to apply/enforce PDEATHSIG_PROC for all descendants. > > > Say, CLONE_PARENT. Should it succeed if ->pdeath_signal_proc != 0 ? > > > > Yes, I don't see an issue with that. The new process will be a sibling > > and inheriting pdeath_signal_proc seems sensible to me for this. > > I meant, the process created by clone(CLONE_PARENT) won't be killed by > pdeath_signal if the creator process exits, exactly because it won't be > its child. Not that I think this is wrong. Right, creator and parent won't be the same. Jürg
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC Oleg Nesterov <oleg@redhat.com> - 2017-09-12 19:10 +0200
Re: [PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC Jürg Billeter <j@bitron.ch> - 2017-09-12 21:00 +0200
Re: [PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC Oleg Nesterov <oleg@redhat.com> - 2017-09-13 19:20 +0200
Re: [PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC Jürg Billeter <j@bitron.ch> - 2017-09-13 19:30 +0200
Re: [PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC Oleg Nesterov <oleg@redhat.com> - 2017-09-13 19:50 +0200
csiph-web