UDP sendto fails with EFAULT (bad address) when buf is nullptr but len is also 0
Host environment
- Operating system: Ubuntu 25.04
- OS/kernel version: 6.14.0-28-generic #28-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 23 12:05:14 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
- Architecture: x86_64
- QEMU flavor: qemu-arm64-static
- QEMU version: qemu-aarch64 version 9.2.1 (Debian 1:9.2.1+ds-1ubuntu5)
- QEMU command line: used via binfmt
Emulated/Virtualized environment
- Operating system: Same as host
- OS/kernel version: Same as host
- Architecture: ARM64
Description of problem
For UDP sockets, sendto syscalls fail with EFAULT (bad address) when trying to specify buf = nullptr with len = 0.
No validation of / access to buf should occur when len is 0.
Steps to reproduce
- Try to send on an UDP socket with
sendto(socket, nullptr, 0, ...)
Additional information
Edited by Andreas Ringlstetter