Skip to content

misc: Remove variable-length arrays on the stack

Philippe Mathieu-Daudé kvm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest23 patches 39 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23block/vpc: Avoid dynamic stack allocationblock/vpc.c+2 -20 replies
2/23chardev/baum: Replace magic values by X_MAX / Y_MAX definitionschardev/baum.c+7 -42 replies
3/23chardev/baum: Use definitions to avoid dynamic stack allocationchardev/baum.c+4 -43 replies
4/23chardev/baum: Avoid dynamic stack allocationchardev/baum.c+2 -12 replies
5/23io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1io/channel-websock.c+1 -11 reply
6/23hw/block/dataplane/virtio-blk: Avoid dynamic stack allocationhw/block/dataplane/virtio-blk.c+4 -35 replies
7/23hw/block/nvme: Use definition to avoid dynamic stack allocationhw/block/nvme.c+1 -19 replies
8/23hw/block/nvme: Avoid dynamic stack allocationhw/block/nvme.c+8 -71 reply
9/23hw/net/e1000e_core: Use definition to avoid dynamic stack allocationhw/net/e1000e_core.c+4 -32 replies
10/23hw/ppc/pnv: Avoid dynamic stack allocationhw/ppc/pnv.c hw/ppc/spapr.c hw/ppc/spapr_pci_nvlink2.c+7 -71 reply
11/23hw/intc/xics: Avoid dynamic stack allocationhw/intc/xics.c+1 -13 replies
12/23hw/i386/multiboot: Avoid dynamic stack allocationhw/i386/multiboot.c+2 -31 reply
13/23hw/usb/hcd-xhci: Avoid dynamic stack allocationhw/usb/hcd-xhci.c+1 -11 reply
14/23hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocationhw/usb/hcd-ohci.c+4 -31 reply
15/23net: Avoid dynamic stack allocationhw/net/fsl_etsec/rings.c hw/net/rocker/rocker_of_dpa.c net/dump.c +1 more+7 -82 replies
16/23ui/curses: Avoid dynamic stack allocationui/curses.c+1 -11 reply
17/23ui/spice-display: Avoid dynamic stack allocationui/spice-display.c+1 -10 replies
18/23ui/vnc-enc-hextile: Use definitions to avoid dynamic stack allocationui/vnc-enc-hextile-template.h+2 -11 reply
19/23ui/vnc-enc-tight: Avoid dynamic stack allocationui/vnc-enc-tight.c+6 -50 replies
20/23util/iov: Avoid dynamic stack allocationutil/iov.c+1 -10 replies
21/23target/ppc/kvm: Avoid dynamic stack allocationtarget/ppc/kvm.c+1 -11 reply
22/23tests/unit/test-vmstate: Avoid dynamic stack allocationtests/unit/test-vmstate.c+3 -41 reply
23/23configure: Prohibit variable-length allocations by using -Wvla CPPFLAGconfigure+1 -11 reply

Reviews trailers per patch

15 of 23 patches have a Reviewed-by or Acked-by.

PatchGerd HoffmannSamuel ThibaultMarc-André LureauDavid GibsonJason WangKlaus JensenGreg KurzDaniel P. BerrangéRichard Henderson
1/23
2/23R-b R-b
3/23R-b R-b
4/23R-b R-b
5/23R-b
6/23
7/23R-b
8/23
9/23A-b R-b
10/23A-b
11/23A-b R-b
12/23R-b
13/23
14/23R-b
15/23A-b A-b
16/23R-b
17/23
18/23
19/23
20/23
21/23A-b
22/23R-b
23/23Inspired-by R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 9 reviewers.

Read the v1 thread

Cover letter [PATCH 00/23] misc: Remove variable-length arrays on the stack

Hi,

This series is inspired by Gerd Hoffmann and CVE-2021-3527. It removes all uses of variable-length arrays in the repository, then enable the '-Wvla' warning to avoid new code using vla to be merged.

Mostly trivial patches using GLib autofree.

Please review,

Phil.

(based on usb-20210505-pull-request tag)
Based-on: [email protected]

Philippe Mathieu-Daudé (23):
block/vpc: Avoid dynamic stack allocation
chardev/baum: Replace magic values by X_MAX / Y_MAX definitions chardev/baum: Use definitions to avoid dynamic stack allocation chardev/baum: Avoid dynamic stack allocation io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1 hw/block/dataplane/virtio-blk: Avoid dynamic stack allocation hw/block/nvme: Use definition to avoid dynamic stack allocation hw/block/nvme: Avoid dynamic stack allocation hw/net/e1000e_core: Use definition to avoid dynamic stack allocation hw/ppc/pnv: Avoid dynamic stack allocation
hw/intc/xics: Avoid dynamic stack allocation hw/i386/multiboot: Avoid dynamic stack allocation hw/usb/hcd-xhci: Avoid dynamic stack allocation hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation
net: Avoid dynamic stack allocation
ui/curses: Avoid dynamic stack allocation ui/spice-display: Avoid dynamic stack allocation ui/vnc-enc-hextile: Use definitions to avoid dynamic stack allocation ui/vnc-enc-tight: Avoid dynamic stack allocation
util/iov: Avoid dynamic stack allocation
target/ppc/kvm: Avoid dynamic stack allocation tests/unit/test-vmstate: Avoid dynamic stack allocation
configure: Prohibit variable-length allocations by using -Wvla CPPFLAG

 configure                       |  2 +-
 ui/vnc-enc-hextile-template.h   |  3 ++-
 block/vpc.c                     |  4 ++--
 chardev/baum.c                  | 22 +++++++++++++---------
 hw/block/dataplane/virtio-blk.c |  7 ++++---
 hw/block/nvme.c                 | 17 +++++++++--------
 hw/i386/multiboot.c             |  5 ++---
 hw/intc/xics.c                  |  2 +-
 hw/net/e1000e_core.c            |  7 ++++---
 hw/net/fsl_etsec/rings.c        |  9 ++++-----
 hw/net/rocker/rocker_of_dpa.c   |  2 +-
 hw/ppc/pnv.c                    |  4 ++--
 hw/ppc/spapr.c                  |  8 ++++----
 hw/ppc/spapr_pci_nvlink2.c      |  2 +-
 hw/usb/hcd-ohci.c               |  7 ++++---
 hw/usb/hcd-xhci.c               |  2 +-
 io/channel-websock.c            |  2 +-
 net/dump.c                      |  2 +-
 net/tap.c                       |  2 +-
 target/ppc/kvm.c                |  2 +-
 tests/unit/test-vmstate.c       |  7 +++----
 ui/curses.c                     |  2 +-
 ui/spice-display.c              |  2 +-
 ui/vnc-enc-tight.c              | 11 ++++++-----
 util/iov.c                      |  2 +-
 25 files changed, 71 insertions(+), 64 deletions(-)
Signature · 1 line
2.26.3