From 7cebfb4eb8a0208df260f166e5718b7d60dd41be Mon Sep 17 00:00:00 2001 From: criyle Date: Sun, 14 Jul 2019 19:15:23 -0700 Subject: [PATCH] remove debug infomation --- forkexec/fork.go | 1 + runconfig/handle.go | 1 - rununshared/run.go | 8 ++++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/forkexec/fork.go b/forkexec/fork.go index bb70738..b55e82b 100644 --- a/forkexec/fork.go +++ b/forkexec/fork.go @@ -297,6 +297,7 @@ func (r *Runner) Start() (int, error) { // if both seccomp and ptrace is defined, then seccomp filter should have // traced execve, thus child need parent attached to it first + // actually, this is not effective if pid namespace is unshared if r.StopBeforeSeccomp || (r.Seccomp != nil && r.Ptrace) { // Stop to wait for ptrace tracer _, _, err1 = syscall.RawSyscall(syscall.SYS_KILL, pid, uintptr(syscall.SIGSTOP), 0) diff --git a/runconfig/handle.go b/runconfig/handle.go index 18317f7..a287e3b 100644 --- a/runconfig/handle.go +++ b/runconfig/handle.go @@ -26,7 +26,6 @@ func (h *Handler) CheckRead(fn string) runprogram.TraceAction { // CheckWrite checks whether the file have write permission func (h *Handler) CheckWrite(fn string) runprogram.TraceAction { - fmt.Println("write: ", fn) if !h.FileSet.IsWritableFile(fn) { return h.onDgsFileDetect(fn) } diff --git a/rununshared/run.go b/rununshared/run.go index 5727a31..214ff5e 100644 --- a/rununshared/run.go +++ b/rununshared/run.go @@ -42,7 +42,7 @@ func (r *RunUnshared) Start() (rt tracer.TraceResult, err error) { WorkDir: r.WorkDir, Seccomp: bpf, NoNewPrivs: true, - StopBeforeSeccomp: true, + StopBeforeSeccomp: false, UnshareFlags: UnshareFlags, Mounts: r.Mounts, PivotRoot: r.Root, @@ -87,11 +87,11 @@ func (r *RunUnshared) Trace(runner *forkexec.Runner) (result tracer.TraceResult, result.RunningTime = time.Now().UnixNano() - fTime }() + // currently, we do not have any way to track mount syscall time usage + fTime = time.Now().UnixNano() + for { pid, err := unix.Wait4(pgid, &wstatus, unix.WALL, &rusage) - if fTime == 0 { - fTime = time.Now().UnixNano() - } r.println("wait4: ", wstatus) if err != nil { return result, tracer.TraceCodeFatal