From nobody Tue Oct 17 13:37:02 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 4S8w4t6MNTz4xWT0; Tue, 17 Oct 2023 13:37:02 +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 4S8w4t5qm8z3FXD; Tue, 17 Oct 2023 13:37:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697549822; 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=quYSNTQ9dXByehhoDrCX4NN5Pzg/xghLQumsw3i95D8=; b=FMfquHYPNFqkn3P7gb6jwRgzBey9a7QH6dDsQTV9c4LeQt1Kuc2iYWwmmYTKGynltqYfRP x4SDwcAUwQ46XJNF9N14DtX0FMeh+nZLDMBpxbqsJuwpOoWJrYcmt0Iz2TUQYlP9aQmLVa cncRqOVrzb32odMHU4Ti8o8e+XEGAfM4zlbNH4eGSKxLyRVWOZQ3LzJUdiQQvX74w2bFA+ oQ90UJNc3eXxU66qwhGztyd4/v/BPQoYWW+T1wSBtTleAJ1wRAuUOTyrYLX/wtmMr/a6Qj W+CInA5pZ/O5EpynCRvpOJJtoTmYnxo8QLmy/nU4p8A714ABR8GdoWw4MlHtzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697549822; a=rsa-sha256; cv=none; b=naPAHtca2LohOwjnVuv9Hg60mpaCxn686B1OOCFxI3ghL8SyeHpBepTDekwPE4DpcUMjgf Q+DnFzbmrLswU+Pabca4Q5wiN3m+la2gn+MFttJ6LX59/MOEeH5qUJWAPU6xDcQrfXuOpR C/ht8gHGbOTGcwfqY51Ec8cFodRMA6r6BeirB3kKB4Bnh3/CApFKrjYSSp3cF09iOWrKei f+U9cGSYf3z1mDP+DPJhvX05sl5AR6DVsIvrJ8DRZulBWWFDBoU65QA0ilqK7ERArZeDlV HuDSHLrbithOs3eiKW8iZeYyh/ClAY/9Vpjma2uFM2GQCKlSSRFdHlDL93PDtQ== 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=1697549822; 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=quYSNTQ9dXByehhoDrCX4NN5Pzg/xghLQumsw3i95D8=; b=NyxXAuKKetGYmGzNPCH2wQnaBEUs24Ea++2fIsnvustDVLGk+2hgW0sDNtCapMdqC8bGKx pOhYQvIUR5+QLI0T0XlHSUkoN+obTdbdZaHYqADpgLH8NPfnKaAQh1q8WTxDQZB1RUW1Ij ygFr1g9Xrai2uBrptD9M/lERqWxAd9mD1GRshG0QspazbQIwVElADEoAf99EdeL/R5ivrr K+ZsNWW4V94sQmxgwNi1qXiBXqGpDbC2oGPIi/1+ReWkJhAdtxbQBMzltwp59KAXhLC3im 8RyVBqo2jyYA6fE2kRpp9ReKdPLvuoNKyW6YKqRDqErFB8VWKyR4z8maRd+Pvg== 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 4S8w4t4t63z9r3; Tue, 17 Oct 2023 13:37:02 +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 39HDb2Z3095599; Tue, 17 Oct 2023 13:37:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39HDb218095596; Tue, 17 Oct 2023 13:37:02 GMT (envelope-from git) Date: Tue, 17 Oct 2023 13:37:02 GMT Message-Id: <202310171337.39HDb218095596@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7123222220aa - main - 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/main X-Git-Reftype: branch X-Git-Commit: 7123222220aa563dc16bf1989d335722e4ff57a6 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7123222220aa563dc16bf1989d335722e4ff57a6 commit 7123222220aa563dc16bf1989d335722e4ff57a6 Author: Mark Johnston AuthorDate: 2023-10-16 17:23:40 +0000 Commit: Mark Johnston CommitDate: 2023-10-17 13:05:45 +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 --- 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