github.com/criyle/go-sandbox@v0.10.3/runner/ptrace/run_linux.go (about) 1 package ptrace 2 3 import ( 4 "context" 5 "os" 6 7 "github.com/criyle/go-sandbox/pkg/forkexec" 8 "github.com/criyle/go-sandbox/ptracer" 9 "github.com/criyle/go-sandbox/runner" 10 ) 11 12 // Run starts the tracing process 13 func (r *Runner) Run(c context.Context) runner.Result { 14 ch := &forkexec.Runner{ 15 Args: r.Args, 16 Env: r.Env, 17 ExecFile: r.ExecFile, 18 RLimits: r.RLimits, 19 Files: r.Files, 20 WorkDir: r.WorkDir, 21 Seccomp: r.Seccomp.SockFprog(), 22 Ptrace: true, 23 SyncFunc: r.SyncFunc, 24 25 UnshareCgroupAfterSync: os.Getuid() == 0, 26 } 27 28 th := &tracerHandler{ 29 ShowDetails: r.ShowDetails, 30 Unsafe: r.Unsafe, 31 Handler: r.Handler, 32 } 33 34 tracer := ptracer.Tracer{ 35 Handler: th, 36 Runner: ch, 37 Limit: r.Limit, 38 } 39 return tracer.Trace(c) 40 }