[Konsole-devel] [Bug 143880] Konsole does not kill su root 'top' process which zombifies

lars.doelle at on-line.de lars.doelle at on-line.de
Sat Apr 14 12:01:09 UTC 2007


All,

termination of a shell session is a somewhat complicate topic in Linux and Unix.

http://www.gnu.org/software/libc/manual/html_node/Job-Control.html#Job-Control

summarizes its basics.

What the konsole (and any other terminal, be it the linux console and the xterm
(clones)) do is more or less the same.

To summarize, closing the pty causes a SIGHUP being sent to the session leader
(e.g. shell) via the OS. This either does proper cleanups, or, if the session leader
is a stupid program, the OS tries to be helpful in cleaning up the orphaned process
groups by sending a SIGHUP. (It is more complicate, really.)

Thus, the described effect should either be reproducible under any terminal or clearly
indicates an error in the setup of the pty and or the session in the konsole.

And indeed, i was able to reproduce the behaviour with xterm.

My suspicion is that 'su' is to be blamed, really, but that's only wildly guessing.

I called your program 'termtest':

$ xterm
$ su
# ./termtest
(simply closing (X) the xterm)

'top' still shows termtest running.

Hope it helps

  Lars


On Thursday 05 April 2007 22:12, Jonathan E.Snow wrote:
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>          
> http://bugs.kde.org/show_bug.cgi?id=143880         
> 
> 
> 
> 
> ------- Additional Comments From jesnow uh edu  2007-04-05 22:12 -------
> To me it seems like 1) konsole is failing to kill the root process I started and 2) the 'top' process does something once it becomes parentless that uses all that cpu. 
> 
> 1) Could be because my konsole instance doesn't have the rights to kill a running root process. But then the bash shell would be left similarly ownerless, and that doesn't happen. 
> 
> 2) Requires some special activity in top to grab all that cpu. 
> 
> Loop.c (below) exhibits the same behavior when run as root. You start it as root, click the window away, then it remains there un-dead, looping away. Depending on how top calculates its wait period, maybe it grabs all that cpu because the display output has become so fast (because there's no display?), and so it executes its main loop more often. 
> 
> main () {
>         int i;
>         while (1) {
>                 i++;  // this is so the loop for sure doesn't get optimized away. 
>                 }
>         return i;
> }
> 
> Seems like this could be a security issue if a root process can outlive its parent. I've been annoyed by this behavior for years, I'm amazed nobody has complained about it until now.
> _______________________________________________
> konsole-devel mailing list
> konsole-devel at kde.org
> https://mail.kde.org/mailman/listinfo/konsole-devel
> 
> 



More information about the konsole-devel mailing list