Bug 104688

Summary: segmentation fault when stack size is less than 2Mbytes
Product: Red Hat Enterprise Linux 3 Reporter: Hui Huang <hui.huang>
Component: kernelAssignee: Arjan van de Ven <arjanv>
Status: CLOSED RAWHIDE QA Contact: Brian Brock <bbrock>
Severity: high Docs Contact:
Priority: medium    
Version: 3.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-09-20 07:13:51 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:

Description Hui Huang 2003-09-19 05:06:06 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314

Description of problem:
With RHEL AS-3 (Taroon-beta2), I get frequent segmentation fault
if stack size is smaller than 2Mbytes.

For example, in tcsh:

perf-lx3:~> limit stacksize 512k
perf-lx3:~> ls
Segmentation fault
perf-lx3:~> cat /proc/self/stat
Segmentation fault

512k stack should be big enough to run simple applications like
ls and cat.

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

perf-lx3:~> uname -a
Linux perf-lx3 2.4.21-1.1931.2.399.entsmp #1 SMP Wed Aug 20 15:51:09 EDT 2003
i686 i686 i386 GNU/Linux

How reproducible:
Always

Steps to Reproduce:
1. limit stacksize 512k
2. cat /proc/self/stat
3.
    

Actual Results:  Segmentation fault

Expected Results:  no crash, contents of /proc/self/stat is printed out

Additional info:

When I set stack limit to larger value, it becomes clear that the 
start_stack field in /proc/self/stat is way off the actual stack 
top (0xC0000000) as shown in /proc/self/maps:

perf-lx3:~> limit stacksize 8192k
perf-lx3:~> cat /proc/self/maps
00e58000-00e6e000 r-xp 00000000 08:03 556071     /lib/ld-2.3.2.so
00e6e000-00e6f000 rw-p 00015000 08:03 556071     /lib/ld-2.3.2.so
00e97000-00fc5000 r-xp 00000000 08:03 147256     /lib/tls/libc-2.3.2.so
00fc5000-00fc9000 rw-p 0012d000 08:03 147256     /lib/tls/libc-2.3.2.so
00fc9000-00fcb000 rw-p 00000000 00:00 0
08048000-0804c000 r-xp 00000000 08:03 196534     /bin/cat
0804c000-0804d000 rw-p 00003000 08:03 196534     /bin/cat
0897a000-0899b000 rw-p 00000000 00:00 0
b75f1000-b77f1000 r--p 00000000 08:03 556073     /usr/lib/locale/locale-archive
b77f1000-b77f2000 rw-p 00000000 00:00 0
bff68000-c0000000 rw-p fffe8000 00:00 0

perf-lx3:~> cat /proc/self/stat
10752 (cat) R 9267 10752 9267 34816 10752 4194304 28 0 105 0 0 0 0 0 16 0 0 0
33764547 4554752 106 4294967295 134512640 134525428 3220289040 3220288580 9721294
0 0 0 0 0 0 0 17 0 0 0 0 0 0 0
perf-lx3:~> cat /proc/self/stat
10753 (cat) R 9267 10753 9267 34816 10753 4194304 28 0 105 0 0 0 0 0 16 0 0 0
33764669 4907008 106 4294967295 134512640 134525428 3219937664 3219937204 5240270
0 0 0 0 0 0 0 17 0 0 0 0 0 0 0
perf-lx3:~> cat /proc/self/stat
10754 (cat) R 9267 10754 9267 34816 10754 4194304 28 0 105 0 0 0 0 0 16 0 0 0
33764734 4050944 106 4294967295 134512640 134525428  3220791060 5502414
0 0 0 0 0 0 0 17 0 0 0 0 0 0 0

Notice that the start_stack value is different in each run 
(3220289040, 3219937664, 3220791520). It is about 400K to
1.2M below the actual stack top (0xC0000000). This seems wrong.

Comment 1 Arjan van de Ven 2003-09-19 07:16:38 UTC
Please try a more recent kernel from RHN since we fixed this already

Comment 2 Hui Huang 2003-09-19 23:44:32 UTC
I downloaded kernel-smp-2.4.21-2.EL from RHN, and the
problem is gone. Thanks!