ash endless loop after ssh client is killed

Alexander Kriegisch Alexander at Kriegisch.name
Sun Apr 29 03:53:29 UTC 2007


>>> As to ash's problem, my current guess it's xtcsetpgrp:
>>>
>>>                 /* turning job control off */
>>>                 fd = ttyfd;
>>>                 pgrp = initialpgrp;
>>>                 xtcsetpgrp(fd, pgrp);  <===========
>>>                 setpgid(0, pgrp);
>>>                 setsignal(SIGTSTP);
>>>                 setsignal(SIGTTOU);
>>>                 setsignal(SIGTTIN);
>>> (...)
>>> Try simply replacing xtcsetpgrp call with tcsetpgrp, does that work?

Amazingly enough, now I rebuilt busybox once more after a 'make clean',
I see an effect. This seems to fix the bug, after all. I am unsure why
it was not fixed last time I tried the very same patch. Maybe BB's build
script is not as change-sensitive as I expected, or maybe the resulting
BB was not included into my firmware for some reason. Anyway, feel free
to assume it was my fault.

Here is the requested strace log. Strace was attached to the 'sh'
process after the SSH session had been established. The output shows
what happens when the client is killed:

> $ strace -p 331
> Process 331 attached - interrupt to quit
> read(0, "", 1)                          = 0
> --- SIGHUP (Hangup) @ 0 (0) ---
> --- SIGCONT (Continued) @ 0 (0) ---
> ioctl(0, TIOCSCTTY, {B38400 opost isig icanon echo ...}) = -1 EIO (Input/output error)
> rt_sigaction(SIGWINCH, {0x10000000, [], 0}, {0x10000000, [], SA_SIGINFO|0x46ebd0}, 16) = 0
> ioctl(10, 0x80047476, 0x7f8b89dc)       = -1 ENOTTY (Inappropriate ioctl for device)
> setpgid(0, 331)                         = -1 EPERM (Operation not permitted)
> rt_sigaction(SIGTTOU, NULL, {SIG_DFL}, 16) = 0
> close(10)                               = 0
> exit(0)                                 = ?
> Process 331 detached

Should I regard the issue fixed and your suggested change an official
fix for BB's ash?

Regards
--
Alexander Kriegisch



More information about the busybox mailing list