From f2a47b2cc32aab261c6b25b00af1bf499caddf0f Mon Sep 17 00:00:00 2001 From: Rowan Smith Date: Wed, 18 Nov 2026 14:53:29 +1100 Subject: [PATCH] tracing path test --- enterprise/cmd/exectrace/main.go | 3 +++ enterprise/exectrace.go | 22 ++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/enterprise/cmd/exectrace/main.go b/enterprise/cmd/exectrace/main.go index bbb32e1..fdf71ff 100644 --- a/enterprise/cmd/exectrace/main.go +++ b/enterprise/cmd/exectrace/main.go @@ -3,6 +3,7 @@ package main import ( + "fmt" "os" "strings" "time" @@ -20,6 +21,8 @@ func main() { err := app.Run(os.Args) if err != nil { + // Without this the process exits with no indication of why. + fmt.Fprintf(os.Stderr, "exectrace: %v\n", err) os.Exit(1) } } diff --git a/enterprise/exectrace.go b/enterprise/exectrace.go index 54894a1..d16f5d0 100644 --- a/enterprise/exectrace.go +++ b/enterprise/exectrace.go @@ -23,10 +23,16 @@ import ( ) const ( - debugFS = "debugfs" - debugFSMountpoint = "/sys/kernel/debug" - traceFS = "tracefs" - traceFSMountpoint = debugFSMountpoint + "/tracing" + traceFS = "tracefs" + // traceFSMountpoint is the canonical tracefs location (since Linux 4.1). + // + // We intentionally don't use /sys/kernel/debug/tracing: that path only + // exists when the kernel automounts tracefs inside debugfs + // (CONFIG_TRACEFS_AUTOMOUNT_DEPRECATED, deprecated since Linux 6.17). + // Kernels built without it, such as Talos Linux 1.14, have no "tracing" + // directory in debugfs and debugfs doesn't allow creating one, so mounting + // there fails. + traceFSMountpoint = "/sys/kernel/tracing" ) type Options struct { @@ -59,13 +65,9 @@ func Run(ctx context.Context, log slog.Logger, opts Options) error { } log.Debug(ctx, "got PidNS", slog.F("pid_ns", pidNS)) - // We need to make sure that debugfs is mounted at /sys/kernel/debug and - // tracefs is mounted at /sys/kernel/debug/tracing. + // We need to make sure that tracefs is mounted at /sys/kernel/tracing so + // the tracepoint can be attached. log.Debug(ctx, "preparing environment for eBPF tracing") - err = ensureVirtualMountpoint(debugFS, debugFSMountpoint, nil) - if err != nil { - return xerrors.Errorf("ensure debugfs mounted: %w", err) - } err = ensureVirtualMountpoint(traceFS, traceFSMountpoint, nil) if err != nil { return xerrors.Errorf("ensure tracefs mounted: %w", err)