summaryrefslogtreecommitdiff
path: root/sys/kern
AgeCommit message (Collapse)Author
2017-08-17print why the signature block check of an unhibernate attempt failed, toMike Larkin
let people know what changed. ok kettenis, phessler
2017-08-16Correct the check when selecting an elevatorMike Belopuhov
Coverity CID 1453358; Severity: unlikely, not user-visible ok millert, visa
2017-08-15remove parens that were copied from ndinit's previous life as a macroTed Unangst
2017-08-15create a temp directory for all the temp files instead of trying to nameTed Unangst
them one at a time. solves a problem where .d files were showing up with static names. ok deraadt
2017-08-14Load CTF debug symbols before mountrootUwe Stuehler
This is obviously useful in order to investigate a failure to mount an NFS or other root device. ok mpi
2017-08-13Nuke trailing whitespaceBob Beck
2017-08-13New flag PR_RWLOCK for pool_init(9) makes the pool use rwlocks insteadPhilip Guenther
of mutexes. Use this immediately for the pool_cache futex pools. Mostly worked out with dlg@ during e2k17 ok mpi@ tedu@
2017-08-12Add rw_assert_anylock(), for assering you have it either read or write lockedPhilip Guenther
ok tedu@ mpi@
2017-08-12Silence clang warnings: remove unused variables and s/%hx/%x/gPhilip Guenther
ok mpi@ deraadt@
2017-08-12regenTed Unangst
2017-08-12add a fktrace syscall that takes a file descriptor instead of a name.Ted Unangst
libc and man page parts to come. ok guenther
2017-08-11Remove NET_LOCK()'s argument.Martin Pieuchot
Tested by Hrvoje Popovski, ok bluhm@
2017-08-11Merge DDBCTF into DDB.Martin Pieuchot
2017-08-11Validate sockaddr from userland in central functions. This resultsAlexander Bluhm
in common checks for unix, inet, inet6 instead of partial checks here and there. Some checks are already done at a higher layer, but better be paranoid with user input. OK claudio@ millert@
2017-08-10Move the solock()/sounlock() dance outside of sobind().Martin Pieuchot
ok phessler@, visa@, bluhm@
2017-08-10Make rw_enter() always succeed after a panic.Martin Pieuchot
This prevents deadlocks when doing 'boot reboot' after the kernel panic'd. Discussed with bluhm@ and guenther@, ok visa@
2017-08-10The socket field so_proto can never be NULL. Remove the checks.Alexander Bluhm
OK mpi@ visa@
2017-08-09Move the socket lock "above" sosetopt(), sogetopt() and sosplice().Martin Pieuchot
Protect the fields modifieds by sosetopt() and simplify the dance with the stars. ok bluhm@
2017-08-08Kernel sendsyslog(2), libc syslog(3), and syslogd(8) restrict andAlexander Bluhm
truncate the length of a syslog message to 8192 bytes. Use one global define LOG_MAXLINE for all of them. OK deraadt@ millert@
2017-08-07Turns out gcc complains about %02hhx. So simply use %02x instead. This isMark Kettenis
accepted by both clang and gcc and safe given that varargs arguments are promoted to int anyway. Using %h in the kernel is discouraged anyway according to bluhm@. Unbreaks the tree on gcc architectures. ok pirofti@, bluhm@, florian@
2017-08-06Use %hhx instead of %hx to print u_char. Silences clang warning.Mark Kettenis
ok jca@, florian@
2017-07-31Give back some space to the ramdisk by compiling net/radix.c onlyFlorian Obser
if we compile pf, ipsec, pipex or nfsserver. Suggested by mpi some time ago. Tweak & OK bluhm deraadt assumes it's fair
2017-07-28Add some sanity length checks in VFS directory scan. This protectsAlexander Bluhm
us from bogus input from file systems like fuse. bug report Ilja Van Sprundel; OK deraadt@
2017-07-28Allow SIOCGIFDESCR with "route" promise in preparation for pledging snmpd.rob
ok deraadt@ benno@
2017-07-27Assert that the KERNEL_LOCK() is held prior to call csignal() andMartin Pieuchot
selwakeup(). ok bluhm@
2017-07-24Extend the scope of the socket lock to protect `so_state' in connect(2).Martin Pieuchot
As a side effect, soconnect() and soconnect2() now expect a locked socket, so update all the callers. ok bluhm@
2017-07-24Grab the socket lock in soo_ioctl() where `so_state', `so_rcv'Martin Pieuchot
and `so_snd' are modified. ok bluhm@, visa@
2017-07-22Introduce jiffies, a volatile unsigned long version of our ticks variableMark Kettenis
for use by the linux compatibility APIs in drm(4). While I hate infecting code in sys/kern with this, untangling all the of having different types and different signedness is too much for me right now. The best strategy may be to change ticks itself to be long but that needs some careful auditing. ok deraadt@
2017-07-20When receiving a struct sockaddr from userland, enforce that memoryAlexander Bluhm
for sa_len and sa_family is provided. This will make handling of socket name mbufs within the kernel safer. issue reported by Ilja Van Sprundel; OK claudio@
2017-07-20Initialize a local variable to not leak kernel stack info to userlandMartin Pieuchot
if TIOCGPGRP fail. Issue found by Ilja van Sprundel. ok bluhm@, millert@, deraadt@
2017-07-20If pool_get() sleeps while allocating additional memory for socketAlexander Bluhm
splicing, another process may allocate it in the meantime. Then one of the splicing structures leaked in sosplice(). Recheck that no struct sosplice exists after a protential sleep. reported by Ilja Van Sprundel; OK mpi@
2017-07-20Extend the scope of the socket lock in soo_stat() to protect `so_state'Martin Pieuchot
and `so_rcv'. ok bluhm@, claudio@, visa@
2017-07-20Prepare filt_soread() to be locked. No functionnal change.Martin Pieuchot
ok bluhm@, claudio@, visa@
2017-07-19Uninitialized variable can leak kernel memory.Theo de Raadt
Found by Ilja Van Sprundel ok kettenis
2017-07-19Move KTRPOINT call up. The lenght variable i is getting aligned and soClaudio Jeker
uninitialised data can be dumped into the ktrace message. Found by Ilja Van Sprundel OK bluhm@
2017-07-18Both syslog(3) and syslogd(8) truncate the message at 8192 bytes.Alexander Bluhm
Do the same in sendsyslog(2) and document the behavior. reported by Ilja Van Sprundel; OK millert@ deraadt@
2017-07-18soreserve() modifies `so_snd' and `so_rcv' so asserts that it is calledMartin Pieuchot
with the socket lock. This change is safe because sbreserve() already asserts that the lock is held, but it acts as implicit documentation and indicates that I looked at the function.
2017-07-13Do not unlock the netlock in the goto out error path before it hasAlexander Bluhm
been acquired in sosend(). Fixes a kernel lock assertion panic. OK visa@ mpi@
2017-07-12Invalidate read-ahead buffers when read shortMike Belopuhov
Buffercache performs read-ahead for cluster reads by extending the length of an original read operation to the MAXPHYS (64k). Upon I/O completion, the length is trimmed and the buffer is returned to the filesystem and the remaining data is cached. However, under certain circumstances, the underlying hardware may fail to do a complete I/O operation and return with a non- zero value of the residual length (i.e. data that wasn't read). The residual length may exceed the size of an original request and must be re-adjusted to uphold the contract with the caller, e.g. the filesystem. At the same time, read-ahead buffers that cover chunks of memory corresponding to the residual length must be invalidated and not cached. Discussed at length during d2k17, ok tedu
2017-07-12Do not call fo_ioctl() in syscall that do, or will, take the socketMartin Pieuchot
lock. Prevents a future lock recursion since soo_ioctl() will need to grab the lock. ok bluhm@, visa@
2017-07-12Compute the level of contention only once.Visa Hankala
Suggested by and OK dlg@
2017-07-12When there is no contention on a pool cache lock, lower the numberVisa Hankala
of items that a cache list is allowed to hold. This lets the cache release resources back to the common pool after pressure on the cache has decreased. OK dlg@
2017-07-10make malloc(9) mpsafe by using a mutex instead of splvm.David Gwynne
this is almost a straightforward change of spl ops with mutex ops, except the accounting has been shuffled around. memory is counted as used before an attempt to allocate it from uvm is made to prevent overcommitting memory. this is modelled on how pools limit allocations. the uvm bits have been eyeballed by kettenis@ who says they should be safe. visa@ found some nits which have been fixed. tested by chris@ and amit kulkarni ok kettenis@ visa@ mpi@
2017-07-08Revert grabbing the socket lock in kqueue filters.Martin Pieuchot
It is unsafe to sleep while iterating the list of pending events in kqueue_scan(). Reported by abieber@ and juanfra@
2017-07-04some of this code was written in an era when spaces cost extra.Ted Unangst
add a little breathing room.
2017-07-04Always hold the socket lock when calling sblock().Martin Pieuchot
Implicitely protects `so_state' with the socket lock in sosend(). ok visa@, bluhm@
2017-07-04Assert that the socket lock is held when `so_state' is modified.Martin Pieuchot
ok bluhm@, visa@
2017-07-04Assert that the socket lock is held when `so_qlen' is modified.Martin Pieuchot
ok bluhm@, visa@
2017-07-03Do not grab the socket lock in doaccept() twice. Pass NOTE_SUBMITAlexander Bluhm
to KNOTE() as we are already holding the lock. Fixes "panic: rw_enter: netlock locking against myself" reported by Gregor Best and reproduced with src/regress/lib/libtls/gotls. OK millert@
2017-07-03Protect `so_state', `so_error' and `so_qlen' with the socket lock inMartin Pieuchot
kqueue filters. ok millert@, bluhm@, visa@