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 5814C4AEBDA for ; Thu, 24 Sep 2026 16:12:31 +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=1790266352; cv=none; b=ENRdtx19aSoy36sTY/YL/I0wS0M+tM6cNXpmZBbrOhRBk8cywWTbuIP/Aj7XBXpD5VGwvDdlgmiUVxgwP2aJaHogxl32gNxFShzneB4EMSscy8UdvRESj9Lv2XByAVgJKlyhqKF6bFJdnreAUWXeaOBygH6MRp/2ReztH67WYvw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790266352; c=relaxed/simple; bh=Dy+v5m/UUq3wnpIVAWGMGO4qvOit8N1NSbJpXREBq9g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=J0Jlow0RLKY1AiJGqC5LatdJakvAdFDLvB7C8ctXh3hp6gFomoUboRRBZ5R5vf42R0+eCYZSwbIYzxh+/9c84Kp0UGp7jqbnTm229GB3pMC+EN4WmoBKqVtTlQleFoJZNHBI/e6WWqhN8ZSYwR6kiz3ADCCMVQemUavIQu8azXo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YlvI1w7p; 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="YlvI1w7p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FCA41F00893; Thu, 24 Sep 2026 16:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790266351; bh=NGHRX6O08Yusf7JnKOlfBTindCeqbdKBsaM9+/WLM20=; h=From:To:Cc:Subject:Date:Reply-To; b=YlvI1w7pinwCWs0y5EtseWR6JxmQMI7/t0Ee0gJZmfOAtYIHfwSnjymtzfxxtRBOS tXKu2CDLe1x2RCobdviVvVVBHqh9PJ1UdyrC+09NGH4VgKhZ/fPFDIDOVrA5X5AWhQ r/H1cE7OJS0IhtD6PB1jRmMhppYCAgW2hxEtovuw= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-97420: bpf: NUL-terminate replaced sysctl value Date: Thu, 24 Sep 2026 18:03:20 +0200 Message-ID: <2026092427-CVE-2026-97420-f39b@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=3901; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=OSu71hfSMhS6DnpaMpCUdaBsLB6Th8mSA4EypCzT18s=; b=owGbwMvMwCRo6H6F97bub03G02pJDFlbPScHzpp7MT/P853j9bjnlfZmJg8e3s5c+FNN/HKgu q5DQ8XPjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhIUQzDHJ4Gztk5JUoNbkzn t+096iB2JZGDj2E263mdDZpRr68lVU1rnHPieGxAIdMUAA== 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: NUL-terminate replaced sysctl value When writing to sysctls, proc_sys_call_handler() guarantees that the buffer passed to proc handlers is NUL-terminated. If bpf_sysctl_set_new_value() replaces the pending sysctl value, it can hand a replacement buffer directly to proc handlers. However, the helper currently copies only buf_len bytes into that buffer without appending a NUL terminator, leaving downstream parsers vulnerable to out-of-bounds access. Fix this by appending a '\0' after the replaced value to restore the expected sysctl semantics. Since the helper already rejects buf_len greater than PAGE_SIZE - 1, there is always room for the extra byte. Reproduced in a QEMU x86_64 guest booted with KASAN while exercising the sysctl replacement path with a cgroup/sysctl BPF program. The reproducer targets `/proc/sys/net/core/flow_limit_cpu_bitmap`, fills the original user write buffer with non-zero bytes, and overrides the sysctl value so the replacement buffer lacks a terminating NUL. Under that setup, the pre-fix kernel reported: BUG: KASAN: slab-out-of-bounds in strnchrnul+0x72/0x90 Read of size 1 at addr ffff88800de57000 by task repro_patch3/66 CPU: 0 UID: 0 PID: 66 Comm: repro_patch3 Not tainted 7.1.0-rc3-00269-g8370ca1f87cc #6 PREEMPT(lazy) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x68/0xa0 print_report+0xcb/0x5e0 ? __virt_addr_valid+0x21d/0x3f0 ? strnchrnul+0x72/0x90 ? strnchrnul+0x72/0x90 kasan_report+0xca/0x100 ? strnchrnul+0x72/0x90 strnchrnul+0x72/0x90 bitmap_parse+0x37/0x2e0 flow_limit_cpu_sysctl+0xc6/0x840 ? __pfx_flow_limit_cpu_sysctl+0x10/0x10 ? __kvmalloc_node_noprof+0x5ba/0x870 proc_sys_call_handler+0x31d/0x480 ? __pfx_proc_sys_call_handler+0x10/0x10 ? selinux_file_permission+0x39f/0x500 ? lock_is_held_type+0x9e/0x120 vfs_write+0x98e/0x1000 ... The buggy address is located 0 bytes to the right of allocated 4096-byte region [ffff88800de56000, ffff88800de57000) With this fix applied, rerunning the same sysctl-targeted path yields no corresponding KASAN reports. The Linux kernel CVE team has assigned CVE-2026-97420 to this issue. Affected and fixed versions =========================== Fixed in 6.12.111 with commit 76c14b10f50eb0afcc76e244562fa2d8c661e224 Fixed in 6.18.53 with commit 3b2814dd842a565fcf9cc370156e1ba9eae16239 Fixed in 7.2 with commit a66e3b5bacf38d6ab29fa05a9754f7a114485605 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-97420 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/cgroup.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/76c14b10f50eb0afcc76e244562fa2d8c661e224 https://git.kernel.org/stable/c/3b2814dd842a565fcf9cc370156e1ba9eae16239 https://git.kernel.org/stable/c/a66e3b5bacf38d6ab29fa05a9754f7a114485605