From 468696f611178598c8cc6b918f134e92e03e8c29 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 16 Feb 2025 19:02:52 +0900 Subject: [PATCH] internal: beforeExit before reachable fatal calls These are the only two calls to log.Fatal* reachable during suspended output. Call fmsg.BeforeExit here to catch that. Signed-off-by: Ophestra --- internal/executable.go | 3 +++ internal/linux/std.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/internal/executable.go b/internal/executable.go index 86ffab9..381a09b 100644 --- a/internal/executable.go +++ b/internal/executable.go @@ -4,6 +4,8 @@ import ( "log" "os" "sync" + + "git.gensokyo.uk/security/fortify/internal/fmsg" ) var ( @@ -13,6 +15,7 @@ var ( func copyExecutable() { if name, err := os.Executable(); err != nil { + fmsg.BeforeExit() log.Fatalf("cannot read executable path: %v", err) } else { executable = name diff --git a/internal/linux/std.go b/internal/linux/std.go index 4850cf9..fceba95 100644 --- a/internal/linux/std.go +++ b/internal/linux/std.go @@ -13,6 +13,7 @@ import ( "syscall" "git.gensokyo.uk/security/fortify/internal" + "git.gensokyo.uk/security/fortify/internal/fmsg" ) // Std implements System using the standard library. @@ -73,6 +74,7 @@ func (s *Std) Uid(aid int) (int, error) { u.uid = -1 if fsu, ok := internal.Check(internal.Fsu); !ok { + fmsg.BeforeExit() log.Fatal("invalid fsu path, this copy of fortify is not compiled correctly") // unreachable return 0, syscall.EBADE