On Thu, Mar 07, 2019 at 09:02:07PM +0100, Eugene Syromyatnikov wrote: > On Thu, Mar 7, 2019 at 8:05 PM Eugene Syromyatnikov <evgsyr@xxxxxxxxx> wrote: > > > > The POSIX-mandated behaviour of sending SIGCONT/SIGHUP to stopped processes > > of an orphaned process group is not observed inside PID namespaces, as > > can be verified by running [1] inside a PID namespace, for example. > > > > The derivation is (presumably) introduced by Linux commit > s/derivation/deviation/ > > > v2.6.24-rc1~237 ("pid namespaces: define is_global_init() and > > is_container_init()"). > > > > [1] https://gitlab.com/strace/strace/commit/4278e6613f48273e7da0989712f1c18aaffefd84 > > > > Reported-by: Dmitry V. Levin <ldv@xxxxxxxxxxxx> > > Signed-off-by: Eugene Syromyatnikov <evgsyr@xxxxxxxxx> > > It should probably also be noted that the behaviour is also described > in TLPI, Section 34.8 ("Process groups, sessions, and job control: > Summary"), so it also likely has to be updated. Strictly speaking, whether orphaned process group semantics works in a PID namespace or not depends on the session ID. If the session ID is the same as the session ID of init (which happens quite often in case of a PID namespace), then orphaned process group semantics doesn't work. If they differ, then the POSIX-mandated behaviour is supported. For example: $ unshare -fprU sh -c './orphaned_process_group >/dev/null' && echo good || echo bad Orphaned process group semantics is not supported by the kernel bad $ unshare -fprU sh -c 'setsid ./orphaned_process_group >/dev/null' && echo good || echo bad good What can I say? The very least that could be done to fix this is to replace is_global_init() invocation with is_container_init() in will_become_orphaned_pgrp() as suggested in https://lkml.org/lkml/2007/12/8/208 -- ldv
Attachment:
signature.asc
Description: PGP signature