A process is created with vfork, whose child shares the parent's memory

tx0/c:vfork-callrecommendedwarningreliability/memory-safetydepth fastsecurity, cwe-662

What it finds

pid = vfork();: the child shares the parent's memory and stack until it calls execve or _exit, and anything else it does, returning from the function, calling exit, changing a variable, is undefined and corrupts the parent. POSIX removed vfork in 2008; fork or posix_spawn do the job safely.

From the rule's source, vfork_call.rs.

Example from the rule's tests
#include <unistd.h> int spawn(char **argv){  int pid = vfork();tx0 reports: the child of vfork runs in the parent's memory  if (pid == 0)    execv(argv[0], argv);  return pid + fork();}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/c:vfork-call" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/c:vfork-call] reason="..."

tx0 explain tx0/c:vfork-call shows the same in the terminal. Found a false positive? Report it.