public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] elf: Call free from base namespace on error in dl-libc.c [BZ #27646]
Date: Tue,  6 Jul 2021 12:30:58 +0000 (GMT)	[thread overview]
Message-ID: <20210706123058.D62E7383F422@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=832f50be6c9c010e46180d14126bbb81f35e808c

commit 832f50be6c9c010e46180d14126bbb81f35e808c
Author: Florian Weimer <fweimer@redhat.com>
Date:   Tue Jul 6 13:22:01 2021 +0200

    elf: Call free from base namespace on error in dl-libc.c [BZ #27646]
    
    In dlerror_run, free corresponds to the local malloc in the
    namespace, but GLRO (dl_catch_error) uses the malloc from the base
    namespace.  elf/tst-dlmopen-gethostbyname triggers this mismatch,
    but it does not crash, presumably because of a fastbin deallocation.
    
    Fixes commit c2059edce20c124d1a99f1a94cc52e83b77a917a ("elf: Use
    _dl_catch_error from base namespace in dl-libc.c [BZ #27646]") and
    commit b2964eb1d9a6b8ab1250e8a881cf406182da5875 ("dlfcn: Failures
    after dlmopen should not terminate process [BZ #24772]").

Diff:
---
 elf/dl-libc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elf/dl-libc.c b/elf/dl-libc.c
index a49df22029..ba792e9589 100644
--- a/elf/dl-libc.c
+++ b/elf/dl-libc.c
@@ -48,7 +48,7 @@ dlerror_run (void (*operate) (void *), void *args)
 		?: last_errstring != NULL);
 
   if (result && malloced)
-    free ((char *) last_errstring);
+    GLRO (dl_error_free) ((char *) last_errstring);
 
   return result;
 }


                 reply	other threads:[~2021-07-06 12:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210706123058.D62E7383F422@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).