lib/vsprintf: Validate spinlock context during restricted pointer formatting
Get series with b4
b4 am 20260608-restricted-pointers-final-v4-0-9a436615799e@linutronix.de change-id 20260107-restricted-pointers-final-cd24979fd752Versions newest first
- v4 Latest5 patches 7 repliesIn review
- v35 patches 2 repliesSuperseded
- v24 patches 3 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 1 patch | 11 replies | Superseded |
Changes in v4 from the cover letter
- Pick up review from Petr.
- Check in_task() before LD_WAIT_CONFIG.
- Make commit message slightly clearer.
- Reorder patches to avoid problematic temporary states.
- Link to v3: https://patch.msgid.link/20260520-restricted-pointers-final-v3-0-76bca6a6ab3f@linutronix.de
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | locking/lockdep: Add a helper to validate the locking context without a lockinclude/ | +8 | 0 replies | |
| 2/5 | locking/lockdep: Add a guard for lock_map_acquire()include/ | +3 | 0 replies | |
| 3/5 | lib/vsprintf: Use in_task() for restricted pointer context checklib/ | +1 | 0 replies | |
| 4/5 | lib/vsprintf: Always check interrupt context restrictionslib/ | +3 | 0 replies | |
| 5/5 | lib/vsprintf: Validate spinlock context during restricted pointer formattinglib/ | +7 | 7 replies |
Reviews trailers per patch
1 of 5 patches has a Reviewed-by or Acked-by.
| Patch | Petr Mladek |
|---|---|
| 1/5 | |
| 2/5 | |
| 3/5 | |
| 4/5 | |
| 5/5 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v4 0/5] lib/vsprintf: Validate spinlock context during restricted pointer formatting
Depending on the system configuration, the restricted pointer formatting might call into the security subsystem which takes spinlocks, which might sleep under PREEMPT_RT. As %pK is intended to be only used from read handlers of virtual files, which always run in task context, this should not be a problem in practice.
However, developers have used %pK before from atomic context without realizing this restriction.
Add a lockdep annotation to unconditionally introduce a fake spinlock in restricted_pointer(), so lockdep can detect misuse even if the current test system configuration would not exhibit the issue.
---
Changes in v4:
- Pick up review from Petr.
- Check in_task() before LD_WAIT_CONFIG.
- Make commit message slightly clearer.
- Reorder patches to avoid problematic temporary states.
- Link to v3: https://patch.msgid.link/20260520-restricted-pointers-final-v3-0-76bca6a6ab3f@linutronix.de
Changes in v3:
- Use in_task() over its open-coded inverse.
- Also switch the existing check over to it.
- Link to v2: https://patch.msgid.link/20260504-restricted-pointers-final-v2-0-4934933503e5@linutronix.de
Changes in v2:
- Use custom lock_map over might_sleep()
- Also assert IRQ context
- Link to v1: https://lore.kernel.org/r/20260317-restricted-pointers-final-v1-1-b4dca0ed6483@linutronix.de
To: Andrew Morton <[email protected]>
To: Petr Mladek <[email protected]>
To: Steven Rostedt <[email protected]>
To: Andy Shevchenko <[email protected]>
To: Rasmus Villemoes <[email protected]>
To: Sergey Senozhatsky <[email protected]>
To: Peter Zijlstra <[email protected]>
To: Ingo Molnar <[email protected]>
To: Will Deacon <[email protected]>
To: Boqun Feng <[email protected]>
To: Waiman Long <[email protected]>
To: Sebastian Andrzej Siewior <[email protected]>
To: Clark Williams <[email protected]>
To: Kees Cook <[email protected]>
---
Thomas Weißschuh (5):
locking/lockdep: Add a helper to validate the locking context without a lock locking/lockdep: Add a guard for lock_map_acquire() lib/vsprintf: Use in_task() for restricted pointer context check lib/vsprintf: Always check interrupt context restrictions lib/vsprintf: Validate spinlock context during restricted pointer formatting
include/linux/lockdep.h | 11 +++++++++++ lib/vsprintf.c | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-)
---
base-commit: d870b998ed2e4184cbe312f4a4e2fd60d1360caf
change-id: 20260107-restricted-pointers-final-cd24979fd752
Best regards,
Signature · 1 line
Thomas Weißschuh <[email protected]>