qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] audio/jackaudio: avoid dynamic stack allocations
@ 2023-08-18 15:58 Peter Maydell
  2023-08-18 15:58 ` [PATCH 1/2] audio/jackaudio: Avoid dynamic stack allocation in qjack_client_init Peter Maydell
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Peter Maydell @ 2023-08-18 15:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Christian Schoenebeck

This patchset removes two variable length arrays from the jack audio
backend.  The codebase has very few VLAs, and if we can get rid of
them all we can make the compiler error on new additions.  This is a
defensive measure against security bugs where an on-stack dynamic
allocation isn't correctly size-checked (e.g.  CVE-2021-3527).

The first one is fairly straightforward (although the JACK API's
requirement that (a) you don't pass it an overlong client name and
(b) that maximum length is provided by calling a function, not as a
compile time constant makes it a little less clean than it might be.

The second one avoids the dynamic allocation, but if the audio
subsystem has a compile-time upper bound on the number of
channels then we could use a fixed-size stack array rather than
the awkward "allocate a working buffer at init time" that I
have in this patch. Suggestions for improvements welcome.

Disclaimer: tested only with "make check", which doesn't actually
exercise the audio subsystem.

thanks
-- PMM

Peter Maydell (2):
  audio/jackaudio: Avoid dynamic stack allocation in qjack_client_init
  audio/jackaudio: Avoid dynamic stack allocation in qjack_process()

 audio/jackaudio.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

-- 
2.34.1



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

end of thread, other threads:[~2023-09-18  7:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-18 15:58 [PATCH 0/2] audio/jackaudio: avoid dynamic stack allocations Peter Maydell
2023-08-18 15:58 ` [PATCH 1/2] audio/jackaudio: Avoid dynamic stack allocation in qjack_client_init Peter Maydell
2023-08-21  7:12   ` Francisco Iglesias
2023-08-21  8:01   ` Christian Schoenebeck
2023-08-21 10:00     ` Peter Maydell
2023-08-18 15:58 ` [PATCH 2/2] audio/jackaudio: Avoid dynamic stack allocation in qjack_process() Peter Maydell
2023-08-21  8:16   ` Francisco Iglesias
2023-08-22 13:56   ` Christian Schoenebeck
2023-08-21  7:48 ` [PATCH 0/2] audio/jackaudio: avoid dynamic stack allocations Marc-André Lureau
2023-09-12 14:19 ` Peter Maydell
2023-09-18  7:20   ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).