execve is missing in the list of functions that are allowed after vfork(). As a result, clang analyzer reports the following false positive:
#include <unistd.h> int main(int argc, char *argv[]) { char *a[] = {"true", NULL}; char *e[] = {NULL}; if (vfork() == 0) { execve("/bin/true", a, e); _exit(1); } return 0; }
$ scan-build clang -Wall -c repro.c scan-build: Using '/usr/bin/clang-9' for static analysis repro.c:7:6: warning: Call to function 'vfork' is insecure as it can lead to denial of service situations in the parent process. Replace calls to vfork with calls to the safer 'posix_spawn' function if (vfork() == 0) { ^~~~~ repro.c:8:3: warning: This function call is prohibited after a successful vfork execve("/bin/true", a, e); ^~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. scan-build: 2 bugs found. scan-build: Run 'scan-view /tmp/scan-build-2020-01-29-162705-3770808-1' to examine bug reports.
The list of exec functions in the code is take from the exec(3) man page which are just a fronted for execve(2). Quoting the manual page:
The exec() family of functions replaces the current process image with a new process image. The functions escribed in this manual page are front-ends for execve(2). (See the manual page for execve(2) for further details about the replacement of the current process image.)
Well, this is not the case now, but I wonder if it would also make sense to sort this list alphabetically.