[buildd-tools-devel] Bug#566333: need to ignore SIGTTOU ?

Kees Cook kees at debian.org
Fri Jan 22 23:18:08 UTC 2010


Package: schroot
Version: 1.3.1-1
Severity: minor
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu lucid

Hi!

I seem to have run into a weird glitch when using the "command-prefix"
option of schroot.  Namely, schroot is backgrounded by my shell on exit
because it receives SIGTTOU when attempting to reset the termios on
CTTY_FILENO:

$ schroot -u root -c lucid
cloning (with CLONE_NEWPID) for child
parent waiting
running child
(lucid)root at system:/tmp# exit
parent done, exiting 0

[1]+  Stopped                 schroot -u root -c lucid
$ echo $?
150
$ fg
schroot -u root -c lucid
$ echo $?
0

This happens for me because I've been playing with the CLONE_NEW* flags,
and it seems that CLONE_NEWPID seems to trigger the tty layer into sending
SIGTTOU when it attempts to reset the termios.

I can, for some reason, trigger this without anything very heavy-weight by
calling "bash -i" from a simple wrapper, but that just illustrates the
problem -- I'm not sure why it's happening under schroot only with
CLONE_NEWPID.

Attached is
 - "minimal.c" shows the signal arriving in a simple environment.
 - "runalt.c" which I use with command-prefix like this:

# works:
#command-prefix=/scratch/src/newpid/altrun,fork
#command-prefix=/scratch/src/newpid/altrun,clone
command-prefix=/scratch/src/newpid/altrun,clone-newnet
# breaks:
#command-prefix=/scratch/src/newpid/altrun,clone-newpid

I'm at a loss.  "minimal.c" behaves the same on older kernels, so I'm
assuming this isn't a kernel bug.  Maybe bash is doing something weird
when it finds itself running as PID 1?

Thanks,

-Kees

-- 
Kees Cook                                            @debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal.c
Type: text/x-csrc
Size: 969 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20100122/c64c6309/attachment-0002.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: altrun.c
Type: text/x-csrc
Size: 1633 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20100122/c64c6309/attachment-0003.c>


More information about the Buildd-tools-devel mailing list