HomeClusterLabs Projects

Low: libservices(sync): partially prevent killing foreign process

Description

Low: libservices(sync): partially prevent killing foreign process

Do not attempt sending SIGKILL to process for which previous
waitpid(pid, &st, WNOHANG) indicated ECHILD issue. This might
be a result of clashing with another thread or an orthogonal
signal handler getting to reap the child first.

For good measure, repeat non-hanging waitpid test right before
killing -- it won't prevent illustrated race, but will limit it
a bit more. That's unlikely, sad path, hence without regularly
imposed performance penalty. And when we can pay more attention
to prevent killing innocent processes (the code in question is
commonly run as root so nothing will prevent that), we should.

Details

Provenance
Jan Pokorný <jpokorny@redhat.com>Authored on Jan 31 2017, 2:49 PM
Parents
rP142169da5951: Low: libservices (sync): ensure no zombie is left behind
Branches
Unknown
Tags
Unknown

Event Timeline