From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36C483603C2 for ; Sat, 25 Jul 2026 08:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784969591; cv=none; b=krmYubzZlFwzwbuLX9oQLA7rR0qzaXXibY8uvKmMSgIOSO3xM4ZQIWCC3fFW2Ozz72ueJGCwmeimZVjXqMT7hm2iWFwdPAragHXcjHWQSroCQehmed94jyd5vW8lW9V8HyiUVQq2xwsLB6iO5rA916pzxzu++SkdaXgmfnj3rqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784969591; c=relaxed/simple; bh=m47Erc7vn+YUcvfQRNdM55t59PXqOfrqRymyKPgOJRY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fEGRgXLqgJzErak1o4hf7wPVepKFgPbh5TyydX+DqnthsOTXEUWA0vRuhtp7eRJV62zsTOLLOXmOMZX7ar0CUycsFCnOM6lZCfIvtdTz90dlmbY8QVk6E/+64a5WyIZMTGDYqOE306wWp57oP12G9y7kN7heGs2VZ2oPvYC8v60= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=afqkv1fT; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="afqkv1fT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99DCA1F000E9; Sat, 25 Jul 2026 08:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784969590; bh=xJTEumJRdV/EWqFsxr30O9w33DKqrHsMfnIUbdM85tk=; h=From:To:Cc:Subject:Date:Reply-To; b=afqkv1fTpcpqGxqZGo68dgPoN3Ezf3lTyxzkogAoTiPIG9NUPr6Nk1f7hosWk1CBN 272Q8nG7p3Db1mC0FmRf01X/QI6K8VH2Qa8xl7F/sog/tslMKBA7AWB3Z7jY7JaPUa biU/XfJq0HpfbgpbRjIRx1mTIF8HzGK9kT+HBVzE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-64283: KVM: guest_memfd: Treat memslot binding offset+size as unsigned values Date: Sat, 25 Jul 2026 10:48:20 +0200 Message-ID: <2026072502-CVE-2026-64283-eed4@gregkh> X-Mailer: git-send-email 2.55.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4077; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=UW551G+4yyOLs0SWUedYhpsGbuE90v5IuYR3RmEgTBg=; b=owGbwMvMwCRo6H6F97bub03G02pJDFkpFU7/048di1iTOfHkuwjv7qt1EyRWHay2/WgmHFRfp RWwfmFvRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzENpdhvtt//0N2nsv2fGTR a96z6/u6GzNffGFY0Dn1PG9vMNtiycO8G7h3Rz5RfqbPCQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: KVM: guest_memfd: Treat memslot binding offset+size as unsigned values When binding a memslot to a guest_memfd file, treat the offset and size as unsigned values to fix a bug where the sum of the two can result in a false negative when checking for overflow against the size of the file. Passing unsigned values also avoids relying on somewhat obscure checks in other flows for safety, and tracks the offset and size as they are intended to be tracked, as unsigned values. On 64-bit kernels, the number of pages a memslot contains and thus the size (and offset) of its guest_memfd binding are unsigned 64-bit values. Taking the offset+size as an loff_t instead of a uoff_t inadvertently converts the unsigned value to a signed value if the offset and/or size is massive. Locally storing the offset and size as signed values is benign in and of itself (though even that is *extremely* difficult to discern), but operating on their sum is not. For the offset, KVM explicitly checks against a negative value, which might seem like a bug as KVM could incorrectly reject a legitimate binding, but that's not actually the case as KVM_CREATE_GUEST_MEMFD takes a signed value for its size, i.e. a would-be-negative offset is also greater than the maximum possible size of any guest_memfd file. Regarding the size, while KVM lacks an explicit check for a negative value, i.e. seemingly has a flawed overflow check, KVM restricts the number of pages in a single memslot to the largest positive signed 32-bit value: if (id < KVM_USER_MEM_SLOTS && (mem->memory_size >> PAGE_SHIFT) > KVM_MEM_MAX_NR_PAGES) return -EINVAL; and so that maximum "size" will ever be is 0x7fffffff000. The sum of the two is, however, problematic. While the size is restricted by KVM's memslot logic, the offset is not, i.e. the offset is completely unchecked until the "offset + size > i_size_read(inode)" check. If the offset is the (nearly) largest possible _positive_ value, then adding size to the offset can result in a signed, negative 64-bit value. When compared against the size of the file (guaranteed to be positive), the negative sum is always smaller, and KVM incorrectly allows the absurd offset. Opportunistically add missing includes in kvm_mm.h (instead of relying on its parents). The Linux kernel CVE team has assigned CVE-2026-64283 to this issue. Affected and fixed versions =========================== Issue introduced in 6.8 with commit a7800aa80ea4d5356b8474c2302812e9d4926fa6 and fixed in 7.1.4 with commit f3a98d5881b9bd4807f49156143565f6aabcef1e Issue introduced in 6.8 with commit a7800aa80ea4d5356b8474c2302812e9d4926fa6 and fixed in 7.2-rc1 with commit eba85fee7fc6cf28fec38a5bf3c378bef9a79ca6 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2026-64283 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: virt/kvm/guest_memfd.c virt/kvm/kvm_mm.h Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/f3a98d5881b9bd4807f49156143565f6aabcef1e https://git.kernel.org/stable/c/eba85fee7fc6cf28fec38a5bf3c378bef9a79ca6