From nobody Thu Nov 12 17:52:39 2026 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 4jQSf02B4Wz70ytC for ; Thu, 12 Nov 2026 17:52:40 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jQSdz1rHbz4YJb for ; Thu, 12 Nov 2026 17:52:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794505959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uL3vZGzmty1g2TXdt1SaYsOHed1UVQk3qW2chfVvYfE=; b=fm4ChenLz+6EGHcEYv9d8ia1K6tUtTxUfBuuCxG/fYei7Zx8NqOO+cdz7fvP24cCcxgqAQ OQi8McVMYHpIkDsa/GMw5NN0mJUuWHeVctchsD6Og00Zo1IPkUai7+Yj04rpyUXyW8MeER xozXKiFZqjaRHP3cy8n6jb32rAPrTf4rFs8jLRZLGwid3906fIZEpy4MBi8yAHWHm2IR1P fLjD7qhgCiI233rz4OEnvfG5sKgDpcsHR7DWCXx+6eHwPhDNFTl1tOKnoNcDTvl4D81yJk Pnsvt0OfB8SJxBm13poJVYU6Stbbe60oxXurVvJjgYxBnvpgNX+KPI74c80GSg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794505959; b=vNm+5ZIQeOFlvOqEcLXrP1iK8qVmK13tC8AHIFQfNaQxpLKvDT6tT6Qn2pkMD889qVdwb/ PW45vrhb1q2zKlEmMlFMrzLDh85f5uL96kmKraSsKCp00luJDHik56g+qD+R+yP+gV5BeY lEfYHZJvZYRbCgeMrO5IijlUkbh5Kx0cn/7CA53iyi7vOzm+K4AYfVEXNVnlQpCuSVkvbu pXp3J711Sa+1+/MC7HvvGSOfQnqBWMuWG5MPLuJjP2kFIv0kmW6ZPGXSJ7UQSUDdsW79+z Tqkbn+sutkQrpqOa0UI2EEO3HyIiEXp/I4pByQr7ZSKkgKC30mLHtm+PQChapg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794505959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uL3vZGzmty1g2TXdt1SaYsOHed1UVQk3qW2chfVvYfE=; b=uvT+IWpF7u52UueekoHzvCdgFbyMBOZ4LuAecOXdJ2gO6/Pgh0hLqRrp99jME4ra6o5vKy hW3SBsm+AhtbTw3kwWY8iQNOAc/QS0L5UnxvqQdm3gVemzhCOQjMA5Fc1Ti951OYlBIQgr rDlLS8Y8735ASLnb87vIe4fc1aTxhz2YjwKsVsgjpHIYnu6dBsV/B3yBnrul8NP4arTyvr A01QvaMTxvT6GvDTXxFCub2EljkSqt6WyLtPrUAZ+aMIaoKY0YjfXLswl+oHQ95rKyHUx3 Ff45ZYoAnwSXhqBvtQmb7ajlN3u3FnXcifSWFhDVI0HV8eEamicZw2dDGA35gA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jQSdz1P6Qz1Cgt for ; Thu, 12 Nov 2026 17:52:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id b6f6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 12 Nov 2026 17:52:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Nick Price From: Mark Johnston Subject: git: fd57277fc3c2 - stable/14 - linux: do not truncate the listxattr() size List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: fd57277fc3c25e6656a23810387b6aa111c5a2cd Auto-Submitted: auto-generated Date: Thu, 12 Nov 2026 17:52:39 +0000 Message-Id: <6af5fce7.b6f6.79147f2c@gitrepo.freebsd.org> The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fd57277fc3c25e6656a23810387b6aa111c5a2cd commit fd57277fc3c25e6656a23810387b6aa111c5a2cd Author: Nick Price AuthorDate: 2026-11-08 01:32:08 +0000 Commit: Mark Johnston CommitDate: 2026-11-12 16:50:23 +0000 linux: do not truncate the listxattr() size listxattr() sized its buffer with min(), which truncates the 64-bit size to 32 bits, so a size of 2^32 + k allocated k bytes while the copy-out guard used the full size. The walk then read record lengths past the buffer and copied kernel heap out to the caller, and could panic the kernel. Any user can reach it through a user.* attribute on a file it owns. Use MIN(), and fail with EIO if a record runs past the data returned. Reviewed by: adrian, markj Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D61006 Signed-off-by: Nick Price (cherry picked from commit fbe4835e6b1eec36103a5ce97efbab11b3b5fc72) --- sys/compat/linux/linux_xattr.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_xattr.c b/sys/compat/linux/linux_xattr.c index 6979fff9c82d..c66339b9b348 100644 --- a/sys/compat/linux/linux_xattr.c +++ b/sys/compat/linux/linux_xattr.c @@ -139,7 +139,7 @@ listxattr(struct thread *td, struct listxattr_args *args) int attrnamespace, error; if (args->size != 0) - sz = min(LINUX_XATTR_LIST_MAX, args->size); + sz = MIN(LINUX_XATTR_LIST_MAX, args->size); else sz = LINUX_XATTR_LIST_MAX; @@ -189,6 +189,13 @@ listxattr(struct thread *td, struct listxattr_args *args) error = ERANGE; break; } + KASSERT(keylen + 1 <= rs, + ("%s: truncated record", __func__)); + if (keylen + 1 > rs) { + printf("%s: truncated record\n", __func__); + error = EIO; + goto out; + } ++key; if (args->list != NULL && args->size > 0) { sprintf(attrname, "%s.%.*s", prefix, keylen, key); @@ -201,6 +208,7 @@ listxattr(struct thread *td, struct listxattr_args *args) rs -= (keylen + 1); } } +out: if (error == 0) td->td_retval[0] = cnt; free(data, M_LINUX);