Bug 1331475

Summary: bash segfaults when started via unshare --pid without forking
Product: [Fedora] Fedora Reporter: Tomas Tomecek <ttomecek>
Component: bashAssignee: Siteshwar Vashisht <svashisht>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 25CC: admiller, deekej, kdudka
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-11 06:39:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
backtrace none

Description Tomas Tomecek 2016-04-28 15:10:38 UTC
Description of problem:

When starting bash in a new PID namespace without fork, it segfaults:

$ sudo unshare --pid bash
bash: fork: Cannot allocate memory
Segmentation fault


I understand this is pretty cumbersome. I would expect bash not to segfault, I think it should print that it's not able to allocate memory.

E.g. zsh carries on:

$ sudo unshare --pid zsh
/etc/profile.d/colorgrep.sh:3: fork failed: cannot allocate memory
/etc/profile.d/colorls.sh:26: fork failed: cannot allocate memory
/etc/profile.d/colorxzgrep.sh:1: fork failed: cannot allocate memory
/etc/profile.d/colorzgrep.sh:3: fork failed: cannot allocate memory
/etc/profile.d/qt-graphicssystem.sh:7: fork failed: cannot allocate memory
/etc/profile.d/vim.sh:3: fork failed: cannot allocate memory
compinit:534: fork failed: cannot allocate memory
[root@localhost]/home/root# ls
zsh: fork failed: cannot allocate memory
[root@localhost]/home/root#

Comment 1 Kamil Dudka 2016-05-04 15:00:02 UTC
Created attachment 1153903 [details]
backtrace

Comment 2 David Kaspar // Dee'Kej 2016-05-04 15:01:58 UTC
Thank you for the backtrace, because I was unable to reproduce it:
> $ sudo unshare --pid bash
> bash: fork: Cannot allocate memory
> bash-4.3#

My version of bash:
> bash-4.3.42-3.fc23.x86_64

Also, I'm reassigning this to new maintainer of bash (but I will keep myself in CC for now).

Comment 3 Jan Kurik 2016-07-26 05:06:11 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 6 Siteshwar Vashisht 2017-02-13 07:25:38 UTC
This was fixed by rebasing bash to version 4.4 in rawhide.