This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Corrupted test cases since "Don't require test wrappers to preserve environment variables, use more consistent environment" heaps
- From: Mel Gorman <mgorman at suse dot de>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org, Siddhesh Poyarekar <siddhesh at redhat dot com>, Julian Taylor <jtaylor dot debian at googlemail dot com>, Carlos O'Donell <carlos at redhat dot com>
- Date: Tue, 24 Feb 2015 14:04:05 +0000
- Subject: Corrupted test cases since "Don't require test wrappers to preserve environment variables, use more consistent environment" heaps
- Authentication-results: sourceware.org; auth=none
- References: <20150220132747 dot GV3087 at suse dot de> <20150224070118 dot GE23807 at spoyarek dot pnq dot redhat dot com> <20150224104712 dot GZ3087 at suse dot de>
Joseph, there is a problem with one of your commits since glibc 2.20.
On Tue, Feb 24, 2015 at 10:47:12AM +0000, Mel Gorman wrote:
> On Tue, Feb 24, 2015 at 12:31:18PM +0530, Siddhesh Poyarekar wrote:
> > On Fri, Feb 20, 2015 at 01:27:47PM +0000, Mel Gorman wrote:
> > > 2015-02-10 Mel Gorman <mgorman@suse.de>
> > >
> > > [BZ #17195]
> > > * malloc/arena.c (free): Apply trim threshold to per-thread heaps
> > > as well as the main arena.
> > > ---
> > > malloc/arena.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/malloc/arena.c b/malloc/arena.c
> > > index 886defb074a2..fec339819309 100644
> > > --- a/malloc/arena.c
> > > +++ b/malloc/arena.c
> > > @@ -696,7 +696,7 @@ heap_trim (heap_info *heap, size_t pad)
> > > }
> > > top_size = chunksize (top_chunk);
> > > extra = (top_size - pad - MINSIZE - 1) & ~(pagesz - 1);
> > > - if (extra < (long) pagesz)
> > > + if ((unsigned long) extra < mp_.trim_threshold)
> > > return 0;
> > >
> > > /* Try to shrink. */
> >
> > Looks like this exposes some kind of a race. I ran the testsuite with
> > this patch and intl/tst-gettext4 and intl/tst-gettext5 fail with a
> > segfault. From a quick peek it looks like a malloc trying to tinker
> > with the part of an arena that has not yet been allocated, i.e. does
> > not have any permissions. Can you please look into it? I can't push
> > this till that problem is solved.
> >
>
> Ok, I'll start taking a look. I have yet to properly investigate but I
> do think this is an existing problem that the patch makes worse because
> I find this
>
> # This is a test run using the glibc installed on the system
> mel@stampy:~/git-public/glibc/obj-baseline > ./intl/tst-gettext4
> beauty
> thread 1 call 1 returned: beauty
> beauty
> thread 2 call 1 returned: beauty
> beauty
> thread 1 call 2 returned: beauty
> beauty
> thread 2 call 2 returned: beauty
>
> # This is a test run using glibc 2.21
> mel@stampy:~/git-public/glibc/obj-baseline > ./testrun.sh ./intl/tst-gettext4
> Schï¿œnheit
> beautᅵ
> Schï¿œnheit
> beautᅵ
>
I bisected this down to commit 8540f6d2a74 ("Don't require test wrappers
to preserve environment variables, use more consistent environment.").
The test case does not crash but it's clearly corrupted.
Before that commit we have
mel@stampy:~/git-public/glibc > rm -rf obj-verify; git checkout 8540f6d2a74fe9d67440535ebbcfa252180a3172^ | head; mkdir obj-verify; cd obj-verify; ../configure --prefix=/tmp/blah > /dev/null 2>&1 && make -j8 > /dev/null 2>&1 && make -j8 tests > /dev/null 2>&1 ; ./testrun.sh > ./intl/tst-gettext4; cd ..
HEAD is now at ed36bfa18faf... PowerPC: Fix optimized strncat strlen call
beauty
thread 1 call 1 returned: beauty
beauty
thread 2 call 1 returned: beauty
beauty
thread 1 call 2 returned: beauty
beauty
thread 2 call 2 returned: beauty
And on the commit we get
mel@stampy:~/git-public/glibc > rm -rf obj-verify; git checkout 8540f6d2a74fe9d67440535ebbcfa252180a3172 | head; mkdir obj-verify; cd obj-verify; ../configure --prefix=/tmp/blah > /dev/null 2>&1 && make -j8 > /dev/null 2>&1 && make -j8 tests > /dev/null 2>&1 ; ./testrun.sh > ./intl/tst-gettext4; cd ..
Previous HEAD position was ed36bfa18faf... PowerPC: Fix optimized strncat strlen call
HEAD is now at 8540f6d2a74f... Don't require test wrappers to preserve environment variables, use more consistent environment.
Schï¿œnheit
beautᅵ
Schï¿œnheit
beautᅵ
--
Mel Gorman
SUSE Labs