[PATCH v9 03/10] um: Set parent death signal for userspace process

Benjamin Berg benjamin at sipsolutions.net
Thu Sep 19 05:45:04 PDT 2024


From: Benjamin Berg <benjamin.berg at intel.com>

Enable PR_SET_PDEATHSIG so that the UML userspace process will be killed
when the kernel exits unexpectedly.

Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
 arch/um/kernel/skas/stub_exe.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/um/kernel/skas/stub_exe.c b/arch/um/kernel/skas/stub_exe.c
index bc6ba2e4d805..04f75c577f1a 100644
--- a/arch/um/kernel/skas/stub_exe.c
+++ b/arch/um/kernel/skas/stub_exe.c
@@ -32,6 +32,9 @@ noinline static void real_init(void)
 	/* set a nice name */
 	stub_syscall2(__NR_prctl, PR_SET_NAME, (unsigned long)"uml-userspace");
 
+	/* Make sure this process dies if the kernel dies */
+	stub_syscall2(__NR_prctl, PR_SET_PDEATHSIG, SIGKILL);
+
 	/* read information from STDIN and close it */
 	res = stub_syscall3(__NR_read, 0,
 			    (unsigned long)&init_data, sizeof(init_data));
-- 
2.46.0




More information about the linux-um mailing list