Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Nov 1999 19:13:19 +0600 (NOVT)
From:      fjoe@iclub.nsu.ru
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/14943: bash1 from ports incorrectly restores signals
Message-ID:  <199911171313.TAA17411@lark.websci.ru>

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

>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




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