CVE-2026-139306: bpf: Keep a program until its bpf_wq callback has ended

Published Nov 30, 2026
·
Updated

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

bpf: Keep a program until its bpfwq callback has ended

bpfwqwork() runs the callback under rcureadlocktrace() only, since the callback may sleep. The program it belongs to need not be sleepable, and such a program is freed behind a plain RCU grace period. The reference that the bpfwq holds is dropped when the map element goes, or when another callback is set, no matter whether the work is running.

If that was the last reference the program is freed under the running callback, and the worker goes on in the freed JIT image:

Oops: int3: 0000 [#1] SMP NOPTI RIP: 0010:0xffffffffc0600947

All it takes is to close the map and the program while the callback runs.

Note in the program that it has a callback that runs sleepable, and wait for an RCU Tasks Trace grace period, which implies a plain one, before such a program is freed. Let bpfwqwork() enter its read side critical section before it reads callbackfn.

bpftaskwork holds a reference to the program until the callback is done.

Affected Software

1 affected component
Linux Linux kernel

Event History

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

Frequently Asked Questions

1

What condition is required to trigger the use-after-free?

A BPF workqueue callback must be running while the associated map and program are closed, causing the workqueue-held reference to be dropped. If that is the last program reference, the program can be freed while its callback continues executing in the freed JIT image.

2

Are only sleepable BPF programs affected?

No. The callback can sleep, but the program that owns it does not need to be sleepable. The issue arises because the callback runs under rcu_read_lock_trace(), while a non-sleepable program could be freed after only a plain RCU grace period.

3

What does the fix change?

The fix records that a program has a sleepable-running callback and waits for an RCU Tasks Trace grace period before freeing it. It also ensures bpf_wq_work() enters its read-side critical section before reading callback_fn, and bpf_task_work retains a program reference until the callback completes.

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