Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 May 2001 15:38:20 +0900 (KST)
From:      jhkang@isofree.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/27242: SIGHUP propgation failure to processes of switched user
Message-ID:  <20010510063820.9066D2C0A@ai.ce.pusan.ac.kr>

next in thread | raw e-mail | index | archive | help

>Number:         27242
>Category:       kern
>Synopsis:       SIGHUP propagation failure to processes of switched user and the command may run infinitely
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 09 23:40:03 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jaeho Kang
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
isoFree System Technolgoies. Co., Inc.
>Environment:
System: FreeBSD delta.isofree.net 4.3-STABLE FreeBSD 4.3-STABLE #3: Wed May 2 22:15:41 KST 2001 jhkang@delta.isofree.net:/usr/obj/usr/src/sys/DELTAKERNEL i386

>Description:
        Top utilitiy and may other utiltities that control terminal directly
        and does not have explicit checking eof condition may not
        die and captures cpu resource continuely
        if an user switched another user, run the command and the controlling terminal
        disconnected unexpectedly.

>How-To-Repeat:
        login in a system.
        switch to another user with su command.
        run a command (top, lynx or w3m, ...) that control terminal directly
          and does not have explicit checking eof (or error?) of input stream.
        disconnect the terminal by force. (may be telnet client)
        monitor cpu time usage (e.g. with another top utility)

>Fix:
        APPLICATION LEVEL SOLUTION
        check EOF condition in command reading loop.
        patch top.c (/usr/src/usr.bin/top/top.c in FreeBSD 4.3) as following

        bash2.05# diff top.c.orig top.c
        671a672
        >                   int retval;
        679c680,688
        <                   (void) read(0, &ch, 1);
        ---
        >                   /* 2001/05/09 - jhkang */
        >                   /* SUMMARY: patch for an abnormal behavior (infinite
        loop) */
        >                   /* SITUATION: unexpected disconnection running on root
        account */
        >                   /* SOLUTION: add eof condition test */
        >                   /* (void) read(0, &ch, 1); */
        >                   retval = read(0, &ch, 1);
        >                   if (retval == 0) {
        >                       quit(0);
        >                   }

        the patch file is available at
        http://ai.ce.pusan.ac.kr/~jhkang/files/patch.top.infinite-loop.20010509.jhkang.patch

        KERNEL(?) LEVEL?
        I suspect something is blocking propating of SIGHUP signal to the processes.
        The charge may be *kernel*, su or termcap lib.

        This problem also occure FreeBSD 3.5-STABLE/i386, NetBSD 1.4.1/macppc.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010510063820.9066D2C0A>