Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 99E5E1B0437 for ; Wed, 18 Jun 2025 11:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244625; cv=none; b=C7iqw3f1LFrYB5C+k82+RkyFBHgaxpuBpnMWBi88qEVocmfBR+zi40za+PUiktLIvSwbNgNOIoT8kOe2UB+dK5d/idxOyfRiQ6xzWB4tXdM7ZTUn9YuGUuvz9Qu91+z8Imals8lfccyDhp8O8vmO1Sq3HVoQggLwlV9M8LWZlCc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244625; c=relaxed/simple; bh=VLT96ePQh33XqimwN8ntB6zqIe2H6P5Sv37egLDnf/4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=G68MKgu4Yb63ZgljyZfFIJ9NRy4flO6d6A1suwnWOLnR3FyDBCsKiXeXY08EXDYibopEZdO4xDzKpf1KQ6KiXGB2bNdtpH6ZSM/s1+C2b6OaBj38Ob9RaXJlNBq0tByo/MgN2l1QlaBVVHkkAWHlu8/q5fvAGQdH1yhzYvOqPJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=O1r9LdtX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="O1r9LdtX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1797C4CEE7; Wed, 18 Jun 2025 11:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750244625; bh=VLT96ePQh33XqimwN8ntB6zqIe2H6P5Sv37egLDnf/4=; h=From:To:Cc:Subject:Date:Reply-to:From; b=O1r9LdtXrAk6omPv3kKUhBOOPjAIIzECMkgwZKW8Nmp+iBCP77FNYO9CA3k9pR/ef N276hK1z35XJ1SUvf2e+JhSGq7GmpeU3aVpmYCA68dyCffQFu8FateX70WwGXRNHN7 U8NGD14CLDXyKCEzGPbKVC88V3GWIHdl+o+2cVg8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49985: bpf: Don't use tnum_range on array range checking for poke descriptors Date: Wed, 18 Jun 2025 13:00:50 +0200 Message-ID: <2025061822-CVE-2022-49985-3e41@gregkh> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4354; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=7WchmnkAbiCqMtt4aN2XJuBIMSeYlFPfOigtderMlkM=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlBc9zMLMXmLGPYY1M/7dWszJ0BIeI/2T6Jfzv9e/csv pfnGZs6OmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiE8QZ5gpwZxz8+Nl9xfHD 2+OmzHPUO/T48B+GBRNSzXwkJi1/EqR3c8FHET3Nhy1KMwE= 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: bpf: Don't use tnum_range on array range checking for poke descriptors Hsin-Wei reported a KASAN splat triggered by their BPF runtime fuzzer which is based on a customized syzkaller: BUG: KASAN: slab-out-of-bounds in bpf_int_jit_compile+0x1257/0x13f0 Read of size 8 at addr ffff888004e90b58 by task syz-executor.0/1489 CPU: 1 PID: 1489 Comm: syz-executor.0 Not tainted 5.19.0 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Call Trace: dump_stack_lvl+0x9c/0xc9 print_address_description.constprop.0+0x1f/0x1f0 ? bpf_int_jit_compile+0x1257/0x13f0 kasan_report.cold+0xeb/0x197 ? kvmalloc_node+0x170/0x200 ? bpf_int_jit_compile+0x1257/0x13f0 bpf_int_jit_compile+0x1257/0x13f0 ? arch_prepare_bpf_dispatcher+0xd0/0xd0 ? rcu_read_lock_sched_held+0x43/0x70 bpf_prog_select_runtime+0x3e8/0x640 ? bpf_obj_name_cpy+0x149/0x1b0 bpf_prog_load+0x102f/0x2220 ? __bpf_prog_put.constprop.0+0x220/0x220 ? find_held_lock+0x2c/0x110 ? __might_fault+0xd6/0x180 ? lock_downgrade+0x6e0/0x6e0 ? lock_is_held_type+0xa6/0x120 ? __might_fault+0x147/0x180 __sys_bpf+0x137b/0x6070 ? bpf_perf_link_attach+0x530/0x530 ? new_sync_read+0x600/0x600 ? __fget_files+0x255/0x450 ? lock_downgrade+0x6e0/0x6e0 ? fput+0x30/0x1a0 ? ksys_write+0x1a8/0x260 __x64_sys_bpf+0x7a/0xc0 ? syscall_enter_from_user_mode+0x21/0x70 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f917c4e2c2d The problem here is that a range of tnum_range(0, map->max_entries - 1) has limited ability to represent the concrete tight range with the tnum as the set of resulting states from value + mask can result in a superset of the actual intended range, and as such a tnum_in(range, reg->var_off) check may yield true when it shouldn't, for example tnum_range(0, 2) would result in 00XX -> v = 0000, m = 0011 such that the intended set of {0, 1, 2} is here represented by a less precise superset of {0, 1, 2, 3}. As the register is known const scalar, really just use the concrete reg->var_off.value for the upper index check. The Linux kernel CVE team has assigned CVE-2022-49985 to this issue. Affected and fixed versions =========================== Issue introduced in 5.5 with commit d2e4c1e6c2947269346054ac8937ccfe9e0bcc6b and fixed in 5.10.140 with commit e8979807178434db8ceaa84dfcd44363e71e50bb Issue introduced in 5.5 with commit d2e4c1e6c2947269346054ac8937ccfe9e0bcc6b and fixed in 5.15.64 with commit 4f672112f8665102a5842c170be1713f8ff95919 Issue introduced in 5.5 with commit d2e4c1e6c2947269346054ac8937ccfe9e0bcc6b and fixed in 5.19.6 with commit a36df92c7ff7ecde2fb362241d0ab024dddd0597 Issue introduced in 5.5 with commit d2e4c1e6c2947269346054ac8937ccfe9e0bcc6b and fixed in 6.0 with commit a657182a5c5150cdfacb6640aad1d2712571a409 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-2022-49985 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: kernel/bpf/verifier.c 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/e8979807178434db8ceaa84dfcd44363e71e50bb https://git.kernel.org/stable/c/4f672112f8665102a5842c170be1713f8ff95919 https://git.kernel.org/stable/c/a36df92c7ff7ecde2fb362241d0ab024dddd0597 https://git.kernel.org/stable/c/a657182a5c5150cdfacb6640aad1d2712571a409