From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A1AA39AE853; Fri, 23 Jul 2021 13:16:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A1AA39AE853 From: "michael.debertol at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/28126] New: nftw aborts for paths longer than PATH_MAX Date: Fri, 23 Jul 2021 13:16:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.33 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: michael.debertol at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2021 13:16:59 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28126 Bug ID: 28126 Summary: nftw aborts for paths longer than PATH_MAX Product: glibc Version: 2.33 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: michael.debertol at gmail dot com CC: drepper.fsp at gmail dot com Target Milestone: --- When process_entry encounters a path longer than data->dirbufsize (which defaults to PATH_MAX) it tries to reallocate data->dirbuf. This results in = an error. As far as I can tell this was regressed by https://sourceware.org/bugzilla/show_bug.cgi?id=3D26353, which made it so t= hat data->dirbuf and data->dirstreams initially share a memory allocation. Here's a simple shell script to create such a long path: for i in {0..1000}; do mkdir aaaaaaaaaaa && cd aaaaaaaaaaa; done Here's the output when running nftw with asan: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D19873=3D=3DERROR: AddressSanitizer: attempting free on address which = was not malloc()-ed: 0x621000000150 in thread T0 #0 0x5579dbd81742 in realloc (/home/michael/devprojects/nftw_test/a.out+0xc7742) #1 0x7f0be361e4d5 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1= 4d5) #2 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #3 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1= 713) #4 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #5 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1= 713) #6 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #7 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1= 713) #8 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #9 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1= 713) #10 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #11 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #12 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #13 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #14 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #15 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #16 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #17 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #18 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #19 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #20 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #21 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #22 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #23 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #24 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #25 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #26 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #27 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #28 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #29 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #30 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #31 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #32 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #33 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #34 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #35 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #36 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #37 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #38 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #39 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #40 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #41 0x7f0be361e713 in process_entry.constprop.0 (/usr/lib/libc.so.6+0xf1713) #42 0x7f0be361e98a in ftw_dir (/usr/lib/libc.so.6+0xf198a) #43 0x7f0be361ef4b in ftw_startup (/usr/lib/libc.so.6+0xf1f4b) #44 0x5579dbdb898b in main (/home/michael/devprojects/nftw_test/a.out+0xfe98b) #45 0x7f0be3554b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24) #46 0x5579dbcda15d in _start (/home/michael/devprojects/nftw_test/a.out+0x2015d) 0x621000000150 is located 80 bytes inside of 4176-byte region [0x621000000100,0x621000001150) allocated by thread T0 here: #0 0x5579dbd813b9 in malloc (/home/michael/devprojects/nftw_test/a.out+0xc73b9) #1 0x7f0be361ee38 in ftw_startup (/usr/lib/libc.so.6+0xf1e38) SUMMARY: AddressSanitizer: bad-free (/home/michael/devprojects/nftw_test/a.out+0xc7742) in realloc =3D=3D19873=3D=3DABORTING --=20 You are receiving this mail because: You are on the CC list for the bug.=