From owner-freebsd-ports Wed Nov 17 5:20:14 1999 Delivered-To: freebsd-ports@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id D867B14FC3 for ; Wed, 17 Nov 1999 05:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id FAA16175; Wed, 17 Nov 1999 05:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from lark.websci.ru (twist.websci.ru [212.164.55.67]) by hub.freebsd.org (Postfix) with ESMTP id 512AF14C36 for ; Wed, 17 Nov 1999 05:14:31 -0800 (PST) (envelope-from fjoe@lark.websci.ru) Received: (from fjoe@localhost) by lark.websci.ru (8.9.3/8.9.3) id TAA17411; Wed, 17 Nov 1999 19:13:19 +0600 (NOVT) (envelope-from fjoe) Message-Id: <199911171313.TAA17411@lark.websci.ru> Date: Wed, 17 Nov 1999 19:13:19 +0600 (NOVT) From: fjoe@iclub.nsu.ru Reply-To: fjoe@iclub.nsu.ru To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: ports/14943: bash1 from ports incorrectly restores signals Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 14943 >Category: ports >Synopsis: bash1 from ports incorrectly restores signals >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Nov 17 05:20:00 PST 1999 >Closed-Date: >Last-Modified: >Originator: Max Khon (fjoe@iclub.nsu.ru) >Release: FreeBSD 3.3-STABLE i386 >Organization: WebSci Technologies Inc. >Environment: FreeBSD lark.websci.ru 3.3-STABLE FreeBSD 3.3-STABLE #12: Wed Nov 17 15:11:14 NOVT 1999 fjoe@lark.websci.ru:/usr/src/sys/compile/lark i386 bash 1.14.7 >Description: bash 1.14.7 (bash1 from ports collection) incorrectly restores signals when executing programs. This causes many programs (micq, slrn, mc, pdmenu etc. etc. etc.) to eat up to 100% CPU after telnet session was ungracefully closed because SIGHUP will not be delivered to processes started from bash1 used as login shell (SIGHUP is ignored when bash1 is running as login shell and telnet connection is made because ignored SIGHUP is inherited from inetd->telnetd->getty->login; ignored SIGHUP is restored before starting any program from shell). This may bring the shell-account system down to its knees within relatively small amount of time if users do not care to quit by typing `logout' (or Ctrl-D) and close their telnet programs instead. >How-To-Repeat: install bash1 from ports, set it as your login shell, build micq from ports, telnet to localhost, run micq, press Ctrl-], type `close', run top and you will see micq eating 100% CPU. >Fix: add the following three files to /usr/ports/shells/bash1/patches and rebuild your bash1 port. bash 2.03 does not suffer from this problem. patches were made after examining bash 2.03 code and are an attempt to implement bash 2.03 behavior. === cut here (patch-aj) === *** ./subst.c.orig Wed Nov 17 18:40:38 1999 --- ./subst.c Wed Nov 17 18:40:59 1999 *************** process_substitute (string, open_for_rea *** 2021,2026 **** --- 2021,2027 ---- pid = make_child ((char *)NULL, 1); if (pid == 0) { + reset_terminating_signals(); /* Cancel traps, in trap.c. */ restore_original_signals (); setup_async_signals (); === cut here === === cut here (patch-ak) === *** ./trap.c.orig Wed Nov 17 18:36:19 1999 --- ./trap.c Wed Nov 17 18:36:29 1999 *************** restore_original_signals () *** 556,563 **** { register int i; - reset_terminating_signals (); /* in shell.c */ - if (sigmodes[0] & SIG_TRAPPED) { free_trap_command (0); --- 556,561 ---- === cut here === === cut here (patch-al) === *** ./execute_cmd.c.orig Wed Nov 17 18:37:45 1999 --- ./execute_cmd.c Wed Nov 17 18:37:53 1999 *************** execute_command_internal (command, async *** 340,345 **** --- 340,347 ---- { int user_subshell, return_code, function_value; + reset_terminating_signals(); + /* Cancel traps, in trap.c. */ restore_original_signals (); if (asynchronous) === cut here === >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message