Skip to content

Commit 66c955b

Browse files
authored
Fix a fork bomb when vi is run from a script and sent Ctrl-Z (#73)
This bug was reported on the old mailing list: https://www.mail-archive.com/ast-developers@lists.research.att.com/msg00207.html A fork bomb can occur when SIGTSTP is sent to the vi editor. Vi must be launched from a script run with exec (tested with BusyBox vi, nvi and vim): $ cat /tmp/foo vi /tmp/bar echo end $ ksh $ chmod +x /tmp/foo $ exec /tmp/foo While in vi, send SIGTSTP using Ctrl-Z src/cmd/ksh93/sh/fault.c: - Only fork after Ctrl-Z if job control is available. The patch used checks 'job.jobcontrol' instead of 'SH_MONITOR': https://git.centos.org/rpms/ksh/blob/c8/f/SOURCES/ksh-20120801-forkbomb.patch
1 parent 84e2f6d commit 66c955b

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎NEWS‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ For full details, see the git log at: https://github.com/ksh93/ksh
33

44
Any uppercase BUG_* names are modernish shell bug IDs.
55

6+
2020-07-13:
7+
8+
- Fixed a fork bomb that could occur when the vi editor was sent SIGTSTP
9+
while running in a ksh script.
10+
611
2020-07-10:
712

813
- Fixed a bug that caused types created with 'typeset -T' to throw an error

‎src/cmd/ksh93/include/version.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
* David Korn <dgk@research.att.com> *
1818
* *
1919
***********************************************************************/
20-
#define SH_RELEASE "93u+m 2020-07-10"
20+
#define SH_RELEASE "93u+m 2020-07-13"

‎src/cmd/ksh93/sh/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ void sh_exit(register int xno)
519519
if(pp && pp->mode>1)
520520
cursig = -1;
521521
#ifdef SIGTSTP
522-
if(shp->trapnote&SH_SIGTSTP)
522+
if((shp->trapnote&SH_SIGTSTP) && job.jobcontrol)
523523
{
524524
/* ^Z detected by the shell */
525525
shp->trapnote = 0;

0 commit comments

Comments
 (0)