From nobody Fri Feb 9 15:04:29 2024 X-Original-To: dev-commits-src-branches@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 4TWcZj5mDJz59qhH; Fri, 9 Feb 2024 15:04:29 +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 4TWcZj40WPz4G0V; Fri, 9 Feb 2024 15:04:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707491069; 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=WbfpFQINZ6WcjLANn7dqH4XD1O0ZNtDELzw3kEYSjYg=; b=gbshKV453G2NulI5e6KwZC52Kjlq56U76vwbJUuyAi8pBWlf9NAuO9Nb2ZWFr0NdUbeWRT cvAIr7q4tCJ0D/3dl5xdGLzpenLJhrEfe3UHzleYD9+FaWD3twCEqyN/H/eZUUSoG859Mr CI74M2tVvWeB0wxjUkc6gDw2ixHN3gR6zJlHkoqrOtNfVGCou0NEWNZkfp5FvJZ4ba+2Up B+ZDn+fxoeo2J+nXpIRsXFv7zZE6vRUBklphcVemmIEJbdDLqULyx8oNXxaUzBM5g4nAb5 BkUZsYlN+5t3mJTl1vMsQ+jOmc0J7a7bIgUoisU7kuK8HBaV7VxPvhVqg0Abbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707491069; 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=WbfpFQINZ6WcjLANn7dqH4XD1O0ZNtDELzw3kEYSjYg=; b=Qu3HrH8K1IbpyVJISK10rYVAj+BN6oKEAJlHlWfjQKolpEsfWCaE7N4GS1/GjURsuhMC2U Ngj8RhkzxgroI8KdLI6g8lD8ikWppPPZt45G6HNSCgucomnEWWOIa4ypiBqeS7bv/7tBs+ KI1pPSvrTQfWN5BGLPCsYqjHU7zBeXrokm7mcj3QzVCB3vbLCDBiToNxy6T7B3TP7XdQO+ FXXqkT6HMGx2AqCbslxUrbsCSR7QDLybqPiBd6NyXKjyw4THHJv+P20bcZiefR1gmIB8EI 9mOG1bbdemP2dNVNfCY3//sDhrFTvecrSSpuJPuBFDNOG1RZjtgyqUY4bNtWWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707491069; a=rsa-sha256; cv=none; b=M/+bbARCPLiD4jS+nwumIY3qfpZmRAZ2GGednF4JDKRTdhF0GQMS6JAUIxqZsMjMZLpHAX eNICQqJyVCr2ncjtKb3yZAL/tvz3KP9hRQZLWTE6sDjpIAmYoZSZu0q8/7L+1U2OlfHFDj gCREc0x0rnTBT+vd8Ag0Gy/pNIrDN+y5slBbY58eNXxNE99M5Ip023V9NR7L/aqz8hugsS 0amDy2pOnGG9ksOT5JFk8jPdZA1mejqBPm0DMv8Kb3b26k9tpVrpnOrxSJMoBi3T4NlzNb CTixhGS9WyJFpDJSW2Aub9IbS7mOZ1rGqqUDZZyhDlLp9PNNhRX6NEoS8tGVKQ== 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 4TWcZj36VVzdMC; Fri, 9 Feb 2024 15:04:29 +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 419F4TfL085657; Fri, 9 Feb 2024 15:04:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 419F4TeQ085654; Fri, 9 Feb 2024 15:04:29 GMT (envelope-from git) Date: Fri, 9 Feb 2024 15:04:29 GMT Message-Id: <202402091504.419F4TeQ085654@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: a9ef2c901a8b - stable/14 - socket: Don't assume m0 != NULL in sbappendcontrol_locked() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: a9ef2c901a8b7101414a6bb778f991e9cb3b50c9 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a9ef2c901a8b7101414a6bb778f991e9cb3b50c9 commit a9ef2c901a8b7101414a6bb778f991e9cb3b50c9 Author: Mark Johnston AuthorDate: 2024-02-02 18:58:37 +0000 Commit: Mark Johnston CommitDate: 2024-02-09 14:56:02 +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 (cherry picked from commit 30f8cb812e27d8ab40a2c0669ac20a8ee45a7c56) --- 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 e76f198f42dc..406fdca11b47 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -1328,7 +1328,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);