Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refuse to run on Ubuntu Linux 4.4.0-* #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"encoding/binary"
"encoding/json"
"errors"
"flag"
"fmt"
"os"
Expand Down Expand Up @@ -50,11 +51,14 @@ func main() {
flScripts := flag.String("s", "", "scripts output `dir`")
flRm := flag.Bool("rm", false, "clean up scripts output dir")
flSeccomp := flag.Bool("seccomp", true, "trace with seccomp (if kernel >= 3.5)")
flKernel := flag.String("kernel", kernelRelease(), "kernel release (for seccomp)")
flKernel := flag.String("kernel", kernelRelease(), "kernel release")
flag.Parse()
e.Output = os.Stderr
withSeccomp = *flSeccomp && vercmp.CompareString(*flKernel, "3.5") >= 0
oldSeccomp = vercmp.CompareString(*flKernel, "4.8") < 0
if strings.HasPrefix(*flKernel, "4.4.0-") {
e.Exit(errors.New("Ubuntu Linux 4.4.0-* kernels have broken ptrace (please upgrade the kernel; use -kernel flag to override)"))
}

args := flag.Args()
runtime.LockOSThread()
Expand Down Expand Up @@ -234,7 +238,7 @@ func mainLoop(sys *SysState, mainPID int, onExec func(*ProcState), onExit func(*
fmt.Println(oldpid, "_exec", pid)
case unix.PTRACE_EVENT_SECCOMP:
if pstate.SysEnter {
panic("seccomp trace event during syscall")
panic("seccomp trace event during syscall (use -seccomp=false to disable)")
}
if oldSeccomp {
resume(pid, 0, true)
Expand Down