From nobody Tue Oct 24 13:38:28 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SFCnJ4jFTz4y3bD; Tue, 24 Oct 2023 13:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SFCnJ3tPsz4ZZd; Tue, 24 Oct 2023 13:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698154708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/+v/JXkQJIiBoRUvpZ3MXk3w7Eq7sHsly1iObwxTuaQ=; b=lh7WQRZ5vmSnlAFXO6bMSgdgy6vXA0lqG+Nan1qqIO3eV6azPRuZ/st8JLBjnDSVuwkRP7 QjEIlgcP+jdS2Ppy7GhNlcl9u7QWBZoMUg+SEbED1UUPUv/gnx1np68pXkL5yrTyR6mzWE FsVmb/rAuoS3rud4IHM87Ei3S2d0v/9nqr7wUgNBe4zJiE9118ESIhqAUsyH44nLM1HvEy SigTgCB+L/sYZRjgjszxqERU+tWaFKpDMu+iZ52CIl6LksJGjzi88U/0NWbpBFTiAopH15 RQgO0PV+1bsvn05f70EdhwOltB/t+WL4ZMNDLbGTedd7hcNs0IxDz3JmBJZ8UA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698154708; a=rsa-sha256; cv=none; b=LK4bCIZJI54jniCPL5tgdnQWJrAQ61MP9k72ulcZtnbWVoYXmeu9ZRQweTTMpXdfakVKoW njGzKiNJLbThyv46BH1OtflizJgtvFHAUHNk2z2efnw9/DAud6vF6Wf/auICUEKL2MkAfT cGuelnxJrH/VFoODZqfR/Bq6x1Vo6KtsoW3cEAhmKLetY+rkvSI94SUKMfZCowE3ncao1D IHFmC77dVYyLKA14nYeubOIY0o0vzusSbH8EpIdkWIXd141Pva7y/er4yft+WlRCrClO02 7Fh8NVTRw3a7SCupCmBWYMZc8mNAlepFslwfjXuySV81NIy9Uf/KYVrUL6bMbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698154708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/+v/JXkQJIiBoRUvpZ3MXk3w7Eq7sHsly1iObwxTuaQ=; b=SoTQGEt4su88bGuHfBzIzLTAqbM4VFMjOKXgHbqQVmMZab5t9dsC+Bdhsaaaa2uNTm0FIc czBovDFIqVY0/j9VaNiY+NrmLoZ8mY2idfymsUl56Egz2mpCM/9sz4H/5Yfhgd+/LpyhmK WDiGn2TKPcGdKBqWhbk6+kCtRZ0uSieKU66gBhkByTPxd/UU8R0ltLiBJ8aIgetneeJpwZ q5nVZ+9j/m7vy2NSLyicU0sfwd7JN2LyhhPFWnUWMxnDGlIu2pyjqIO5UMfhJxb2UM18do 8Ls6AjdDAxZoZQLcGM1qGqRcpSbjh7h1sURoTH9+RVvfGeI8md5jW0q6dtuJtw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SFCnJ2zYVz9Ys; Tue, 24 Oct 2023 13:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39ODcSKv089532; Tue, 24 Oct 2023 13:38:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39ODcSFn089529; Tue, 24 Oct 2023 13:38:28 GMT (envelope-from git) Date: Tue, 24 Oct 2023 13:38:28 GMT Message-Id: <202310241338.39ODcSFn089529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 53f62d1c9a9c - stable/14 - witness: Unconditionally initialize out-params for witness_save() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 53f62d1c9a9cce1ba1e04fe68c5ae3e5a9a2e656 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=53f62d1c9a9cce1ba1e04fe68c5ae3e5a9a2e656 commit 53f62d1c9a9cce1ba1e04fe68c5ae3e5a9a2e656 Author: Mark Johnston AuthorDate: 2023-10-16 17:23:40 +0000 Commit: Mark Johnston CommitDate: 2023-10-24 13:20:55 +0000 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 (cherry picked from commit 7123222220aa563dc16bf1989d335722e4ff57a6) --- sys/kern/subr_witness.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index d4ab085197f4..5b9f8afd9565 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -2362,6 +2362,10 @@ witness_save(struct lock_object *lock, const char **filep, int *linep) struct lock_instance *instance; struct lock_class *class; + /* Initialize for KMSAN's benefit. */ + *filep = NULL; + *linep = 0; + /* * This function is used independently in locking code to deal with * Giant, SCHEDULER_STOPPED() check can be removed here after Giant