From owner-freebsd-bugs Wed May 9 23:40:14 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 6B3DC37B42C for ; Wed, 9 May 2001 23:40:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4A6e4f33509; Wed, 9 May 2001 23:40:04 -0700 (PDT) (envelope-from gnats) Received: from ai.ce.pusan.ac.kr (ai.ce.pusan.ac.kr [164.125.68.75]) by hub.freebsd.org (Postfix) with ESMTP id 5847D37B424 for ; Wed, 9 May 2001 23:38:38 -0700 (PDT) (envelope-from jhkang@ai.ce.pusan.ac.kr) Received: by ai.ce.pusan.ac.kr (Postfix, from userid 1001) id 9066D2C0A; Thu, 10 May 2001 15:38:20 +0900 (KST) Message-Id: <20010510063820.9066D2C0A@ai.ce.pusan.ac.kr> Date: Thu, 10 May 2001 15:38:20 +0900 (KST) From: jhkang@isofree.net Reply-To: jhkang@isofree.net To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.95 Subject: kern/27242: SIGHUP propgation failure to processes of switched user Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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