RFC ALSA: Fix UAF with delayed kobj release
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest6 patches 16 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | ALSA: core: Introduced referenced memory allocatorinclude/ sound/ | +63 | 0 replies | |
| 2/6 | ALSA: core: Fix race between devres and delayed kobject release for card_devsound/ | +22 | 1 reply | |
| 2/6 | ALSA: core: Fix potential UAF by delayed kobject release of card_devsound/ | +22 | 0 replies | |
| 3/6 | ALSA: core: Associate memory reference with device initializationinclude/ sound/ sound/ +6 more | +14 | 0 replies | |
| 4/6 | ALSA: pcm: Release memory with referencesound/ | +3 | 0 replies | |
| 5/6 | ALSA: control: Reference card by ctl_devsound/ | +1 | 0 replies | |
| 6/6 | ALSA: compress: Reference card by the devicesound/ | +1 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH RFC 0/6] ALSA: Fix UAF with delayed kobj release
Hi,
this is a test patch set for addressing the UAF problems with delayed kobj releases reported by Curtis:
https://lore.kernel.org/r/[email protected]
The patch introduced a simple helper for allocating memory with a refcount, and converts the card object, control, PCM and compress objects with the new type. With the refcount, the actual memory release is delayed until all referrer are gone.
It's just a RFC and only lightly tested. I myself am not sure whether this is the best way to go. It might be better to take Curtis' approach, just converting the device to its own allocation, too. (But I don't know whether Curtis' patch set covers all cases -- can still be a UAF of card_dev due to devres vs kobj release?)
thanks,
Takashi
===
Takashi Iwai (6):
ALSA: core: Introduced referenced memory allocator
ALSA: core: Fix potential UAF by delayed kobject release of card_dev
ALSA: core: Associate memory reference with device initialization
ALSA: pcm: Release memory with reference
ALSA: control: Reference card by ctl_dev
ALSA: compress: Reference card by the device
include/sound/core.h | 7 ++- sound/core/compress_offload.c | 2 +- sound/core/control.c | 2 +- sound/core/hwdep.c | 2 +- sound/core/init.c | 105 +++++++++++++++++++++++++++------ sound/core/pcm.c | 6 +- sound/core/rawmidi.c | 2 +- sound/core/seq/seq_clientmgr.c | 2 +- sound/core/timer.c | 2 +- 9 files changed, 101 insertions(+), 29 deletions(-)
Signature · 1 line
2.35.3