rcu: Improve callback diagnostics and validation
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest10 patches 4 repliesIn review
- v19 patches 12 repliesSuperseded
Changes in v2 from the cover letter
- Patches 7-9: __ratelimit() + dump_stack() instead of hard-coded limit
- Patch 10 (new): same change for Tree RCU's rcu_do_enqueue()
- Patch 9: fixed log format to avoid pseudo-function names
- Tags: Reviewed-by (4-6), Suggested-by (7-10)
- v1: https://lore.kernel.org/all/[email protected]/
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | srcu: Record callback registration stack for KASANkernel/ | +5 | 0 replies | |
| 2/10 | srcutiny: Record callback registration stack for KASANkernel/ | +4 | 0 replies | |
| 3/10 | rcu: Record callback registration stack for Tiny RCUkernel/ | +4 | 0 replies | |
| 4/10 | srcu: Validate callback argumentskernel/ kernel/ | +14 | 0 replies | |
| 5/10 | rcu: Validate callback arguments in Tiny RCUkernel/ | +7 | 0 replies | |
| 6/10 | rcu-tasks: Validate callback argumentskernel/ | +7 | 0 replies | |
| 7/10 | srcu: Detect duplicate callback enqueue at registrationkernel/ | +18 | 0 replies | |
| 8/10 | srcutiny: Detect duplicate callback enqueuekernel/ | +23 | 0 replies | |
| 9/10 | rcu-tasks: Detect duplicate callback enqueuekernel/ | +20 | 0 replies | |
| 10/10 | rcu: Improve duplicate callback diagnosticskernel/ | +7 | 0 replies |
Reviews trailers per patch
3 of 10 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Paul E. McKenney | Joel Fernandes |
|---|---|---|
| Series | R-b | |
| 1/10 | ||
| 2/10 | ||
| 3/10 | ||
| 4/10 | R-b | |
| 5/10 | R-b | |
| 6/10 | R-b | |
| 7/10 | ||
| 8/10 | ||
| 9/10 | ||
| 10/10 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 00/10] rcu: Improve callback diagnostics and validation
Hi,
This series improves callback diagnostics and validation across RCU, SRCU, and RCU Tasks.
Patches 1-3 record callback registration stacks for KASAN in Tree SRCU, Tiny SRCU, and Tiny RCU. KASAN prints the recorded auxiliary stack when reporting a use-after-free.
Patches 4-6 add rcu_head alignment and NULL callback-function checks.
Patches 7-10 detect duplicate callback enqueue attempts before queueing, using the RCU head debug-object mechanism. A duplicate registration is rejected at entry and __ratelimit() controls the diagnostic output group (pr_err, mem_dump_obj, dump_stack). Detection requires CONFIG_DEBUG_OBJECTS_RCU_HEAD.
Changes since v1:
- Patches 7-9: __ratelimit() + dump_stack() instead of hard-coded limit
- Patch 10 (new): same change for Tree RCU's rcu_do_enqueue()
- Patch 9: fixed log format to avoid pseudo-function names
- Tags: Reviewed-by (4-6), Suggested-by (7-10)
- v1: https://lore.kernel.org/all/[email protected]/
Testing:
rcutorture with KASAN (SRCU-N, SRCU-P, SRCU-T, SRCU-U, TINY01, TINY02, TREE03, 3min each): all exitcode 0.
KASAN aux stack (QEMU, CONFIG_KASAN_GENERIC=y):
Last potentially related work creation:
kasan_save_stack+0x33/0x60
kasan_record_aux_stack+0x8c/0xa0
call_srcu+0xb2/0x390 Duplicate enqueue (QEMU, CONFIG_DEBUG_OBJECTS_RCU_HEAD=y):
call_srcu(): Duplicate call_srcu() CB ... ->cb
dump_stack_lvl+0x47/0x60
call_rcu_tasks_generic(): Duplicate CB for RCU Tasks, ... ->cb
dump_stack_lvl+0x47/0x60
rcu_do_enqueue(): Double-freed CB ... ->cb slab kmalloc-16 ...Kunwu Chan (10):
srcu: Record callback registration stack for KASAN
srcutiny: Record callback registration stack for KASAN
rcu: Record callback registration stack for Tiny RCU
srcu: Validate callback arguments
rcu: Validate callback arguments in Tiny RCU
rcu-tasks: Validate callback arguments
srcu: Detect duplicate callback enqueue at registration
srcutiny: Detect duplicate callback enqueue
rcu-tasks: Detect duplicate callback enqueue
rcu: Improve duplicate callback diagnostics
kernel/rcu/srcutiny.c | 34 ++++++++++++++++++++++++++++++++++ kernel/rcu/srcutree.c | 36 ++++++++++++++++++++++++++++++------ kernel/rcu/tasks.h | 27 +++++++++++++++++++++++++++ kernel/rcu/tiny.c | 11 +++++++++++ kernel/rcu/tree.c | 9 +++++++-- 5 files changed, 109 insertions(+), 8 deletions(-)
base-commit: 940793b926aa94bf65ec404043050888e3053188
Signature · 1 line
2.43.0