//go:build linux package cosign import ( "fmt" "syscall" ) // undumpable makes the process non-dumpable (prctl PR_SET_DUMPABLE 0): // another process of the same user can't ptrace it or read its // /proc//mem, environ or fds, which would give it the keys the // co-signer holds in memory, and it leaves no core dump. A build's // container runs as the same user, and Fedora lets a user's processes // ptrace each other (kernel.yama.ptrace_scope 0). func undumpable() error { if _, _, errno := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_DUMPABLE, 0, 0); errno != 0 { return fmt.Errorf("making the process non-dumpable: %w", errno) } return nil }