Bug 170052 - elf_core_dump is a stack hog (1192 bytes)
elf_core_dump is a stack hog (1192 bytes)
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
3.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Eric Sandeen
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-10-06 16:31 EDT by Eric Sandeen
Modified: 2007-11-30 17:07 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-02-23 16:34:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
elf_core_dump stack reduction patch (5.91 KB, patch)
2005-10-06 16:35 EDT, Eric Sandeen
no flags Details | Diff

  None (edit)
Description Eric Sandeen 2005-10-06 16:31:09 EDT
Please note: I'm submitting this as a suggestion from an RHEL3 user, not as
a corporate request from SGI.

Description of problem:

elf_core_dump uses over 1k of stack (about 20% of what's available) on ia32,
due to large stack variables.  Dumping core to a filesystem that is over
stacked volume managers, or over a networked filesytem could cause the stack
to overflow.

A patch went into the 2.5 series to remedy this:

http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.5/2.5.64/2.5.64-mm1/broken-out/elf_core_dump-stack-size-reduction.patch

I've attached a backport of this patch that gets elf_core_dump down under 200
bytes.  It was quick work and could bear some scrutiny that I'm sure you'd
give it anyway.  :)

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

2.4.21-37

Thanks,

-Eric
Comment 1 Eric Sandeen 2005-10-06 16:35:14 EDT
Created attachment 119685 [details]
elf_core_dump stack reduction patch

er, try that patch attachment one more time.
Comment 2 John Hesterberg 2007-02-15 11:42:09 EST
Eric, still an issue?
Do you want to push as a RH employee now?
Comment 3 Eric Sandeen 2007-02-15 12:30:53 EST
Yep looks like it's still an issue...

c0191f50 <elf_core_dump>:
c0191f50:       55                      push   %ebp
c0191f51:       57                      push   %edi
c0191f52:       56                      push   %esi
c0191f53:       53                      push   %ebx
c0191f54:       bb 00 e0 ff ff          mov    $0xffffe000,%ebx
c0191f59:       21 e3                   and    %esp,%ebx
c0191f5b:       81 ec ac 04 00 00       sub    $0x4ac,%esp

1196 bytes... ouch.

I'll see what people think of fixing this.  Maybe I can come up with a non-cxfs
testcase ;-)
Comment 5 Eric Sandeen 2007-02-23 14:49:14 EST
The problem isn't the stack above, it's what's below - 

elf_core_dump
  DUMP_WRITE
    dump_write
      file->f_op->write
        ... and down into whatever stacked IO stuff you may have

OTOH 2.4.21 still has 8k to work withg, right, so it's not quite as bad (which
is probably why this -was- cleaned up upstream in 2.6)

If nobody's hit it in the wild on RHEL3, perhaps it's not worth worrying about
at this point.
Comment 8 Eric Sandeen 2007-02-23 16:34:37 EST
If this hasn't been an issue for our customers yet, it's probably not worth the
change.

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