Article View: comp.bugs.4bsd
Article #44/bin/sh loops if SIGSEGV ignored
From: Mark Bartelt
Date: Wed, 26 Jul 1989 13:38
Date: Wed, 26 Jul 1989 13:38
39 lines
1556 bytes
1556 bytes
Problem: A shell spawned as a subprocess of a process that ignores SIGSEGV
tends to get into a state in which it loops forever. For example, running
the program ...
/* x.c */
#include <signal.h>
main()
{
signal(SIGSEGV,SIG_IGN);
system("date");
}
... results in the following:
PID TT STAT TIME COMMAND
26027 01 I 0:00 x
26028 01 I 0:00 sh -c date
26029 01 R 6:54 sh -c date
---------------
Fix: In fault.c/getsig(), change
IF trapflg[i=n]&SIGMOD ORF ignsig(i)==0
to
IF trapflg[i=n]&SIGMOD ORF ignsig(i)==0 ORF i==MEMF
It would probably also be wise to make the shell disallow attempts to trap
SIGSEGV. In xec.c/execute(), eight lines down from "case SYSTRAP:", change
IF (i=stoi(*com))>=MAXTRAP ORF i<MINTRAP
to
IF (i=stoi(*com))>=MAXTRAP ORF i<MINTRAP ORF i==MEMF
---------------
Mark Bartelt UUCP: {utzoo,decvax}!sickkids!mark
Hospital for Sick Children, Toronto BITNET: mark@sickkids.utoronto
416/598-6442 INTERNET: mark@sickkids.toronto.edu
Technical Details
Message-ID:
<304@sickkids.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!dptcdc!sickkids!markShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!dptcdc!sickkids!mark From: mark@sickkids.UUCP (Mark Bartelt) Newsgroups: comp.bugs.4bsd Subject: /bin/sh loops if SIGSEGV ignored Message-ID: <304@sickkids.UUCP> Date: 26 Jul 89 13:38:59 GMT Reply-To: mark@sickkids.UUCP (Mark Bartelt) Organization: Hospital for Sick Children, Toronto Lines: 39