Bug 1331475 - bash segfaults when started via unshare --pid without forking
Summary: bash segfaults when started via unshare --pid without forking
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: bash
Version: 25
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Siteshwar Vashisht
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-28 15:10 UTC by Tomas Tomecek
Modified: 2017-02-13 07:25 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-11 06:39:46 UTC
Type: Bug


Attachments (Terms of Use)
backtrace (2.90 KB, text/plain)
2016-05-04 15:00 UTC, Kamil Dudka
no flags Details

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.


Note You need to log in before you can comment on or make changes to this bug.