diff options
author | Tiwei Bie <tiwei.btw@antgroup.com> | 2024-10-24 16:28:25 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2024-10-25 11:34:54 +0200 |
commit | 4e5adbe447db382cc76e05613581f96aef4f91d2 (patch) | |
tree | 37100e2cc0aa051c134fc1f060b44e36423c2d64 /arch/um/os-Linux | |
parent | um: remove PATH_MAX use (diff) | |
download | linux-4e5adbe447db382cc76e05613581f96aef4f91d2.tar.xz linux-4e5adbe447db382cc76e05613581f96aef4f91d2.zip |
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 <tiwei.btw@antgroup.com>
Link: https://patch.msgid.link/20241024142828.2612828-2-tiwei.btw@antgroup.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r-- | arch/um/os-Linux/process.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index f20602e793d9..9f086f939420 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c @@ -12,6 +12,7 @@ #include <fcntl.h> #include <sys/mman.h> #include <sys/ptrace.h> +#include <sys/prctl.h> #include <sys/wait.h> #include <asm/unistd.h> #include <init.h> @@ -203,3 +204,8 @@ void init_new_thread_signals(void) set_handler(SIGIO); signal(SIGWINCH, SIG_IGN); } + +void os_set_pdeathsig(void) +{ + prctl(PR_SET_PDEATHSIG, SIGKILL); +} |