Prevent kcheckpass from becoming an orphan

Authored by graesslin on Apr 23 2017, 8:35 AM.



With the long running kcheckpass there is the possibility that
kcheckpass becomes an orphan. Kcheckpass terminates once it gets
SIGUSR2 sent from the parent process (that is kscreenlocker_greet).

If kscreenlocker_greet crashes it cannot send SIGUSR2 to kcheckpass and
thus kcheckpass becomes an orphan. This can easily be seen in the
killTest autotest which results in many orphaned kcheckpass processes
after execution.

This change uses the linux specific PR_SET_PDEATHSIG to send SIGUSR2 to
kcheckpass when the parent process dies. Thus kcheckpass can get out of
the waiting and terminate without becoming an orphan.

In this case it is not a problem to use a linux specific syscall. The
long running kcheckpass is only used if kscreenlocker is built with
seccomp support which is also linux specific.

Test Plan

Run killTest and check the number of orphaned kcheckpass.
Without this change we had 17 orphaned processes, with this change none.

Diff Detail

R133 KScreenLocker
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
graesslin created this revision.Apr 23 2017, 8:35 AM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 23 2017, 8:35 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart accepted this revision.Apr 24 2017, 12:20 PM
This revision is now accepted and ready to land.Apr 24 2017, 12:20 PM
This revision was automatically updated to reflect the committed changes.