This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug dynamic-link/24476] __libc_freeres triggers bad free in libdl if dlerror was not used
- From: "mark at klomp dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 15 May 2019 21:50:50 +0000
- Subject: [Bug dynamic-link/24476] __libc_freeres triggers bad free in libdl if dlerror was not used
- Auto-submitted: auto-generated
- References: <bug-24476-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=24476
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Mark Wielaard <mark at klomp dot org> ---
commit 11b451c8868d8a2b0edc5dfd44fc58d9ee538be0
Author: Mark Wielaard <mark@klomp.org>
Date: Wed May 15 17:14:01 2019 +0200
dlfcn: Guard __dlerror_main_freeres with __libc_once_get (once) [BZ# 24476]
dlerror.c (__dlerror_main_freeres) will try to free resources which only
have been initialized when init () has been called. That function is
called when resources are needed using __libc_once (once, init) where
once is a __libc_once_define (static, once) in the dlerror.c file.
Trying to free those resources if init () hasn't been called will
produce errors under valgrind memcheck. So guard the freeing of those
resources using __libc_once_get (once) and make sure we have a valid
key. Also add a similar guard to __dlerror ().
* dlfcn/dlerror.c (__dlerror_main_freeres): Guard using
__libc_once_get (once) and static_bug == NULL.
(__dlerror): Check we have a valid key, set result to static_buf
otherwise.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
--
You are receiving this mail because:
You are on the CC list for the bug.