]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
witness: Unconditionally initialize out-params for witness_save()
authorMark Johnston <markj@FreeBSD.org>
Mon, 16 Oct 2023 17:23:40 +0000 (13:23 -0400)
committerMark Johnston <markj@FreeBSD.org>
Tue, 17 Oct 2023 13:05:45 +0000 (09:05 -0400)
commit7123222220aa563dc16bf1989d335722e4ff57a6
treeb0a51c9335b5afc786ac4beff4247086a48d9c3b
parent4f8f43b06ed07e96a250855488cc531799d5b78f
witness: Unconditionally initialize out-params for witness_save()

As of LLVM 16, the -fsanitize-memory-param-retval option is set to true
by default, meaning that MSan will eagerly report uninitialized function
parameters and return values, even if they are not used.  A
witness_save()/witness_restore() call pair fails this test since
witness_save() may return before saving file and line number
information.

Modify witness_save() to initialize the out-params unconditionally; this
appears to be the only instance of the problem triggered when booting to
a login prompt, so let's just address it directly.

Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.
MFC after: 1 week
sys/kern/subr_witness.c