CV-Bowen opened a new pull request, #21444: URL: https://github.com/apache/nuttx/pull/21444
## Summary virtio-net puts its link layer header (`struct virtio_net_llhdr_s`) right before the Ethernet header, inside `CONFIG_NET_LL_GUARDSIZE`. The build time check only reserves `ETH_HDRLEN` (14) for the Ethernet header, but with `CONFIG_NET_VLAN` the header is `ETH_8021Q_HDRLEN` (18). A guard that passes the check can then be 4 bytes short, and the llhdr is written in front of the IOB data. Check against the VLAN header size when VLAN is enabled. ## Impact Build time check only. A configuration with `CONFIG_NET_VLAN=y` and a guard too small for virtio-net now fails to build instead of corrupting memory. No in-tree defconfig enables both `CONFIG_DRIVERS_VIRTIO_NET` and `CONFIG_NET_VLAN`. ## Testing Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205 qemu-armv8a:netnsh (64-bit, llhdr is 18 bytes) with `CONFIG_NET_VLAN=y`: | `CONFIG_NET_LL_GUARDSIZE` | master | this PR | |---|---|---| | 32 (netnsh default) | builds | `drivers/virtio/virtio-net.c:154:1: error: static assertion failed: "CONFIG_NET_LL_GUARDSIZE cannot be less than VIRTIO_NET_ETH_HDRSIZE + VIRTIO_NET_LLHDRSIZE"` | | 36 | builds | builds | VLAN traffic over virtio-net was not run. Baseline: No regression in rpmsg: sim:rpserver/rpproxy and qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC disabled, which current master needs for nxinit to start nsh there; unrelated to this change. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
