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: n/a
EPSS: n/a
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 btf_struct_walk internal helper when a struct contains a flexible array and the code attempts to compute an offset without checking the size of the element type. The bug triggers a kernel panic during BPF program load time, destroying system stability without revealing sensitive data. The failure is caused by an unchecked modulo operation against a zero-sized type, demonstrating a classic Integer Division or Modulo by Zero vulnerability.

Affected Systems

The flaw exists in the Linux kernel, affecting all variants that expose BPF and BTF functionality. Users of any Linux distribution running a kernel that has not yet incorporated the fix are susceptible. The bug was identified in the core kernel source and applies broadly across releases prior to the patch commit.

Risk and Exploitability

Exploitation requires the ability to load a BPF program containing a struct with an empty flexible array—an action generally restricted to users with administrative privileges or the CAP_SYS_ADMIN capability. No publicly available exploit is documented, and the bug is not listed in CISA’s KEV catalog. Because the EPSS score is not available and no known exploits exist, the likelihood of real‑world exploitation is low, but the impact is high if an attacker can load such a program and cause a kernel panic, potentially leading to a denial of service for the target system.

Generated by OpenCVE AI on October 18, 2026 at 19:07 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 upgraded immediately.
  • If an upgrade is not feasible, restrict BPF program loading to users with explicit administrative rights and consider disabling BPF entirely where it is not required.
  • Continuously monitor system logs for BPF‑related Oops messages and apply future security updates as soon as they become available.

Generated by OpenCVE AI on October 18, 2026 at 19:07 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

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-18T15:20:18.360Z

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-18T16:17:17.980

Link: CVE-2026-98647

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-18T19:15:14Z

Weaknesses
  • CWE-368

    Context Switching Race Condition