CVE-2026-139204: bpf: Track borrowed iterator results by default

Published Nov 30, 2026
·
Updated

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

bpf: Track borrowed iterator results by default

An open-coded iterator can return a struct pointer borrowed from its current element. The verifier has not tied such results to iterator state since the taskvma iterator was introduced, so a saved result can still be used after destroy. Commit bee9ef4a40a27 ("bpf: switch taskvma iterator from mmaplock to per-VMA locks") also made next release the protection of the prior element. A later snapshot conversion made vmfile explicitly borrowed from that element.

Associate non-RCU, non-acquired struct results with the iterator reference by default. Invalidate dependents before next forks its NULL and non-NULL paths, while retaining the iterator itself. Let destroy propagate child-reference errors. Add KFITERRETINDEPENDENT for results that outlive the current element, preserving existing RCU and acquired-reference rules.

Trusted pointer field loads also need to preserve the source lifetime. Loading a trusted field does not acquire a reference to the pointed-to object. Set the field pointer's parentid to the source's reference ID if the source is referenced, or inherit its parentid if it is borrowed. This is a generic rule, including accesses unrelated to iterators. For example, the following access is now rejected:

file = bpfgettaskexefile(task); if (!file) return 0; inode = file->finode; bpfputfile(file); ino = inode->iino;

The inode pointer borrows the file's lifetime. Releasing the acquired file reference removes that lifetime guarantee, so the verifier must invalidate the derived inode pointer as well. This does not imply that bpfputfile() immediately frees the file or inode. Reading the inode while the file reference is held remains valid. Fields with independent RCU protection retain their existing lifetime rules.

For an iterator result, the same propagation keeps trusted fields such as vmfile and finode tied to the current element. Propagate the backing object's lifetime through dynptr construction too, so its descendants remain in the invalidation graph. Share the invalidation traversal between next and release, so advancing the iterator preserves its own reference.

Affected Software

1 affected component
Linux Linux kernel

Event History

Nov 30, 2026
CVE Published
via MITRE·01:32 PM
Data Sourced
via MITRE·01:32 PM
Description

Frequently Asked Questions

1

Are iterator results that outlive the current element affected by the new lifetime tracking?

Results explicitly marked with KF_ITER_RET_INDEPENDENT are excluded because they are intended to outlive the current element. Existing handling for RCU and acquired references is also preserved.

2

Does loading a trusted pointer field acquire a reference to the pointed-to object?

No. A trusted field load does not acquire a reference; when its source is referenced, the loaded field pointer inherits the source reference lifetime.

3

When are dependent iterator results invalidated?

Dependents are invalidated before the iterator's next operation branches into its NULL and non-NULL paths. The iterator itself is retained, while destroy propagates child-reference errors.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203