{"id":"CVE-2026-98376","state":"PUBLISHED","title":"bpf: Use array_map_meta_equal for percpu array inner map replacement","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Use array_map_meta_equal for percpu array inner map replacement\n\npercpu_array_map_ops.map_meta_equal points to the generic\nbpf_map_meta_equal(), which does not compare max_entries.  When a\npercpu array serves as an inner map, replacing it with one that has\nfewer max_entries bypasses the check.  Since percpu_array_map_gen_lookup()\ninlines the original template's index_mask as a JIT immediate, a lookup\non the replacement map can access pptrs[] out of bounds.\n\nPoint percpu_array_map_ops.map_meta_equal to array_map_meta_equal(),\nwhich already enforces the max_entries equality check.\n\nAdd a selftest to verify that replacing a percpu array inner map with\na differently-sized one is rejected.","publishedAt":"2026-10-09T07:34:17.043Z","updatedAt":"2026-10-24T14:08:36.004Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"db69718b8efac802c7cc20d5a6c7dfc913f99c43","status":"affected","lessThan":"593980175389a05793f6060aa20e626330960395","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/arraymap.c","tools/testing/selftests/bpf/prog_tests/percpu_array_inner_map.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.10","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.10","versionType":"semver"},{"version":"7.1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/arraymap.c","tools/testing/selftests/bpf/prog_tests/percpu_array_inner_map.c"]}],"references":["https://git.kernel.org/stable/c/593980175389a05793f6060aa20e626330960395"],"weaknesses":[],"ingestedAt":"2026-10-29T20:13:43.249Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/98xxx/CVE-2026-98376.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-98376","state":"PUBLISHED","datePublished":"2026-10-09T07:34:17.043Z","dateUpdated":"2026-10-24T14:08:36.004Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-09-25T10:25:14.345Z"},"containers":{"cna":{"title":"bpf: Use array_map_meta_equal for percpu array inner map replacement","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Use array_map_meta_equal for percpu array inner map replacement\n\npercpu_array_map_ops.map_meta_equal points to the generic\nbpf_map_meta_equal(), which does not compare max_entries.  When a\npercpu array serves as an inner map, replacing it with one that has\nfewer max_entries bypasses the check.  Since percpu_array_map_gen_lookup()\ninlines the original template's index_mask as a JIT immediate, a lookup\non the replacement map can access pptrs[] out of bounds.\n\nPoint percpu_array_map_ops.map_meta_equal to array_map_meta_equal(),\nwhich already enforces the max_entries equality check.\n\nAdd a selftest to verify that replacing a percpu array inner map with\na differently-sized one is rejected."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"db69718b8efac802c7cc20d5a6c7dfc913f99c43","status":"affected","lessThan":"593980175389a05793f6060aa20e626330960395","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/arraymap.c","tools/testing/selftests/bpf/prog_tests/percpu_array_inner_map.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.10","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.10","versionType":"semver"},{"version":"7.1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/arraymap.c","tools/testing/selftests/bpf/prog_tests/percpu_array_inner_map.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/593980175389a05793f6060aa20e626330960395"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The local bpf(BPF_MAP_UPDATE_ELEM) path reaches map_update_elem()->bpf_map_update_value()->bpf_fd_array_map_update_elem()->bpf_map_fd_get_ptr(), where the patched percpu_array_map_ops.map_meta_equal validates the replacement map; no network handler supplies its FD or dimensions.\nAC:L - The attacker chooses the template and replacement max_entries, lookup key, program, and trigger; an index below the template limit but beyond the replacement deterministically reads pptrs[] out of bounds. No race or other actor is required on a JIT-enabled x86-64 or arm64 target.\nPR:L - map_create() places PERCPU_ARRAY and ARRAY_OF_MAPS in its unprivileged branch, and bpf_prog_load() permits SOCKET_FILTER without CAP_BPF when unprivileged BPF is enabled; alternatively, a user-namespace BPF token satisfies the gates without init-namespace root.\nUI:N - The attacker creates and replaces the maps, loads the lookup program, attaches it through SO_ATTACH_BPF to their own socket, and sends the triggering data themselves; no victim action is needed.\nS:U - percpu_array_map_gen_lookup() converts the out-of-bounds pptrs[] slot into a pointer used against the same host kernel's memory; this is ordinary kernel privilege escalation, not a guest-to-host, IOMMU, or other security-authority crossing.\nC:H - percpu_array_map_gen_lookup() loads a 64-bit pptrs[index] out of bounds and returns its adjusted value as a verifier-trusted map-value pointer. Because bpf_map_area_alloc() kmallocs the flexible object, map spraying can place chosen bytes at that slot, enabling kernel reads copied into another map.\nI:H - The forged PTR_TO_MAP_VALUE is writable because default map flags grant BPF_MAP_CAN_WRITE; direct BPF stores through an attacker-groomed out-of-bounds pptrs[] value therefore provide an arbitrary kernel-write primitive suitable for control-flow hijacking.\nA:H - Without successful grooming, BPF_MOV64_PERCPU_REG adjusts the garbage pointer loaded beyond pptrs[] and the attacker's next value access dereferences it, causing a kernel oops or panic; the attacker can repeatedly run the same socket-filter program."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-10-24T14:08:36.004Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.10","versionEndExcluding":"7.1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}