From 584732f80ab91afb349720cfb8e9979ed2ba173e Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Sat, 2 Nov 2024 03:03:44 +0900 Subject: cmd: shim and init into separate binaries This change also fixes a deadlock when shim fails to connect and complete the setup. Signed-off-by: Ophestra Umiker --- internal/prctl.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 internal/prctl.go (limited to 'internal/prctl.go') diff --git a/internal/prctl.go b/internal/prctl.go new file mode 100644 index 00000000..1c03edd9 --- /dev/null +++ b/internal/prctl.go @@ -0,0 +1,20 @@ +package internal + +import "syscall" + +func PR_SET_DUMPABLE__SUID_DUMP_DISABLE() error { + // linux/sched/coredump.h + if _, _, errno := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_DUMPABLE, 0, 0); errno != 0 { + return errno + } + + return nil +} + +func PR_SET_PDEATHSIG__SIGKILL() error { + if _, _, errno := syscall.AllThreadsSyscall(syscall.SYS_PRCTL, syscall.PR_SET_PDEATHSIG, uintptr(syscall.SIGKILL), 0); errno != 0 { + return errno + } + + return nil +} -- cgit v1.3.1