git: e917958c3667 - main - rtld: clear any holes in the struct utrace_rtld passed to kernel logger
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 05 Feb 2025 10:33:34 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=e917958c36670131ab42e8f2c849b708a3216e37
commit e917958c36670131ab42e8f2c849b708a3216e37
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-02-04 22:33:11 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-02-05 10:33:29 +0000
rtld: clear any holes in the struct utrace_rtld passed to kernel logger
This should avoid an (almost) false positive from Valgrind, by filling
the padding on LP64.
PR: 284563
Reported by: Paul Floyd <pjfloyd@wanadoo.fr>
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D48854
---
libexec/rtld-elf/rtld.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 169ec0200ea5..aab20407b00d 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -337,14 +337,14 @@ ld_utrace_log(int event, void *handle, void *mapbase, size_t mapsize,
struct utrace_rtld ut;
static const char rtld_utrace_sig[RTLD_UTRACE_SIG_SZ] = RTLD_UTRACE_SIG;
+ memset(&ut, 0, sizeof(ut)); /* clear holes */
memcpy(ut.sig, rtld_utrace_sig, sizeof(ut.sig));
ut.event = event;
ut.handle = handle;
ut.mapbase = mapbase;
ut.mapsize = mapsize;
ut.refcnt = refcnt;
- bzero(ut.name, sizeof(ut.name));
- if (name)
+ if (name != NULL)
strlcpy(ut.name, name, sizeof(ut.name));
utrace(&ut, sizeof(ut));
}