aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-04-26 18:53:16 +0000
committerMark Johnston <markj@FreeBSD.org>2021-04-26 18:53:16 +0000
commit409ab7e109c692014e3484a74af248dd7a4746e8 (patch)
tree837b86bbeab42ac6040187bb75362f05b102a206
parent099919b76dce8ae118fea8bc950d2a7157a9c28b (diff)
downloadsrc-409ab7e109c692014e3484a74af248dd7a4746e8.tar.gz
src-409ab7e109c692014e3484a74af248dd7a4746e8.zip
imgact_elf: Ensure that the return value in parse_notes is initialized
parse_notes relies on the caller-supplied callback to initialize "res". Two callbacks are used in practice, brandnote_cb and note_fctl_cb, and the latter fails to initialize res. Fix it. In the worst case, the bug would cause the inner loop of check_note to examine more program headers than necessary, and the note header usually comes last anyway. Reviewed by: kib Reported by: KMSAN MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29986
-rw-r--r--sys/kern/imgact_elf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 245894926ee1..c4aedbe6bbfa 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -2736,6 +2736,7 @@ note_fctl_cb(const Elf_Note *note, void *arg0, boolean_t *res)
desc = (const Elf32_Word *)p;
*arg->has_fctl0 = TRUE;
*arg->fctl0 = desc[0];
+ *res = TRUE;
return (TRUE);
}