mirror of
https://passt.top/passt
synced 2025-08-01 13:48:00 +02:00
treewide: Dodge dynamic memory allocation in strerror() from glibc > 2.40
With glibc commit 25a5eb4010df ("string: strerror, strsignal cannot use buffer after dlmopen (bug 32026)"), strerror() now needs, at least on x86, the getrandom() and brk() system calls, in order to fill in the locale-translated error message. But getrandom() and brk() are not allowed by our seccomp profiles. This became visible on Fedora Rawhide with the "podman login and logout" Podman tests, defined at test/e2e/login_logout_test.go in the Podman source tree, where pasta would terminate upon printing error descriptions (at least the ones related to the SO_ERROR queue for spliced connections). Avoid dynamic memory allocation by calling strerrordesc_np() instead, which is a GNU function returning a static, untranslated version of the error description. If it's not available, keep calling strerror(), which at that point should be simple enough as to be usable (at least, that's currently the case for musl). Reported-by: Paul Holzinger <pholzing@redhat.com> Link: https://github.com/containers/podman/issues/24804 Analysed-by: Paul Holzinger <pholzing@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Tested-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
e24f026222
commit
09478d55fe
11 changed files with 80 additions and 48 deletions
2
log.c
2
log.c
|
@ -322,7 +322,7 @@ void logmsg_perror(int pri, const char *format, ...)
|
|||
vlogmsg(false, false, pri, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
logmsg(true, true, pri, ": %s", strerror(errno_copy));
|
||||
logmsg(true, true, pri, ": %s", strerror_(errno_copy));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue