All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/6] ALSA: Fix UAF with delayed kobj release
@ 2023-08-07 13:52 Takashi Iwai
  2023-08-07 13:52 ` [PATCH RFC 1/6] ALSA: core: Introduced referenced memory allocator Takashi Iwai
                   ` (7 more replies)
  0 siblings, 8 replies; 24+ messages in thread
From: Takashi Iwai @ 2023-08-07 13:52 UTC (permalink / raw)
  To: alsa-devel; +Cc: Curtis Malainey

Hi,

this is a test patch set for addressing the UAF problems with delayed
kobj releases reported by Curtis:
 https://lore.kernel.org/r/20230801171928.1460120-1-cujomalainey@chromium.org

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(-)

-- 
2.35.3


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2023-08-18  0:42 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-07 13:52 [PATCH RFC 0/6] ALSA: Fix UAF with delayed kobj release Takashi Iwai
2023-08-07 13:52 ` [PATCH RFC 1/6] ALSA: core: Introduced referenced memory allocator Takashi Iwai
2023-08-07 13:52 ` [PATCH RFC 2/6] ALSA: core: Fix potential UAF by delayed kobject release of card_dev Takashi Iwai
2023-08-07 13:52 ` [PATCH 2/6] ALSA: core: Fix race between devres and delayed kobject release for card_dev Takashi Iwai
2023-08-07 13:56   ` Takashi Iwai
2023-08-07 13:52 ` [PATCH RFC 3/6] ALSA: core: Associate memory reference with device initialization Takashi Iwai
2023-08-07 13:52 ` [PATCH RFC 4/6] ALSA: pcm: Release memory with reference Takashi Iwai
2023-08-07 13:52 ` [PATCH RFC 5/6] ALSA: control: Reference card by ctl_dev Takashi Iwai
2023-08-07 13:52 ` [PATCH RFC 6/6] ALSA: compress: Reference card by the device Takashi Iwai
2023-08-07 22:34 ` [PATCH RFC 0/6] ALSA: Fix UAF with delayed kobj release Curtis Malainey
2023-08-08 19:26   ` Curtis Malainey
2023-08-09  8:10     ` Takashi Iwai
2023-08-09 13:27       ` Takashi Iwai
2023-08-09 21:11         ` Curtis Malainey
2023-08-13  8:08           ` Takashi Iwai
2023-08-14 20:20             ` Curtis Malainey
2023-08-15 16:07               ` Takashi Iwai
2023-08-15 21:32                 ` Curtis Malainey
2023-08-16  5:35                   ` Takashi Iwai
2023-08-16  5:47                     ` Takashi Iwai
2023-08-16 21:46                     ` Curtis Malainey
2023-08-17  6:21                       ` Takashi Iwai
2023-08-17 17:25                         ` Curtis Malainey
2023-08-18  0:41                           ` Curtis Malainey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.