summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_witness.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Revert the convertion of per-process thread into a SMR_TAILQ.mpi2021-02-081-3/+3
| | | | | We did not reach a consensus about using SMR to unlock single_thread_set() so there's no point in keeping this change.
* Show when witness(4) has run out of lock order data entries.visa2021-01-281-2/+14
| | | | | | This makes it clearer why lock order traces are sometimes not displayed. Prompted by a question from, and OK anton@
* Enforce range with sysctl_int_bounded in witness_sysctl_watchgnezdo2021-01-091-10/+8
| | | | | | Makes previously explicit checking less verbose. OK millert@
* Replace a custom linked list with SLIST.visa2021-01-091-12/+10
|
* Replace SIMPLEQ with SLIST because the code does not need a queue.visa2021-01-091-26/+24
|
* Remove unnecessary relocking of w_mtx as panic() should not return.visa2021-01-091-10/+2
|
* Convert the per-process thread list into a SMR_TAILQ.mpi2020-12-071-3/+3
| | | | | | | Currently all iterations are done under KERNEL_LOCK() and therefor use the *_LOCKED() variant. From and ok claudio@
* witness: detect and report uninitialized (or zeroed) lock usagesemarie2020-11-121-3/+15
| | | | ok visa@
* Fix memory corruption with kern.witness.locktrace.visa2020-03-151-28/+13
| | | | | | | | | | | | | | | | The allocating of lock stacks does not handle correctly the case where the system-wide free list becomes empty. Consequently, the returned stack buffer can still be on the CPU's free list. This patch fixes the bug by simplifying the code. Lock stack buffers are now allocated and freed one by one from the system-wide free list instead of using batching. The fix additionally addresses a buffer hoarding problem that can arise under workloads where some CPUs are net acquirers and some other CPUs net releasers of rwlocks. Panic reported by Hrvoje Popovski
* Separate the stack trace saving interface from ddb. The saving does notvisa2020-01-201-10/+11
| | | | | | | | | | require the debugger on most architectures, and the separation makes the code easier to use from other subsystems. The function definitions are still conditional to DDB. However, that should not matter for now. OK deraadt@, mpi@
* Remove gratuitous #ifdef.visa2019-11-151-3/+1
|
* Get rid of `ddb_is_active' instead use `db_active'.mpi2019-07-201-2/+2
| | | | | | From Christian Ludwig <christian_ludwig at genua dot de> ok visa@
* Restore missing newline.visa2019-06-061-1/+3
|
* include uvm.h -> uvm_extern.h; ok visa@anton2019-05-191-2/+2
|
* Remove file name and line number output from witness(4)visa2019-04-231-223/+81
| | | | | | | | | | | | | Reduce code clutter by removing the file name and line number output from witness(4). Typically it is easy enough to locate offending locks using the stack traces that are shown in lock order conflict reports. Tricky cases can be tracked using sysctl kern.witness.locktrace=1 . This patch additionally removes the witness(4) wrapper for mutexes. Now each mutex implementation has to invoke the WITNESS_*() macros in order to utilize the checker. Discussed with and OK dlg@, OK mpi@
* Remove FBSDID.kevlo2019-03-151-5/+1
| | | | ok deraadt@
* Add lock stack trace saving for witness(4).visa2019-02-071-3/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lets witness(4) save a stack trace on each lock acquisition. The saved traces can be viewed in ddb(4) when showing the currently held locks, which may help when debugging incorrect locking. Sample output: ddb{0}> show all locks Process 63836 (rm) thread 0xffff8000221e52c8 (435004) exclusive rrwlock inode r = 0 (0xfffffd8119a092c0) locked @ /usr/src/sys/ufs/ufs/ufs_vnops.c:1547 #0 witness_lock+0x419 #1 _rw_enter+0x2bb #2 _rrw_enter+0x42 #3 VOP_LOCK+0x3f #4 vn_lock+0x36 #5 vfs_lookup+0xa1 #6 namei+0x2b3 #7 dounlinkat+0x85 #8 syscall+0x338 #9 Xsyscall+0x128 exclusive kernel_lock &kernel_lock r = 1 (0xffffffff81e6a5f0) locked @ /usr/src/sys/arch/amd64/amd64/intr.c:525 #0 witness_lock+0x419 #1 syscall+0x2b6 #2 Xsyscall+0x128 The saving adds overhead, so it is not enabled by default. It can be taken into use by setting sysctl kern.witness.locktrace=1 at runtime or by defining WITNESS_LOCKTRACE in the kernel configuration. Feedback and OK anton@
* Make callers of witness_lock_list_{get,free}() responsible of raisingvisa2019-02-041-11/+11
| | | | | | | the system priority level to IPL_HIGH. This simplifies the code a bit relative to calling from witness_lock() and witness_unlock(). OK mpi@
* Add a dedicated sysctl(2) node for witness(4).visa2019-01-291-1/+22
| | | | | | | | The new node contains the subsystem's main control variable, kern.witness.watch. It is aliased by the old name, kern.witnesswatch. The alias will be removed in the future. OK anton@ mpi@
* stop using capital letters in printf format strings; ok visa@anton2019-01-271-4/+4
|
* consistency tweaks to panic format strings; ok visa@anton2019-01-271-11/+11
|
* Use memset() instead of bzero().visa2019-01-261-3/+3
|
* Tag the start of witness(4) output with prefix "witness:".visa2019-01-261-15/+18
| | | | | | This eases data extraction in syzkaller. Prompted by and OK anton@
* Make the system cache a small number of free lock list entries per CPU.visa2018-06-261-2/+34
| | | | | | This reduces the contention of the `w_mtx' lock. OK mpi@
* Remove the witness_skipspin setting to simplify the code.visa2018-06-151-23/+5
| | | | OK mpi@
* Make possible to build uniprocessor WITNESS kernels without kernel_lock.visa2018-06-141-7/+19
| | | | | From Christian Ludwig OK mpi@
* Constipate all the struct lock_type's so they go into .rodataguenther2018-06-081-8/+9
| | | | ok visa@
* Consistently use printf() instead of db_printf() when not runningvisa2018-06-011-23/+23
| | | | | | in ddb. This avoids invoking the output pager by accident and keeps the output somewhat readable in case multiple cores trigger a warning simultaneously.
* Make witness(4) watch locks and print error stack traces by default.visa2018-05-311-2/+2
| | | | Requested by deraadt@
* Fix misleading indentation.visa2018-05-161-2/+2
|
* Print stack traces on lock order conflict.visa2018-05-161-1/+36
| | | | OK mpi@
* Add kern.witnesswatch sysctl for controlling witness(4). By default,visa2018-05-161-13/+52
| | | | | | | lock order checking is disabled but it can be enabled at runtime. Suggested by deraadt@ / mpi@ OK mpi@
* Remove witness_channel and always use console outputvisa2018-05-091-71/+25
| | | | | | to simplify the code. OK mpi@
* Zap two unused variables.visa2018-05-071-4/+1
|
* Make the print function of db_print_stack_trace() configurable,visa2018-05-071-3/+5
| | | | | | and indicate if a saved stack trace is empty. OK guenther@
* Record lock type even if witness is disabled. The value will be neededvisa2018-05-021-3/+5
| | | | if the lock becomes watched later.
* Treat all negative values of witness_watch equally for robustness.visa2018-04-301-11/+11
|
* Restore the original BSDI $Id$ strings. Those were mangled by CVSvisa2018-04-121-3/+3
| | | | | | by my mistake. Pointed out by Christian Ludwig. Thank you!
* Deactivate witness(4) checks if we are in ddb(4), when `db_active' is set.mpi2018-04-031-17/+24
| | | | | | | Prevents witness(4) from panic'ing the kernel now that mutexes and rwlock are always "taken" while in ddb(4). ok visa@
* Make ddb's "show all locks" command show spinlocks in additionvisa2018-02-201-3/+14
| | | | | | to sleeplocks. OK mpi@
* Fix the initial check of the checkorder and lock operationsvisa2017-11-141-7/+7
| | | | | | | so that statically initialized locks get properly enrolled to the validator. OK mpi@
* Silence clang warnings: remove unused variables and s/%hx/%x/gguenther2017-08-121-7/+5
| | | | ok mpi@ deraadt@
* Drop kernel trace points. The trace facility does not exist on OpenBSD.visa2017-05-221-31/+4
|
* Rename Debugger() into db_enter().mpi2017-04-301-4/+4
| | | | | | | Using a name with the 'db_' prefix makes it invisible from the dynamic profiler. ok deraadt@, kettenis@, visa@
* Add a port of witness(4) lock validation tool from FreeBSD.visa2017-04-201-0/+2525
Go-ahead from kettenis@, guenther@, deraadt@