[Bug 1205407] Re: su: kill child process group on signal, not just immediate child

Colin Watson cjwatson at canonical.com
Fri Jul 26 17:56:09 UTC 2013


shadow (1:4.1.5.1-1ubuntu6) saucy; urgency=low

  * debian/patches/496_su_kill_process_group: Kill the child process group,
    rather than just the immediate child; this is needed now that su no
    longer starts a controlling terminal when not running an interactive
    shell (closes: #713979).

 -- Colin Watson <cjwatson at ubuntu.com>  Fri, 26 Jul 2013 16:55:52 +0100

** Changed in: shadow (Ubuntu)
       Status: In Progress => Fix Released

** Changed in: shadow (Ubuntu Raring)
   Importance: Undecided => High

** Changed in: shadow (Ubuntu Raring)
     Assignee: (unassigned) => Colin Watson (cjwatson)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to shadow in Ubuntu.
https://bugs.launchpad.net/bugs/1205407

Title:
  su: kill child process group on signal, not just immediate child

Status in “shadow” package in Ubuntu:
  Fix Released
Status in “shadow” source package in Raring:
  Fix Committed
Status in “shadow” package in Debian:
  New

Bug description:
  [Impact] Operational pain on Ubuntu builders every time a build hangs.
  [Test Case] See below, starting with 'pgrep sleep'.
  [Regression Potential] It's su; we should be pretty careful.  Running saucy builds with this for a while will help, and seeing whether anyone objects to the broader process-killing.

  Original report follows:

  Imported from Debian bug http://bugs.debian.org/713979:

  Package: shadow
  Version: 1:4.1.5.1-1
  Severity: normal
  User: ubuntu-devel at lists.ubuntu.com
  Usertags: origin-ubuntu saucy

  For some time I've noticed that, when an Ubuntu build times out (150
  minutes with no output), sbuild tries to terminate it, and I see a
  "Session terminated, terminating shell... ...terminated." message in the
  log (which is from su), but the build does not actually terminate
  properly.  Now, in both Debian and Ubuntu, sbuild invokes builds using
  something like this simplified command:

    sudo chroot $chroot su $username -s sh -c "cd $dir && exec dpkg-
  buildpackage"

  When su receives a signal, it passes it on to its child process (it has
  to go to unusual lengths here because it starts new sessions).  However,
  it only kills its immediate child, not the associated process group.
  This means that you can do something like this:

    $ pgrep sleep
    $ su cjwatson -c 'sh -c "sleep 1h"'
    Password:
    [wait a few seconds]
    ^C
    Session terminated, terminating shell...Sessions still open, not unmounting
     ...killed.
    $ pgrep sleep
    32421

  This is inconvenient; in this case it means we often have to ask
  sysadmins to manually kill processes for us.  I don't have much
  visibility into Debian buildds but I suspect there are similar problems
  there from time to time.

  Could su please kill the process group associated with its immediate
  child process instead?  This should just be a matter of negating the pid
  passed to kill.  If it did that, then I think it would do a much better
  job of cleaning up after itself.

  Thanks,

  --
  Colin Watson                                       [cjwatson at ubuntu.com]

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/shadow/+bug/1205407/+subscriptions




More information about the foundations-bugs mailing list