Description
In the Linux kernel, the following vulnerability has been resolved:

bpf: Fix divide-by-zero in btf_struct_walk()

When an access goes past the struct and the last member is a flexible
array, btf_struct_walk() folds the offset back into a single element with
(off - moff) % t->size, but never checks that the element type has a size.

BTF takes an empty struct, so this in program BTF

/* event could be empty */
struct event {
#ifdef HAVE_TIMESTAMP
__u64 ts;
#endif
};

struct batch {
int nr;
struct event events[];
};

divides by zero at prog load time. Getting there needs a PTR_TO_BTF_ID that
is not MEM_ALLOC, e.g. a plain read of a local kptr stashed in a map from a
sleepable program.

Oops: divide error: 0000 [#1] SMP KASAN PTI
RIP: 0010:btf_struct_walk+0x53f/0x1570
Call Trace:
<TASK>
btf_struct_access+0x42a/0xcd0
check_ptr_to_btf_access+0x4dc/0x1160
check_mem_access+0x3a45/0x8740
check_load_mem+0x36a/0xd10
do_check_common+0x3ef0/0xb210
bpf_check+0x6d3b/0x8580
bpf_prog_load+0xf7c/0x2720
__sys_bpf+0xa83/0x3690
__x64_sys_bpf+0xc7/0x150
x64_sys_call+0x1f3f/0x27e0
do_syscall_64+0xe5/0x610
entry_SYSCALL_64_after_hwframe+0x76/0x7e
</TASK>

Reject a zero-sized element type. The fixed array path in the same function
already bails out on the same thing:

btf_struct_walk()
...
/* skip empty array */
if (moff == mtrue_end)
continue;

msize /= total_nelems;
Published: 2026-10-18
Score: 4.4 Medium
EPSS: < 1% Very Low
KEV: No
Impact: Denial of Service via kernel crash
Action: Apply patch
AI Analysis

Impact

A divide–by–zero error occurs in the Linux kernel’s internal helper btf_struct_walk when loading BPF programs that refer to a struct containing a flexible array with zero size. The function folds an accessed offset back into a single element using the modulo operator without verifying that the element type has non‑zero size, causing a division by zero and kernel panic. This flaw is classified as CWE-369 and results in a denial‑of‑service condition if an attacker can supply a BPF program that triggers the condition.

Affected Systems

The flaw exists in the Linux kernel across all versions that expose BPF and BTF functionality and have not incorporated the patch. Users of any Linux distribution running a kernel prior to the commit that adds the check are affected. The problem originates in the core kernel source, impacting all variants that compile the BPF subsystem.

Risk and Exploitability

The CVSS score of 4.4 places the vulnerability in the medium severity range. Exploitation requires the ability to load a BPF program that proceeds past a struct ending with an empty flexible array, a capability normally available only to privileged users or CAP_SYS_ADMIN. No publicly available exploits are known and the vulnerability is not listed in CISA’s KEV catalog. With an EPSS score of < 1%, the likelihood of real‑world exploitation is low, yet an attacker who can achieve the required privilege can force a kernel panic, causing a denial of service.

Generated by OpenCVE AI on October 23, 2026 at 07:21 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the kernel to a release that includes the btf_struct_walk patch or apply the vendor’s backport if the system cannot be updated immediately.
  • If BPF program loading cannot be avoided, restrict the feature to users with administrative rights or disable BPF entirely where it is not required.
  • Enable kernel logging for BPF‑related Oops messages and review logs regularly for signs of exploitation attempts.

Generated by OpenCVE AI on October 23, 2026 at 07:21 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Debian DLA Debian DLA DLA-4850-1 linux-6.12 security update
Ubuntu USN Ubuntu USN USN-8961-1 Linux kernel vulnerabilities
History

Fri, 23 Oct 2026 00:45:00 +0000

Type Values Removed Values Added
Weaknesses CWE-368

Thu, 22 Oct 2026 12:30:00 +0000

Type Values Removed Values Added
Weaknesses CWE-369
References
Metrics threat_severity

None

cvssV3_1

{'score': 4.4, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H'}

threat_severity

Moderate


Sun, 18 Oct 2026 19:30:00 +0000

Type Values Removed Values Added
Weaknesses CWE-368

Sun, 18 Oct 2026 15:30:00 +0000

Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: bpf: Fix divide-by-zero in btf_struct_walk() When an access goes past the struct and the last member is a flexible array, btf_struct_walk() folds the offset back into a single element with (off - moff) % t->size, but never checks that the element type has a size. BTF takes an empty struct, so this in program BTF /* event could be empty */ struct event { #ifdef HAVE_TIMESTAMP __u64 ts; #endif }; struct batch { int nr; struct event events[]; }; divides by zero at prog load time. Getting there needs a PTR_TO_BTF_ID that is not MEM_ALLOC, e.g. a plain read of a local kptr stashed in a map from a sleepable program. Oops: divide error: 0000 [#1] SMP KASAN PTI RIP: 0010:btf_struct_walk+0x53f/0x1570 Call Trace: <TASK> btf_struct_access+0x42a/0xcd0 check_ptr_to_btf_access+0x4dc/0x1160 check_mem_access+0x3a45/0x8740 check_load_mem+0x36a/0xd10 do_check_common+0x3ef0/0xb210 bpf_check+0x6d3b/0x8580 bpf_prog_load+0xf7c/0x2720 __sys_bpf+0xa83/0x3690 __x64_sys_bpf+0xc7/0x150 x64_sys_call+0x1f3f/0x27e0 do_syscall_64+0xe5/0x610 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK> Reject a zero-sized element type. The fixed array path in the same function already bails out on the same thing: btf_struct_walk() ... /* skip empty array */ if (moff == mtrue_end) continue; msize /= total_nelems;
Title bpf: Fix divide-by-zero in btf_struct_walk()
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References

Subscriptions

Linux Linux Kernel
cve-icon MITRE

Status: PUBLISHED

Assigner: Linux

Published:

Updated: 2026-10-19T09:23:16.870Z

Reserved: 2026-09-25T10:25:14.362Z

Link: CVE-2026-98647

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-10-18T16:17:17.980

Modified: 2026-10-19T10:19:29.113

Link: CVE-2026-98647

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-10-18T00:00:00Z

Links: CVE-2026-98647 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-10-23T07:30:09Z

Weaknesses