Bug 58864

Summary: When /proc not mounted kernel SRPM crashes machine
Product: [Retired] Red Hat Linux Reporter: Ben Woodard <woodard>
Component: kernelAssignee: Arjan van de Ven <arjanv>
Status: CLOSED CURRENTRELEASE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: tao
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: 2004-02-24 18:51:07 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
patch to fix the problem none

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:
Always

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
 	RPM_BUILD_NCPUS=1
     fi

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