summaryrefslogtreecommitdiff
path: root/sys/kern/kern_pledge.c
AgeCommit message (Collapse)Author
2016-03-30Add getlogin_r syscall that checks and returns errors like userspacePhilip Guenther
getlogin_r() API; keep existing syscall as getlogin59 for temporary compat. ok kettenis@ deraadt@
2016-03-25Silences compiler warnings, about used uninitialized variables. These lengthsSebastien Marie
are passed uninitialized to free(9) only when pointers are NULL. found by jsg@ ok deraadt@
2016-03-22allow fpathconf() in stdio mode, since it is an innocuous queryTheo de Raadt
system call. discussed with semarie and everyone else during the 5.9 lock.
2016-03-21Rename the system call sendsyslog2 to sendsyslog. Keep the old oneAlexander Bluhm
as osendsyslog for a while. The three argument variant is the only one that will stay. input kettenis@; OK deraadt@
2016-03-16Expose new audio ioctls that do one thing only: start and stop DMA,Alexandre Ratchov
set and get parameters. This is much simpler. ok semarie, armani, tweaks from jmc
2016-03-15pledge: wl_paths: resolvpath() logic errorSebastien Marie
prepend chroot value *after* canonization and not before.
2016-03-15pledge: wl_paths: corrects a memory leak in error code path and an evaluationSebastien Marie
order ("a += b > c" is the same as "a += (b > c)" which is wrong here) ok jca@
2016-03-13keep disabled wl_paths for now. the expensiveness impact need to be betterSebastien Marie
considered. ok deraadt@
2016-03-13reenable wl_paths (whitelisted-paths) in pledge(2)Sebastien Marie
2016-03-13pledge: replace #if 0 printf with DNPRINTF macroSebastien Marie
2016-03-13pledge: let wl_paths works well with chrootSebastien Marie
it factorizes path resolution in resolvpath() function, and use it in sys_pledge() and pledge_namei(). please note that wl_paths is still disabled.
2016-03-13corrects on off-by-one error in pledge_namei()Sebastien Marie
- rewrite canonpath() to not require extra byte before shrinking - make canonpath() error not fatal for the caller (proposition from tedu@) ok millert@ tedu@ deraadt@
2016-03-11pledge: define the meaning of passing NULL to one arguments of pledge(2) as "ISebastien Marie
don't want to change the current value" it changes only the `request' argument behaviour when NULL is passed: previously it was traited as "" was passed. with help from jmc@ for man-page OK tb@ on previous version
2016-02-17Return ENOTTY for TIOCFLUSH when allowed by pledge but the fd isTodd C. Miller
not a tty. Fixes a pledge failure in telnet when piping the output. OK deraadt@
2016-01-19Check if the vnode type is VBAD (corresponds to disconnectedAlexandre Ratchov
usb devices) and return ENOTTY rather than terminating the caller program. Found by Michael Reed <m.reed at mykolab.com> ok semarie, deraadt
2016-01-18Add SYS_truncate as a "wpath" operation. Omission noticed by tb and sthen.Theo de Raadt
2016-01-09drop "abort" promise, and make it the default behaviour.Sebastien Marie
The current code has already setted it by default since 1.74 any pledge failure tries to make a coredump (default rules for coredump still applies: so setuid binaries don't create them locally). ok deraadt@
2016-01-08Add "vmm" pledge to allow restricted ioctl access to /dev/vmm.Reyk Floeter
This will allow to pledge vmd(8)'s vmm and vm processes, so that VMs themselves run "sandboxed", including their host-side virtio layer. It will remain disabled for now (in userland) to not get into the way of ongoing development and upcoming changes in vmd and the ioctl interface. OK mlarkin@ deraadt@ "kernel side in, but not the callers in userland"
2016-01-06turn off the whitepath code for now; we're not sure it's ready for releaseTed Unangst
ok deraadt
2016-01-06remove unnecessary casts where the incoming type is void *.Ted Unangst
2016-01-06Add pledge "drm", which allows a subset of the drm(4) ioctls. These areMark Kettenis
basically only the ioctls that Linux allows on the so-called "render nodes". For now, it also allows DRM_IOCTL_GET_MAGIC and DRM_IOCTL_GEM_OPEN, as we don't implement prime/dma-buf yet in OpenBSD. That still leaves a big gaping hole, so they will be removed as soon as we can. Based on a diff by robert@, who did all the heavy lifting by studying the behaviour of the chromium GPU process, with some further suggestions by deraadt@. ok jsg@, deraadt@, robert@
2016-01-05annoying whitespaceTheo de Raadt
2015-12-27Add missing #include "audio.h". Fixes sndiod pledge issue reported bytb
timo.myyra () wickedbsd ! net, thanks! While there, remove extraneous "pty.h". ok deraadt@
2015-12-27wrap "audio" pledge code in NAUDIO > 0, because there are a fewTheo de Raadt
GENERIC kernels which lack audio drivers.
2015-12-23pledge "audio" code block must be !SMALL_KERNELTheo de Raadt
2015-12-23If PLEDGE_AUDIO is set, allow audio(4) ioctls necessaryAlexandre Ratchov
to use raw audio devices. ok deraadt, semarie
2015-12-06Change kernel internal pledge variables to 64bit (to prepare for moreTheo de Raadt
extensions). This change is exposed in ktrace.out files ok semarie
2015-12-05Study of kernel code complete. Permit ioctl SIOCGIFMEDIA for pledgeTheo de Raadt
"route", which krw and mestre will be able to use in dhclient(8).
2015-12-04allow utrace(2) by default.Theo de Raadt
conversation with jsg
2015-12-04remove PLEDGE_INET granting when using "getpw" in YP environnmentSebastien Marie
it makes PLEDGE_YPACTIVE enough for doing required networking with YP. It should permit to bring YP internals into the light. discuted with deraadt@
2015-12-04Add pledge "dpath", which provides access to mknod(2) and mkfifo(2).Theo de Raadt
This will be required to keep pax/tar/cpio at otherwise very high levels of pledge (and we will see where else it is beneficial). Allocate a bit for pledge "audio", which will be coming soon. good discussions with semarie
2015-12-04Do not think atomicity is required here. In any case, prepare forTheo de Raadt
ps_pledge to become 64-bits over the next few days (things are getting a bit tight; most newer pledges will be quite device-driver specific)
2015-12-03Remove the /usr/share/nls/ exception from pledge(2). The libcAlexander Bluhm
native language support was deleted a month ago at u2k15. OK semarie@ deraadt@
2015-12-03pledge(pf) needs to allow DIOCKILLSRCNODES, used in relayd.Sebastian Benoit
ok deaadt@
2015-11-29On a SMALL_KERNEL, pledge "pf" has to be a no-op. We cannot matchTheo de Raadt
the device node (since it does not exist...)
2015-11-29Add pledge "pf" which allows ioctls on pf(4). This will be used bySebastian Benoit
relayd and other programs manipulating the packet filter. ok deraadt@
2015-11-28pledge: allow getsockopt IP_IPDEFTTL with promise inetSebastian Benoit
then relayd's host check engine can be pledged. ok reyk@, approach suggested by deraadt@ weeks ago.
2015-11-27Two additional ioctls for pledge("disklabel"), needed by installboot.Jeremie Courreges-Anglas
Committing on behalf of tb@, problem reported by Rolf Sommerhalder on misc@.
2015-11-25permit kern.maxpartitionsTheo de Raadt
2015-11-24Add sendsyslog2(), which accepts the syslog/openlog "logopt" flagTheo de Raadt
LOG_CONS. If syslogd is not accepting messages, direct them to the console. This allows us to remove the direct /dev/console opening code from the bowels of libc. Of course, that forgotten code was exposed by pledge. ok kettenis millert beck
2015-11-23the "getpw" test for /dev/tty is only needed for readpassphrase(3),Theo de Raadt
getpass(3), so don't specifically allow it for "rpath" (rpath will accept it in the end, unless it is on the whitelist)
2015-11-23need sys/device.hTheo de Raadt
2015-11-22For "disklabel", allow sysctl mach.chr2kblk and ioctl BIOCINQ/BIOCVOLTheo de Raadt
also, to satisfy midlayers that some fs/install tools need.
2015-11-22"getpw" should also allow access to /etc/netidTheo de Raadt
discovered by rpe
2015-11-20Permit msync(2) in the "stdio" set; only a few programs use it relatedTheo de Raadt
to mmap, but thinking about it nothing feels risky Long discussions with florian
2015-11-20Add pledge "disklabel", which allows sysctl kern.rawpartition, aTheo de Raadt
few disklabel ioctls, and the DIOCMAP ioctl against /dev/diskmap used to translate duid numbers into partitions. This will allow pledging of at least 12 disk/filesystem aware programs; due to the negative impact that diff will wait a bit so everyone has a chance to update their kernels. ok semarie
2015-11-20Exempt accept(2) from the pledge_socket() check part of the "domain"Theo de Raadt
check. You cannot open a socket in a domain unless permitted -- but you need to be able to accept one if the code flow asks for that to happen. The most recent check is too tight. We may need to iterate the policy here until we hit the right vibe...
2015-11-18check domain and state of socket against pledge promise.Sebastien Marie
ok deraadt@
2015-11-17backout removal of SYS_break from stdio, suggested by deraadt@Stuart Henderson
ports using base gcc with PCH include: boost, keepassx, wxWidgets, jdk
2015-11-17Allow sysctl kern.clockrate, kern.argmax, kern.ngroups, kern.sysvshm,Theo de Raadt
and kern.posix1version. Enough to satisfy getconf, and I hope we don't need to add much more after this. Largely from jca