Bug 209283 - [RHEL4] Crash when doing ls with loads of files
Summary: [RHEL4] Crash when doing ls with loads of files
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc   
(Show other bugs)
Version: 4.0
Hardware: All Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 221381
TreeView+ depends on / blocked
 
Reported: 2006-10-04 10:34 UTC by Bastien Nocera
Modified: 2007-11-30 22:07 UTC (History)
2 users (show)

Fixed In Version: RHBA-2007-0210
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-05-01 23:10:31 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
bash-segv.patch (2.10 KB, patch)
2007-01-03 15:38 UTC, Bastien Nocera
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2007:0210 normal SHIPPED_LIVE glibc bug fix update 2007-04-28 17:26:43 UTC
Sourceware 3253 None None None Never

Description Bastien Nocera 2006-10-04 10:34:09 UTC
DIR=`mktemp -d`
cd $DIR
for f in {0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9}
do
      echo $f
      touch
f${f}{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}{0,1,2,
3,4,5,6,7,8,9}
done

cd $DIR
ls *
<segfault>

Comment 1 Jakub Jelinek 2006-10-04 10:48:39 UTC
This sounds familiar:

http://sources.redhat.com/bugzilla/show_bug.cgi?id=3253

2006-09-30  Ulrich Drepper  <drepper@redhat.com>

        * posix/glob.c (glob_in_dir): Add some comments and asserts to
        explain why there are no leaks.

2006-09-25  Jakub Jelinek  <jakub@redhat.com>

        [BZ #3253]
        * posix/glob.c (glob_in_dir): Don't alloca one struct globlink at a
        time, rather allocate increasingly bigger arrays of pointers, if
        possible with alloca, if too large with malloc.

http://sourceware.org/cgi-bin/cvsweb.cgi/libc/posix/glob.c.diff?cvsroot=glibc&r1=1.69&r2=1.72

Comment 2 RHEL Product and Program Management 2006-10-04 11:01:39 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 6 Bastien Nocera 2006-12-19 17:19:54 UTC
With glibc-2.3.4-2.28 and bash-3.0-19.3, on an i386, I get a quite different
crash now:
#0  __gconv_transform_utf8_internal (step=0x9df9c30, data=0xbf40011c, 
    inptrp=0xbf400110, inend=0x9dfe974 "/tmp.Bqlwb28746/", outbufstart=0x0, 
    irreversible=0xbf400114, do_flush=0, consume_incomplete=1)
    at ../iconv/skeleton.c:401
#1  0x00180beb in *__GI___mbrtowc (pwc=0xbf40018c, s=0x9dfe964 "*", n=16, 
    ps=0xbf400190) at mbrtowc.c:76
#2  0x080c2fdb in xdupmbstowcs (destp=0xbf4001c8, indicesp=0x0, 
    src=0x9dfe964 "*") at xmbsrtowcs.c:188
#3  0x080c2cc9 in xstrmatch (pattern=0x9dfe964 "*", 
    string=0x9e0c96f "f370729", flags=5) at smatch.c:371
#4  0x080bfe09 in glob_vector (pat=0x9dfe964 "*", 
    dir=0x9dfe970 "/tmp/tmp.Bqlwb28746/", flags=0) at glob.c:489
#5  0x080c060b in glob_filename (pathname=0x9dfe950 "/tmp/tmp.Bqlwb28746/*", 
    flags=0) at glob.c:782
#6  0x08086cb3 in shell_glob_filename (
    pathname=0x9e02d10 "/tmp/tmp.Bqlwb28746/*") at pathexp.c:254
#7  0x08083a89 in expand_word_list_internal (list=Variable "list" is not available.
) at subst.c:7200
#8  0x0806a8f2 in execute_command_internal (command=0x9e03090, asynchronous=0, 
    pipe_in=-1, pipe_out=-1, fds_to_close=0x9dfad38) at execute_cmd.c:2797
#9  0x0806c670 in execute_command (command=0x9e03090) at execute_cmd.c:351
#10 0x0805dd7b in reader_loop () at eval.c:146
#11 0x0805ce42 in main (argc=1, argv=0xbff954a4, env=0xbff954ac) at shell.c:714

Bash issue?

Comment 7 Bastien Nocera 2007-01-03 15:38:14 UTC
Created attachment 144715 [details]
bash-segv.patch

Patch from Yves Begrand <yves.begrand@hp.com>:

- backported changes appearing in glob_vector() routine on bash-3.0-31
- backported changes brought with patch bash31-016
- removed the use of alloca() routine and associated test, because:
 from alloca(3):  "The alloca function is machine and compiler dependent.
			On many systems its implementation is buggy.
			Its use is discouraged"

I've mentioned to Yves that it would be better to not make any changes
regarding alloca usage, as it would make the codebase drift more from upstream.

Comment 8 Tim Waugh 2007-01-03 16:39:56 UTC
Does it fix it?  Could you file a separate bug for bash please?

Comment 9 Bastien Nocera 2007-01-04 09:31:19 UTC
Yes, it fixes it, filed as bug #221381

Comment 13 Red Hat Bugzilla 2007-05-01 23:10:31 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0210.html



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