aboutsummaryrefslogtreecommitdiff
path: root/psx
AgeCommit message (Collapse)Author
2019-12-07Add a failure test case to libcap/psx Go package.Andrew G. Morgan
Also, need to force CGO_ENABLED=0 to take advantage of pure Go support for syscall.PosixSyscall when available (ie. for web.go in this tree). Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
2019-12-06Add support to libcap for overriding system call functions.Andrew G. Morgan
Note, this override only supports the system calls that libcap uses to change kernel state associated with the current process. This is primarily intended to permit the user to use libpsx to force all pthreads to mirror capability and other security relevant state. Use a weak function definition feature of libpsx share_psx_syscall() to transparently arrange for libcap to so force itself to use the psx_syscall() abstraction when linked against -lpsx. This has the effect of using linker magic to make libcap transparently observe POSIX semantics for security state setting operations. That is, when linked as follows: gcc .... -lcap -lpsx -lpthread -Wl,-wrap,pthread_create all pthreads maintain a common security state with respect to the libcap API. This also adds full capability setting support to the Go package libcap/cap via a libcap/psx package which uses cgo+libpsx syscalls that share capabilities over all pthreads including those of the Go runtime. Finally, if Go supports syscall.PosixSyscall() etc. then provide a non-psx mechanism for libcap/cap to "just work" in all Go code. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>