]> sourceware.org Git - glibc.git/commit
string: strerror, strsignal cannot use buffer after dlmopen (bug 32026)
authorFlorian Weimer <fweimer@redhat.com>
Mon, 19 Aug 2024 13:48:03 +0000 (15:48 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 19 Aug 2024 13:48:03 +0000 (15:48 +0200)
commit25a5eb4010df94b412c67db9e346029de316d06b
tree342bf741c5b97eeb89406cc609ca030856d8aef2
parente7c14e542d8d858b824b5df4f4e3dc93695e6171
string: strerror, strsignal cannot use buffer after dlmopen (bug 32026)

Secondary namespaces have a different malloc.  Allocating the
buffer in one namespace and freeing it another results in
heap corruption.  Fix this by using a static string (potentially
translated) in secondary namespaces.  It would also be possible
to use the malloc from the initial namespace to manage the
buffer, but these functions would still not be safe to use in
auditors etc. because a call to strerror could still free a
buffer while it is used by the application.  Another approach
could use proper initial-exec TLS, duplicated in secondary
namespaces, but that would need a callback interface for freeing
libc resources in namespaces on thread exit, which does not exist
today.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
string/strerror_l.c
string/strsignal.c
This page took 0.042691 seconds and 5 git commands to generate.