aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-06-09 18:08:17 +0900
committerOphestra <cat@gensokyo.uk>2026-06-09 18:08:17 +0900
commit928a9f61e92b1570a81d005e1c2e7e849336856f (patch)
treeba47cd889d0a4eb3a85f633f1b4ba39c40f3cb08 /cmd
parentce06539ecaf07b5fe572b3c190b69bd01aaa7c93 (diff)
cmd/hsu: remove parent check
This check serves no real purpose and only makes it more difficult to start containers. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/hsu/main.go24
1 files changed, 1 insertions, 23 deletions
diff --git a/cmd/hsu/main.go b/cmd/hsu/main.go
index 2acc8d4c..2a4eb6da 100644
--- a/cmd/hsu/main.go
+++ b/cmd/hsu/main.go
@@ -21,15 +21,6 @@
// following paragraphs are considered an internal detail and not covered by the
// compatibility promise.
//
-// After checking credentials, hsu checks via /proc/ the absolute pathname of
-// its parent process, and fails if it does not match the hakurei pathname set
-// at link time. This is not a security feature: the priv-side is considered
-// trusted, and this feature makes no attempt to address the racy nature of
-// querying /proc/, or debuggers attached to the parent process. Instead, this
-// aims to discourage misuse and reduce confusion if the user accidentally
-// stumbles upon this program. It also prevents accidental use of the incorrect
-// installation of hsu in some environments.
-//
// Since target container environment variables are set up in shim via the
// [container] infrastructure, the environment is used for parameters from the
// parent process.
@@ -62,7 +53,6 @@ import (
"runtime"
"slices"
"strconv"
- "strings"
"syscall"
)
@@ -107,18 +97,6 @@ func main() {
return
}
- var toolPath string
- pexe := filepath.Join("/proc", strconv.Itoa(os.Getppid()), "exe")
- if p, err := os.Readlink(pexe); err != nil {
- log.Fatalf("cannot read parent executable path: %v", err)
- } else if strings.HasSuffix(p, " (deleted)") {
- log.Fatal("hakurei executable has been deleted")
- } else if p != hakureiPath {
- log.Fatal("this program must be started by hakurei")
- } else {
- toolPath = p
- }
-
// refuse to run if hsurc is not protected correctly
if s, err := os.Stat(hsuConfPath); err != nil {
log.Fatal(err)
@@ -205,7 +183,7 @@ func main() {
log.Fatalf("cannot set no_new_privs flag: %s", errno.Error())
}
- if err := syscall.Exec(toolPath, []string{
+ if err := syscall.Exec(hakureiPath, []string{
"hakurei",
"shim",
}, []string{