Tobias Stoeckmann 624d57c08c Improve child error handling
Always set SIGCHLD handler to default, even if the caller of vipw has
set SIGCHLD to ignore. If SIGCHLD is ignored no zombie processes would
be created, which in turn could mean that kill is called with an already
recycled pid.

Proof of Concept:

1. Compile nochld:
 --
 #include <signal.h>
 #include <unistd.h>
 int main(void) {
 char *argv[] = { "vipw", NULL };
 signal(SIGCHLD, SIG_IGN);
 execvp("vipw", argv);
 return 1;
 }
 --
2. Run nochld
3. Suspend child vi, which suspends vipw too:
`kill -STOP childpid`
4. Kill vi:
`kill -9 childpid`
5. You can see with ps that childpid is no zombie but disappeared
6. Bring vipw back into foreground
`fg`

The kill call sends SIGCONT to "childpid" which in turn could have been
already recycled for another process.

This is definitely not a vulnerability. It would take super user
operations, at which point an attacker would have already elevated
permissions.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2021-11-14 12:01:32 +01:00
..
2021-08-18 18:06:02 +00:00
2021-09-13 17:23:17 +01:00
2021-08-18 18:06:02 +00:00
2021-09-13 17:23:17 +01:00
2021-09-13 17:23:17 +01:00
2021-08-18 18:06:02 +00:00
2021-09-13 17:23:17 +01:00
2021-09-13 17:23:17 +01:00
2021-09-13 17:23:17 +01:00
2021-08-18 18:06:02 +00:00
2021-08-18 18:06:02 +00:00
2021-11-14 12:01:32 +01:00