git: 1babcad6bc40 - main - elf: Avoid dumping uninitialized bytes in PRSTATUS core dump notes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 23 Mar 2022 16:55:50 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=1babcad6bc4093664a10c7ab98b9ebd2d64bcaaf
commit 1babcad6bc4093664a10c7ab98b9ebd2d64bcaaf
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-23 16:52:44 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-23 16:53:49 +0000
elf: Avoid dumping uninitialized bytes in PRSTATUS core dump notes
elf_prstatus_t contains pad space.
Reported by: KMSAN
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34606
---
sys/kern/imgact_elf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 0f60835ce5e2..91c967c0c8de 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -2232,6 +2232,7 @@ __elfN(get_prstatus)(struct regset *rs, struct thread *td, void *buf,
KASSERT(*sizep == sizeof(*status), ("%s: invalid size",
__func__));
status = buf;
+ memset(status, 0, *sizep);
status->pr_version = PRSTATUS_VERSION;
status->pr_statussz = sizeof(elf_prstatus_t);
status->pr_gregsetsz = sizeof(elf_gregset_t);