[Systrace] linux binaries in shell scripts

Nikolay Sturm sturm at sec.informatik.tu-darmstadt.de
Sat Jan 17 00:26:05 EST 2004


Hi!

On OpenBSD-current, if a shell script is executed under systrace and
then starts a linux binary, systrace seems broken. To reproduce,
use the policy file at the end of this mail and do sth like

systrace -a -i -f systrace.policy /usr/local/bin/acroread --help

In OpenBSD 3.4 acroread happily produces the desired output, while in
-current it produces these log entries:

systrace: deny user: sturm, prog: /usr/local/bin/acroread, pid: 11739(0)[0], policy: /usr/local/bin/acroread, filters: 130, syscall: native-settimeofday(122), args: 4

systrace: deny user: sturm, prog: /usr/local/bin/acroread, pid: 11739(0)[0], policy: /usr/local/bin/acroread, filters: 130, syscall: native-compat_43_okillpg(146), args: 12

I traced this back to a commit in October 2003 to "fix a race condition
between path resolution in userland and the subsequent namei()".

My question is, whether this is expected behaviour or a bug. 

Policy: /usr/local/bin/acroread, Emulation: native
	native-__sysctl: permit
	native-accept: true then permit log
	native-bind: sockaddr match "/tmp" then permit
	native-break: permit
	native-chdir: permit
	native-chflags: permit
	native-chmod: permit
	native-chown: permit
	native-chroot: permit
	native-clock_gettime: permit
	native-close: permit
	native-compat_43_ogetpagesize: permit
	native-compat_43_olseek: permit
	native-connect: sockaddr eq "family(0)" then permit
	native-connect: sockaddr match "/dev/log" then permit
	native-connect: sockaddr match "/tmp" then permit
	native-dup2: permit
	native-dup: permit
	native-execve: permit
	native-exit: permit
	native-fchdir: permit
	native-fchflags: permit
	native-fchmod: permit
	native-fchown: permit
	native-fcntl: permit
	native-flock: permit
	native-fork: permit
	native-fsread: true then permit
	native-fstat: permit
	native-fstatfs: permit
	native-fswrite: filename eq "/dev/crypto" then permit
	native-fswrite: filename eq "/dev/null" then permit
	native-fswrite: filename eq "/dev/stdout" then permit
	native-fswrite: filename eq "/dev/tty" then permit
	native-fswrite: filename eq "/dev/zero" then permit
	native-fswrite: filename match "/tmp" then permit
	native-fswrite: filename match "/usr/ports/distfiles" then permit
	native-fswrite: filename match "/usr/obj/ports/a2ps-4.13b-letter" then permit
	native-fswrite: filename match "/usr/ports/bulk" then permit
	native-fswrite: filename match "/usr/ports/packages" then permit
	native-fswrite: filename match "/var/tmp" then permit
	native-fswrite: filename match "/<non-existent filename>: *" then deny[enoent]
	native-fsync: permit
	native-ftruncate: permit
	native-futimes: permit
	native-getdirentries: permit
	native-getegid: permit
	native-geteuid: permit
	native-getfsstat: permit
	native-getgid: permit
	native-getgroups: permit
	native-getlogin: permit
	native-getpeername: permit
	native-getpgid: permit
	native-getpgrp: permit
	native-getpid: permit
	native-getppid: permit
	native-getpriority: permit
	native-getrlimit: permit
	native-getrusage: permit
	native-getsid: permit
	native-getsockname: permit
	native-getsockopt: permit
	native-gettimeofday: permit
	native-getuid: permit
	native-ioctl: permit
	native-issetugid: permit
	native-kill: permit
	native-lchown: permit
	native-link: permit
	native-listen: true then permit log
	native-lseek: permit
	native-madvise: permit
	native-mkfifo: permit
	native-mlock: permit
	native-mlockall: permit
	native-mmap: permit
	native-mprotect: permit
	native-mquery: permit
	native-msync: permit
	native-munmap: permit
	native-nanosleep: permit
	native-pathconf: permit
	native-pipe: permit
	native-poll: permit
	native-pread: permit
	native-pwrite: permit
	native-read: permit
	native-readv: permit
	native-recvfrom: permit
	native-recvmsg: permit
	native-rename: permit
	native-select: permit
	native-sendmsg: permit
	native-sendto: permit
	native-setegid: permit
	native-setgid: permit
	native-setgroups: permit
	native-setitimer: permit
	native-setpgid: permit
	native-setpriority: permit
	native-setregid: permit
	native-setresgid: permit
	native-setresuid: permit
	native-setreuid: permit
	native-setrlimit: permit
	native-setsid: permit
	native-setsockopt: permit
	native-setuid: permit
	native-shmat: permit
	native-shmctl: permit
	native-shmdt: permit
	native-shmget: permit
	native-shutdown: permit
	native-sigaction: permit
	native-sigaltstack: permit
	native-sigprocmask: permit
	native-sigreturn: permit
	native-sigsuspend: permit
	native-socket: permit
	native-socketpair: permit
	native-statfs: permit
	native-symlink: permit
	native-sync: permit
	native-umask: permit
	native-utimes: permit
	native-vfork: permit
	native-wait4: permit
	native-write: permit
	native-writev: permit


More information about the systrace mailing list