qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Enable -Wvla, forbidding use of variable length arrays
@ 2024-01-25 17:32 Peter Maydell
  2024-01-25 17:32 ` [PATCH 1/2] tests/qtest/xlnx-versal-trng-test.c: Drop use of variable length array Peter Maydell
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Peter Maydell @ 2024-01-25 17:32 UTC (permalink / raw)
  To: qemu-devel

For a while now I've had an on-and-off-again campaign to get rid of
the handful of uses of C variable-length-array syntax in our
codebase.  The rationale for this is that if the array size can be
controlled by the guest and we don't get the size limit checking
right, this is an easy to exploit security issue.  (An example
problem of this kind from the past is CVE-2021-3527).  Forbidding
them entirely is a defensive measure against further bugs of this
kind.

I submitted a bunch of patches to this effect last year, and
the result is we're now down to just a single use of VLAs, in
a test program. This patchset removes that last VLA usage,
and enables -Wvla in our warning options, so that we will catch
any future attempts to use this C feature.

thanks
-- PMM

Peter Maydell (2):
  tests/qtest/xlnx-versal-trng-test.c: Drop use of variable length array
  meson: Enable -Wvla

 meson.build                         |  1 +
 tests/qtest/xlnx-versal-trng-test.c | 19 +++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)

-- 
2.34.1



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

end of thread, other threads:[~2024-01-31 20:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-25 17:32 [PATCH 0/2] Enable -Wvla, forbidding use of variable length arrays Peter Maydell
2024-01-25 17:32 ` [PATCH 1/2] tests/qtest/xlnx-versal-trng-test.c: Drop use of variable length array Peter Maydell
2024-01-25 18:59   ` Thomas Huth
2024-01-27 14:38   ` Zhao Liu
2024-01-25 17:32 ` [PATCH 2/2] meson: Enable -Wvla Peter Maydell
2024-01-25 19:00   ` Thomas Huth
2024-01-27 14:38   ` Zhao Liu
2024-01-27  3:41 ` [PATCH 0/2] Enable -Wvla, forbidding use of variable length arrays Richard Henderson
2024-01-31 14:55 ` Thomas Huth
2024-01-31 20:00   ` Peter Maydell

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