[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bash fails to exit if parent ssh process is killed during command search
From: |
Siteshwar Vashisht |
Subject: |
Bash fails to exit if parent ssh process is killed during command search |
Date: |
Fri, 15 Jun 2018 09:36:31 -0400 (EDT) |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE -DRECYCLES_PIDS
-DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin' -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -Wno-parentheses -Wno-format-security
uname output: Linux localhost.localdomain 4.16.13-200.fc27.x86_64 #1 SMP Wed
May 30 15:03:53 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu
Bash Version: 4.4
Patch Level: 19
Release Status: release
Description:
Bash fails to exit and shows 100% cpu usage if parent sshd process is
killed while performing command search.
Repeat-By:
1. ssh to localhost with bash as default shell.
2. In the ssh session press 'ESC -p', this will show ':' on command line.
3. From a different terminal, check parent process id for bash running in ssh
session by executing 'ps fax'. For e.g. on my machine it is 9825:
9822 ? Ss 0:00 \_ sshd: situ [priv]
9825 ? S 0:00 \_ sshd: situ@pts/8
9834 pts/8 Ss+ 0:00 \_ -bash
4. Kill the parent process of bash by executing:
kill -hup 9825
5. Bash gets stuck in a loop and shows 100% cpu usage.
Fix:
See attached patch. Credits to Paulo Andrade <pandrade@redhat.com> for
finding and fixing the bug.
--
--
Siteshwar Vashisht
bash-4.4-hup-command-search.patch
Description: Text Data
- Bash fails to exit if parent ssh process is killed during command search,
Siteshwar Vashisht <=