]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
um: Set parent death signal for winch thread/process
authorBenjamin Berg <benjamin.berg@intel.com>
Thu, 19 Sep 2024 12:45:05 +0000 (14:45 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 10 Oct 2024 11:37:21 +0000 (13:37 +0200)
The winch "thread" is really a separate process. Using prctl to set
PR_SET_PDEATHSIG ensures that this separate thread will be killed if the
UML kernel itself dies unexpectedly and does not perform proper cleanup.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://patch.msgid.link/20240919124511.282088-5-benjamin@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/um/drivers/chan_user.c

index a66e556012c4840fb629aa26dd82641d15dd185f..1434114b2f34dd5ea6f04b548c6a604dc95965a8 100644 (file)
@@ -10,6 +10,7 @@
 #include <signal.h>
 #include <termios.h>
 #include <sys/ioctl.h>
+#include <sys/prctl.h>
 #include "chan_user.h"
 #include <os.h>
 #include <um_malloc.h>
@@ -161,6 +162,8 @@ static __noreturn int winch_thread(void *arg)
        int count;
        char c = 1;
 
+       prctl(PR_SET_PDEATHSIG, SIGKILL);
+
        pty_fd = data->pty_fd;
        pipe_fd = data->pipe_fd;
        count = write(pipe_fd, &c, sizeof(c));