Disable prctl dumpable protection under delve debugging

This commit is contained in:
Bernd Schoolmann 2024-02-12 03:28:56 +01:00
parent cf9f3f33dd
commit 761fb91a8a
No known key found for this signature in database
3 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,6 @@
//go:build delve
// +build delve
package isdelve
const Enabled = true

View file

@ -0,0 +1,6 @@
//go:build !delve
// +build !delve
package isdelve
const Enabled = false

View file

@ -6,13 +6,18 @@ import (
"time"
"github.com/godbus/dbus/v5"
"github.com/quexten/goldwarden/agent/processsecurity/isdelve"
"golang.org/x/sys/unix"
)
const IDLE_TIME = 60 * 15
func DisableDumpable() error {
return unix.Prctl(unix.PR_SET_DUMPABLE, 0, 0, 0, 0)
if isdelve.Enabled {
return nil
} else {
return unix.Prctl(unix.PR_SET_DUMPABLE, 0, 0, 0, 0)
}
}
func MonitorLocks(onlock func()) error {