From nobody Wed Dec 06 18:55:26 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 4SlmnC1FVhz53p1P; Wed, 6 Dec 2023 18:55:27 +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 4SlmnC0hYWz3Fxn; Wed, 6 Dec 2023 18:55:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701888927; 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=bsBX/rEB8UzFsdW7VQnPK8Y7O5NvyopWIwWxyZXgXM4=; b=AqcRMdTaTlRCRoaqwv+uc5v+ep0gp5r/Ve5LEBEOCgJWvF2sPccSsf77qyanGu7HUo2ST6 257i3UCm/2F1+jchmnNzQoTEVrey4p4C6e4U2Qjw1nWszItdXeZIek+qzpFNJMDTdVqTEB mg+woRqcOWSwUGM5c9teMU+P9ZikioM+qTKTS1mj5B5mxOCFA61sx5RPgCEuPxN1A3TyJe Dp/mP3Qz5FN8HVdJIm0ePuKwlaEeonFEYUL1Dg9q6zT2cO5fDm3xIfuniA46yqO1Zqh7Ky VYBSo1tWCv21DGDMdh6LrHoNTgIdkQxbgIrFhzeM68Q0VmIZ1GENEX2zCwT6gQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701888927; a=rsa-sha256; cv=none; b=KiRiVGX7Gng97pfKrfENjSMTf5Xr7H4lcR0X3EcHw0qMfbA8PT2M8IOMkP0Qik1Gl3M6eO Cz4wtaJLBZug5Mu3h2ulSRapgb414JTcswh/Bb3xRHr/5HYBnNy1DPWzpgBCvuYWTod5kF hsKCCRapH/u2Mxpuw1+joJ1F9u5I1xIWrlvPKwWwnoa6/Yjapiuyd9D4FyCONNjvMEgDXf SKTC62bDyWJEwI/eHTxdDLyrxyZdDFNwmYc9Qtl8pSakd6C66JA6Bks6TLeq/bIIfBCshW XLNZiCtywtDocx0Q8VsHFXcuQhoMIrm6OHqUpEyVZE3LBFWGFqQtTWLzB9yySA== 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=1701888927; 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=bsBX/rEB8UzFsdW7VQnPK8Y7O5NvyopWIwWxyZXgXM4=; b=Z9pdsAhqzjExTHnecX/2/RwakVsh1JaWPTO3QPEzWCkBd1jKel0aMqwDamhUvMBO5cETwv 1oNHuViYDetkUxPPhpQro2JIbqc7Kmf+KdS0fsjfgsnbe4D6KqZhX0AhxyOKV5k1wFkQUn kCvh2BE1hmQqyymbY0M6lpthe4E4mzEBJSK5lULBjhzdcJ3fjKYNQRpO5YqP4Nhfg5pabV seoXnrQg52hlqoxthtlfyEiT4gmHLfukjbDC6cU1s6gZUYdeBYVzLTo9SCUUp8XC0aRqrN SoyemR2GgdbsNe305H4xi3cFrv8EDAB/K23QjY3TmFYMAWkXjSGruaW899+ULA== 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 4SlmnB6cqYz14nb; Wed, 6 Dec 2023 18:55:26 +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 3B6ItQcB070130; Wed, 6 Dec 2023 18:55:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B6ItQH0070127; Wed, 6 Dec 2023 18:55:26 GMT (envelope-from git) Date: Wed, 6 Dec 2023 18:55:26 GMT Message-Id: <202312061855.3B6ItQH0070127@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: be5464ae233a - main - kmsan: Add kmsan_check_uio() 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: be5464ae233ada46a778cc82f7107a10a7d5343b Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=be5464ae233ada46a778cc82f7107a10a7d5343b commit be5464ae233ada46a778cc82f7107a10a7d5343b Author: Mark Johnston AuthorDate: 2023-12-06 16:31:15 +0000 Commit: Mark Johnston CommitDate: 2023-12-06 17:46:25 +0000 kmsan: Add kmsan_check_uio() This was handy for some ad-hoc debugging and fits in with other kmsan_check_*() routines which operate on some kind of data container. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- share/man/man9/Makefile | 1 + share/man/man9/kmsan.9 | 5 ++++- sys/kern/subr_msan.c | 9 +++++++++ sys/sys/msan.h | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 6768f52a38d6..81de035defb9 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1370,6 +1370,7 @@ MLINKS+=kmsan.9 KMSAN.9 \ kmsan.9 kmsan_check_bio.9 \ kmsan.9 kmsan_check_ccb.9 \ kmsan.9 kmsan_check_mbuf.9 \ + kmsan.9 kmsan_check_uio.9 \ kmsan.9 kmsan_mark.9 \ kmsan.9 kmsan_oirg.9 MLINKS+=kobj.9 DEFINE_CLASS.9 \ diff --git a/share/man/man9/kmsan.9 b/share/man/man9/kmsan.9 index 714442e4d9fe..90faf8f82e5e 100644 --- a/share/man/man9/kmsan.9 +++ b/share/man/man9/kmsan.9 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 13, 2023 +.Dd December 6, 2023 .Dt KMSAN 9 .Os .Sh NAME @@ -56,6 +56,8 @@ kernel configuration file: .Fn kmsan_check_ccb "const union ccb *" "const char *descr" .Ft void .Fn kmsan_check_mbuf "const struct mbuf *" "const char *descr" +.Ft void +.Fn kmsan_check_uio "const struct uio *" "const char *descr" .Sh DESCRIPTION .Nm is a subsystem which leverages compiler instrumentation to detect uses of @@ -306,6 +308,7 @@ f(size_t osz) .Xr busdma 9 , .Xr copyout 9 , .Xr KASAN 9 , +.Xr uio 9 , .Xr uma 9 .Rs .%A Evgeniy Stepanov diff --git a/sys/kern/subr_msan.c b/sys/kern/subr_msan.c index abac71da6d64..ef3c6c10b0ba 100644 --- a/sys/kern/subr_msan.c +++ b/sys/kern/subr_msan.c @@ -587,6 +587,15 @@ kmsan_check_mbuf(const struct mbuf *m, const char *descr) } while ((m = m->m_next) != NULL); } +void +kmsan_check_uio(const struct uio *uio, const char *descr) +{ + for (int i = 0; i < uio->uio_iovcnt; i++) { + kmsan_check(uio->uio_iov[i].iov_base, uio->uio_iov[i].iov_len, + descr); + } +} + void kmsan_init(void) { diff --git a/sys/sys/msan.h b/sys/sys/msan.h index 4baa71ec8113..58110d7306e6 100644 --- a/sys/sys/msan.h +++ b/sys/sys/msan.h @@ -50,6 +50,7 @@ union ccb; struct bio; struct mbuf; struct memdesc; +struct uio; void kmsan_init(void); @@ -69,6 +70,7 @@ void kmsan_check(const void *, size_t, const char *); void kmsan_check_bio(const struct bio *, const char *); void kmsan_check_ccb(const union ccb *, const char *); void kmsan_check_mbuf(const struct mbuf *, const char *); +void kmsan_check_uio(const struct uio *, const char *); #else #define kmsan_init(u) @@ -85,6 +87,7 @@ void kmsan_check_mbuf(const struct mbuf *, const char *); #define kmsan_check_bio(b, d) #define kmsan_check_ccb(c, d) #define kmsan_check_mbuf(m, d) +#define kmsan_check_uio(u, d) #define kmsan_bus_dmamap_sync(d, op) #endif