Sandbox implemented in GO with container / ptrace / seccomp
Go to file
2019-07-20 15:20:42 -07:00
cmd/run_program decoupling rununshared and tracer 2019-07-20 15:20:42 -07:00
forkexec decoupling rununshared and tracer 2019-07-20 15:20:42 -07:00
runconfig remove debug infomation 2019-07-14 19:15:23 -07:00
runprogram decoupling rununshared and tracer 2019-07-20 15:20:42 -07:00
rununshared decoupling rununshared and tracer 2019-07-20 15:20:42 -07:00
seccomp apply go11 module & code clean up 2019-07-08 23:31:05 -07:00
tracer decoupling rununshared and tracer 2019-07-20 15:20:42 -07:00
types decoupling rununshared and tracer 2019-07-20 15:20:42 -07:00
.gitignore try fix memory trace & update README 2019-07-08 00:09:15 -07:00
go.mod apply go11 module & code clean up 2019-07-08 23:31:05 -07:00
go.sum add ability to forkexec to unshare namespaces 2019-07-10 00:27:01 -07:00
LICENSE Create LICENSE 2019-04-01 14:28:20 -04:00
README.md decoupling rununshared and tracer 2019-07-20 15:20:42 -07:00

go-judger

Under developing.

Goal is to reimplement uoj-judger/run_program in GO language using libseccomp.

Install:

  • install go compiler: apt install golang-go
  • install libseccomp-dev: apt install libseccomp-dev
  • install: go install github.com/criyle/go-judger/...

Features (same as uoj-judger/run_program):

  1. Restricted computing resource: Time & Memory (Stack) & Output
  2. Restricted syscall access (by libseccomp & ptrace)
  3. Restricted file access (read & write & access & exec)

New Features:

  1. Percise resource limits (s -> ms, mb -> kb)
  2. More architectures (arm32, arm64, x86)
  3. Allow multiple traced programs in different threads
  4. Allow pipes as input / output files
  5. Use Linux Namespace to isolate file access (elimilate ptrace)

Default file access action:

  • check file read / write: open, openat
  • check file read: readlink, readlinkat
  • check file write: unlink, unlinkat, chmod, rename
  • check file access: stat, lstat, access, faccessat
  • check file exec: execve

Packages:

  • seccomp: provides utility function that wrappers libseccomp
  • forkexec: fork-exec provides mount, unshare, ptrace, seccomp, capset before exec
  • tracer: ptrace tracer and provides syscall trap filter context
  • runprogram: wrapper to call forkexec and trecer
  • rununshared: wrapper to call forkexec and unshared namespaces
  • runconfig: defines arch & language specified trace condition for seccomp and ptrace
  • types: general runtime specs
    • mount: provides utility function that wrappers mount syscall
    • rlimit: provides utility function that defines rlimit syscall
    • specs: provides general res / result data structures

Executable:

  • run_program: under construction

Configuations:

  • run_program/config.go: all configs toward running specs

TODO:

  1. Use Linux Control Groups to limit & acct CPU & memory (elimilate wait4 rusage)