Warn for execve syscall with argv or argv[0] being NULL.
commit8eb547054a051a00742b1b9e1b381015fafeacb9
authorMark Wielaard <mark@klomp.org>
Wed, 16 Feb 2022 21:56:31 +0000 (16 22:56 +0100)
committerMark Wielaard <mark@klomp.org>
Wed, 6 Apr 2022 20:48:45 +0000 (6 22:48 +0200)
tree5102a017b9d2a499ab4457f7b8684fc14624fc58
parentf540c79937c6348d3cb5508f83fee0c9def73d11
Warn for execve syscall with argv or argv[0] being NULL.

For execve valgrind would silently fail when argv was NULL or
unadressable. Make sure that this produces a warning under memcheck.

The linux kernel accepts argv[0] being NULL, but most other kernels
don't since posix says it should be non-NULL and it causes argc to
be zero which is unexpected and might cause security issues.

This adjusts some testcases so they don't rely on execve succeeding
when argv is NULL and expect warnings about argv or argv[0] being
NULL or unaddressable.

https://bugs.kde.org/show_bug.cgi?id=450437
NEWS
coregrind/m_syswrap/syswrap-generic.c
memcheck/tests/arm64-linux/scalar.stderr.exp
memcheck/tests/execve1.c
memcheck/tests/execve1.stderr.exp
memcheck/tests/execve2.stderr.exp
memcheck/tests/linux/sys-execveat.stderr.exp
memcheck/tests/x86-linux/scalar.c
memcheck/tests/x86-linux/scalar.stderr.exp
none/tests/execve.c