Bug 1098145

Summary: [abrt] bash: find_job(): bash killed by SIGSEGV
Product: [Fedora] Fedora Reporter: Lukáš Doktor <ldoktor>
Component: bashAssignee: Ondrej Oprala <ooprala>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: admiller, ldoktor, ooprala, ovasik
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/d329d222fa22892c4d15ac658bdb92e04a07ea92
Whiteboard: abrt_hash:372661638cfc57ed4c7942ae2086892604b7bf80
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-10 12:11:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: cgroup
none
File: core_backtrace
none
File: dso_list
none
File: environ
none
File: exploitable
none
File: limits
none
File: maps
none
File: open_fds
none
File: proc_pid_status
none
File: var_log_messages none

Description Lukáš Doktor 2014-05-15 11:42:39 UTC
Description of problem:
In terminal1 (xterm):
bash
for NUM in `seq 1 64`; do trap "echo Received $NUM, ignoring... | grep error" $NUM; done
ps	# get the PID_OF_THE_BASH

In terminal2:
touch /var/tmp/docker_kill_stress
# Replace $PID_OF_THE_BASH with the bash pid
for AAA in `seq 1 31`; do [ $AAA -eq 9 ] && continue; [ $AAA -eq 17 ] && continue; [ $AAA -eq 20 ] && continue ; { while [ -e /var/tmp/docker_kill_stress ]; do kill -$AAA $PID_OF_THE_BASH > /dev/null || echo "Sender $AAA failed"; done } & done

Which results in SIGSEGV.

Version-Release number of selected component:
bash-4.2.47-2.fc20

Additional info:
reporter:       libreport-2.2.2
backtrace_rating: 4
cmdline:        bash
crash_function: find_job
executable:     /usr/bin/bash
kernel:         3.14.3-200.fc20.x86_64
runlevel:       N 5
type:           CCpp
uid:            1000

Truncated backtrace:
Thread no. 1 (10 frames)
 #0 find_job at jobs.c:1374
 #1 find_pipeline at jobs.c:1329
 #2 find_process at jobs.c:1346
 #3 waitchld at jobs.c:3133
 #4 wait_for at jobs.c:2450
 #5 execute_command_internal at execute_cmd.c:787
 #6 execute_pipeline at execute_cmd.c:2238
 #7 execute_connection at execute_cmd.c:2350
 #8 execute_command_internal at execute_cmd.c:903
 #9 parse_and_execute at evalstring.c:319

Comment 1 Lukáš Doktor 2014-05-15 11:42:44 UTC
Created attachment 895859 [details]
File: backtrace

Comment 2 Lukáš Doktor 2014-05-15 11:42:46 UTC
Created attachment 895860 [details]
File: cgroup

Comment 3 Lukáš Doktor 2014-05-15 11:42:48 UTC
Created attachment 895861 [details]
File: core_backtrace

Comment 4 Lukáš Doktor 2014-05-15 11:42:50 UTC
Created attachment 895862 [details]
File: dso_list

Comment 5 Lukáš Doktor 2014-05-15 11:42:52 UTC
Created attachment 895863 [details]
File: environ

Comment 6 Lukáš Doktor 2014-05-15 11:42:54 UTC
Created attachment 895864 [details]
File: exploitable

Comment 7 Lukáš Doktor 2014-05-15 11:42:56 UTC
Created attachment 895865 [details]
File: limits

Comment 8 Lukáš Doktor 2014-05-15 11:42:58 UTC
Created attachment 895866 [details]
File: maps

Comment 9 Lukáš Doktor 2014-05-15 11:43:00 UTC
Created attachment 895867 [details]
File: open_fds

Comment 10 Lukáš Doktor 2014-05-15 11:43:03 UTC
Created attachment 895868 [details]
File: proc_pid_status

Comment 11 Lukáš Doktor 2014-05-15 11:43:05 UTC
Created attachment 895869 [details]
File: var_log_messages

Comment 12 Lukáš Doktor 2014-05-15 12:14:47 UTC
I met this bug while trying to simulate similar problem in docker container. The difference is, that when I used container:

1. TERM1: docker run -t -i --name=test_95vY fedora bash -c 'for NUM in `seq 1 64`; do trap "echo Received $NUM, ignoring..." $NUM; done; while :; do sleep 1; done' 2>&1 | grep error
2. TERM2: touch /var/tmp/docker_kill_stress
3. TERM2: for AAA in `seq 1 31`; do [ $AAA -eq 9 ] && continue; [ $AAA -eq 17 ] && continue; { while [ -e /var/tmp/docker_kill_stress ]; do /usr/bin/docker -D kill -s $AAA test_95vY > /dev/null || echo "Sender $AAA failed"; done } & done

Results were:
bash: line 1: echo: write error: Interrupted system call
bash: line 1: echo: write error: Interrupted system call
bash: line 1: echo: write error: Interrupted system call

(once in a while)

When I tried the same with os kill:
1. TERM1: docker run -t -i --name=test_95vY fedora bash -c 'for NUM in `seq 1 64`; do trap "echo Received $NUM, ignoring..." $NUM; done; while :; do sleep 1; done' 2>&1 | grep error
2. TERM2: touch /var/tmp/docker_kill_stress
3. TERM2: for AAA in `seq 1 31`; do [ $AAA -eq 9 ] && continue; [ $AAA -eq 17 ] && continue; { while [ -e /var/tmp/docker_kill_stress ]; do kill -$AAA $PID_OF_THE_CONTAINER > /dev/null || echo "Sender $AAA failed"; done } & done

Results were:
docker process was destroyed, while the container was still running and handling the signals properly. I was able to attach it and send another bunch of kills to it.

NOTE: In later trials I omitted signal 20 too as it puts the process into background (sometimes)

Comment 13 Ondrej Oprala 2015-01-16 17:22:44 UTC
I don't seem to be able to reproduce it with bash-4.3.33-1.fc21. Are you able to?

Comment 14 Lukáš Doktor 2015-03-10 12:10:57 UTC
Hello, again. I tried it on bash-4.2.53-2.fc20.x86_64 and it survived successfully. Only xterm hanged afterwards, but that's most certainly an xterm issue...

Thank you,
Lukáš