Fix sleepable context tracking for async callbacks
Status from this message: This series was applied to bpf/bpf-next.git (master)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest3 patches 5 repliesApplied 3/3
- v13 patches 10 repliesSuperseded
Changes in v2 from the cover letter
v1: https://lore.kernel.org/bpf/[email protected]
* Squash fix for GFP flags into 1st commit. (Eduard)
* Add a commit refactoring func_atomic to non_sleepable, make it generic, also set for kfuncs in addition to helpers. (Eduard)
* Leave selftest as-is, coverage for global subprogs calling sleepable kfuncs or helpers is provided in rcu_read_lock.c.
Patches in v2 All 3 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | bpf: Fix sleepable context for async callbackskernel/ | +30 | 0 replies | Applied |
| 2/3 | bpf: Refactor storage_get_func_atomic to generic non_sleepable flaginclude/ kernel/ | +18 | 2 replies | Applied |
| 3/3 | selftests/bpf: Add tests for async cb contexttools/ tools/ | +183 | 3 replies | Applied |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Eduard Zingerman | Mykyta Yatsenko |
|---|---|---|
| 1/3 | A-b | |
| 2/3 | A-b | A-b |
| 3/3 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH bpf-next v2 0/3] Fix sleepable context tracking for async callbacks
Currently, asynchronous execution primitives set up their callback execution simulation using push_async_cb, which will end up inheriting the sleepable or non-sleepable bit from the program triggering the simulation of the callback. This is incorrect, as the actual execution context of the asynchronous callback has nothing to do with the program arming its execution.
This set fixes this oversight, and supplies a few test cases ensuring the correct behavior is tested across different types of primitives (i.e. timer, wq, task_work).
While looking at this bug, it was noticed that the GFP flag setting logic for storage_get helpers is also broken, hence fix it while we are at it.
PSA: These fixes and unit tests were primarily produced by prompting an AI assistant (Claude), and then modified in minor ways, in an exercise to understand how useful it can be at general kernel development tasks.
Changelog:
----------
v1 -> v2
v1: https://lore.kernel.org/bpf/[email protected]
* Squash fix for GFP flags into 1st commit. (Eduard)
* Add a commit refactoring func_atomic to non_sleepable, make it generic, also set for kfuncs in addition to helpers. (Eduard)
* Leave selftest as-is, coverage for global subprogs calling sleepable kfuncs or helpers is provided in rcu_read_lock.c.
Kumar Kartikeya Dwivedi (3):
bpf: Fix sleepable context for async callbacks
bpf: Refactor storage_get_func_atomic to generic non_sleepable flag selftests/bpf: Add tests for async cb context
include/linux/bpf_verifier.h | 2 +- kernel/bpf/verifier.c | 54 ++++-- .../selftests/bpf/prog_tests/verifier.c | 2 + .../bpf/progs/verifier_async_cb_context.c | 181 ++++++++++++++++++ 4 files changed, 221 insertions(+), 18 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/verifier_async_cb_context.c
base-commit: 0db4941d9dae159d887e7e2eac7e54e60c3aac87
Signature · 1 line
2.51.0