public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] elf: Call free from base namespace on error in dl-libc.c [BZ #27646]
@ 2021-07-06 11:46 Florian Weimer
  2021-07-06 11:59 ` Andreas Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2021-07-06 11:46 UTC (permalink / raw)
  To: libc-alpha

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]").

---
 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;
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] elf: Call free from base namespace on error in dl-libc.c [BZ #27646]
  2021-07-06 11:46 [PATCH] elf: Call free from base namespace on error in dl-libc.c [BZ #27646] Florian Weimer
@ 2021-07-06 11:59 ` Andreas Schwab
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2021-07-06 11:59 UTC (permalink / raw)
  To: Florian Weimer via Libc-alpha; +Cc: Florian Weimer

Ok.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-06 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 11:46 [PATCH] elf: Call free from base namespace on error in dl-libc.c [BZ #27646] Florian Weimer
2021-07-06 11:59 ` Andreas Schwab

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).