Skip to content

Commit 4e5adbe

Browse files
btw616jmberg-intel
authored andcommitted
um: Add os_set_pdeathsig helper function
This helper can be used to set the parent-death signal of the calling process to SIGKILL to ensure that the process will be killed if the UML kernel dies unexpectedly without proper cleanup. This helper will be used in the follow-up patches. Signed-off-by: Tiwei Bie <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent d61ac4a commit 4e5adbe

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

arch/um/include/shared/os.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ extern int os_drop_memory(void *addr, int length);
216216
extern int can_drop_memory(void);
217217
extern int os_mincore(void *addr, unsigned long len);
218218

219+
void os_set_pdeathsig(void);
220+
219221
/* execvp.c */
220222
extern int execvp_noalloc(char *buf, const char *file, char *const argv[]);
221223
/* helper.c */

arch/um/os-Linux/process.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <fcntl.h>
1313
#include <sys/mman.h>
1414
#include <sys/ptrace.h>
15+
#include <sys/prctl.h>
1516
#include <sys/wait.h>
1617
#include <asm/unistd.h>
1718
#include <init.h>
@@ -203,3 +204,8 @@ void init_new_thread_signals(void)
203204
set_handler(SIGIO);
204205
signal(SIGWINCH, SIG_IGN);
205206
}
207+
208+
void os_set_pdeathsig(void)
209+
{
210+
prctl(PR_SET_PDEATHSIG, SIGKILL);
211+
}

0 commit comments

Comments
 (0)