From nobody Fri Feb 02 19:01:18 2024 X-Original-To: dev-commits-src-main@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 4TRQ9C1m9Gz59HRg; Fri, 2 Feb 2024 19:01:19 +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 4TRQ9C1B5Gz4lHr; Fri, 2 Feb 2024 19:01:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706900479; 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=DjEt0Uxq+cd36jaYcq0/0E7H9AcBKgdENWmlFjITGzQ=; b=L0qN03DYyJjQlnwC+0hB2NpWHdBd4Pwc+G0KUahAR77/5G7oUvcKquJ6imQG/yBEqOPXFz Vip1bK4eQn02GuY1VFYS3xrJlhIlj+XJuNLogYATzlOMEe4/t6iw2/tDfVjeUF0HbdWVGF T29ABnMMWTAr0bpVmAHKdLDgwaN5jIfwhcJlAMMgpVWjrSo1LcuvDzspI0YwRWiYwp9fLa ZGLBCa2vbp4rYpb4DkuZMda4cyAZXc7s7XbKns1E5vyxci9ochlGbvCDP/MkynoLfCM1lE jpW6MmA8LwB2xTDa3ylFZMzl+hEhmdTJew+szpv42wgIOFjEEyKLHPFwZzp+cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706900479; 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=DjEt0Uxq+cd36jaYcq0/0E7H9AcBKgdENWmlFjITGzQ=; b=DXoJw2iPO/hCa/N/Jjf+0R4E3joKNaPIh3j4BEeobw6bE0+b49Tc7PEaBHl9j8DLhDrDI5 L2hS7bl4+LoEypkkaSpcXav8h4WGdhmxs8ypE8RTycsBYD+K159OBXogv12ZyCFCwcqd6f v3DMGUSsrqNEVgYxAqQirSXgx/vkV0ySn6mzqYvb7X1EtQTRDoTlrExC+dKamljERgiWgX SD4T2c3+2xlLJ9nAohtkoPOSwhn9IsM5jdjY+sECQV5/cLxs8Gj8WHo4NqZHn08z3/cMxM c8YMUu4US5NAWMW4SxB95LdAIf13FiLaK75VtwJHsVG2iIsN31yniMGpFdK6Dg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706900479; a=rsa-sha256; cv=none; b=uk+14n5xD/Qiu3KWpbBv6tCAZTl3SaxbFOq5CquC9hPturFGqgUdaHV2u2dd/0xbscw7oz dCBDrwfe5w4oQ8+sJZN74ovdoTtfsH2z8G8QlZZpAmZ/aTnJLj4OXf0vaW4c3FlP18n3G3 UfHh0QjrDT7mSO/bB+aWIsJ3EYRIDGoaw+9E0vKFSXSR41nf49KhDJ8Pu1/wQX5fTjtklJ XvuhC+dAKKsTKgH8YTuxZW0ceXvTsH4uxFjGzV/MjoF2yiDrt+SkQYPjHdQkKZ/3y1sIsR Hdq2gZD7AXXwNveV/8NcCTze3yWNGkpX3IIjYJPLY8jiIWvvg6chHiWabbZclQ== 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 4TRQ9C0DQHzjJ4; Fri, 2 Feb 2024 19:01:19 +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 412J1IrQ049069; Fri, 2 Feb 2024 19:01:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 412J1IjY049066; Fri, 2 Feb 2024 19:01:18 GMT (envelope-from git) Date: Fri, 2 Feb 2024 19:01:18 GMT Message-Id: <202402021901.412J1IjY049066@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: 30f8cb812e27 - main - socket: Don't assume m0 != NULL in sbappendcontrol_locked() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 30f8cb812e27d8ab40a2c0669ac20a8ee45a7c56 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=30f8cb812e27d8ab40a2c0669ac20a8ee45a7c56 commit 30f8cb812e27d8ab40a2c0669ac20a8ee45a7c56 Author: Mark Johnston AuthorDate: 2024-02-02 18:58:37 +0000 Commit: Mark Johnston CommitDate: 2024-02-02 19:00:37 +0000 socket: Don't assume m0 != NULL in sbappendcontrol_locked() Some callers (e.g., ktls_decrypt()) violate this assumption and thus could trigger a NULL pointer dereference in KMSAN kernels. Reported by: glebius Fixes: ec45f952a232 ("sockbuf: Add KMSAN checks to sbappend*()") MFC after: 1 week --- sys/kern/uipc_sockbuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 2732ee8199ee..6d3050596f23 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -1326,7 +1326,8 @@ sbappendcontrol_locked(struct sockbuf *sb, struct mbuf *m0, { struct mbuf *m, *mlast; - kmsan_check_mbuf(m0, "sbappend"); + if (m0 != NULL) + kmsan_check_mbuf(m0, "sbappend"); kmsan_check_mbuf(control, "sbappend"); sbm_clrprotoflags(m0, flags);