Bug 58864 - When /proc not mounted kernel SRPM crashes machine
Summary: When /proc not mounted kernel SRPM crashes machine
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
(Show other bugs)
Version: 9
Hardware: All Linux
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2002-01-26 01:17 UTC by Ben Woodard
Modified: 2007-04-18 16:39 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-02-24 18:51:07 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch to fix the problem (411 bytes, patch)
2002-01-26 01:19 UTC, Ben Woodard
no flags Details | Diff

Description Ben Woodard 2002-01-26 01:17:31 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6) Gecko/20011120

Description of problem:
if /proc is not mounted when you try to build the kernel RPM (for example if you
are building it in a chrooted environment) then it causes the machine to go into
hard swapping and then ultimately crash. The reason is actually very simple, you
calculate the number of processors using a file in the /proc file system and if
this query of the proc file system doesn't work then the make command ends up
being "make -j bzImage" rather than "make -j 2 bzImage" (using a dual processor
machine as an example). This ends up being like a fork bomb on the computer and 
ultimately takes it down.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. unmount /proc
2. rpm -ba kernel-*.spec


Actual Results:  machine starts hard swapping then ultimately crashes.

Expected Results:  kernel builds

Additional info:

Here is a patch to the spec file which will fix this problem:

diff -u -r1.1 kernel-2.4.spec
--- kernel-2.4.spec	2002/01/23 00:54:05	1.1
+++ kernel-2.4.spec	2002/01/23 02:28:37
@@ -1242,7 +1242,7 @@
 # if RPM_BUILD_NCPUS unset, set it
 if [ -z "$RPM_BUILD_NCPUS" ] ; then
-    RPM_BUILD_NCPUS=`egrep -c "^cpu[0-9]+" /proc/stat || :` 
+    RPM_BUILD_NCPUS=`egrep -c "^cpu[0-9]+" /proc/stat || echo 1` 
     if [ $RPM_BUILD_NCPUS -eq 0 ] ; then

Comment 1 Ben Woodard 2002-01-26 01:19:27 UTC
Created attachment 43574 [details]
patch to fix the problem

Comment 2 Arjan van de Ven 2002-02-11 17:24:39 UTC
fix added to the rawhide kernel

Comment 3 Ben Woodard 2002-04-11 22:53:37 UTC
This bug reappeared in 2.4.18-0.13 out of the Skipjack beta that is out on the
ftp site.

Comment 4 Dave Maley 2004-02-24 18:51:07 UTC
tested rebuilding kernel-2.4.21-9.0.1.EL.src.rpm with /proc not
mounted --> success

Looks like this has been fixed in current kernel packages --> closing BZ

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