Module Name: src Committed By: ozaki-r Date: Fri May 17 03:34:27 UTC 2019
Modified Files: src/sys/conf: files src/sys/kern: init_main.c kern_exit.c kern_lwp.c kern_softint.c subr_lwp_specificdata.c subr_psref.c src/sys/net: if.c route.c src/sys/rump/kern/lib/libsysproxy: sysproxy.c src/sys/rump/librump/rumpkern: lwproc.c rump.c src/sys/sys: lwp.h psref.h userret.h Log Message: Implement an aggressive psref leak detector It is yet another psref leak detector that enables to tell where a leak occurs while a simpler version that is already committed just tells an occurrence of a leak. Investigating of psref leaks is hard because once a leak occurs a percpu list of psref that tracks references can be corrupted. A reference to a tracking object is memorized in the list via an intermediate object (struct psref) that is normally allocated on a stack of a thread. Thus, the intermediate object can be overwritten on a leak resulting in corruption of the list. The tracker makes a shadow entry to an intermediate object and stores some hints into it (currently it's a caller address of psref_acquire). We can detect a leak by checking the entries on certain points where any references should be released such as the return point of syscalls and the end of each softint handler. The feature is expensive and enabled only if the kernel is built with PSREF_DEBUG. Proposed on tech-kern To generate a diff of this commit: cvs rdiff -u -r1.1235 -r1.1236 src/sys/conf/files cvs rdiff -u -r1.503 -r1.504 src/sys/kern/init_main.c cvs rdiff -u -r1.274 -r1.275 src/sys/kern/kern_exit.c cvs rdiff -u -r1.200 -r1.201 src/sys/kern/kern_lwp.c cvs rdiff -u -r1.46 -r1.47 src/sys/kern/kern_softint.c cvs rdiff -u -r1.3 -r1.4 src/sys/kern/subr_lwp_specificdata.c cvs rdiff -u -r1.12 -r1.13 src/sys/kern/subr_psref.c cvs rdiff -u -r1.452 -r1.453 src/sys/net/if.c cvs rdiff -u -r1.218 -r1.219 src/sys/net/route.c cvs rdiff -u -r1.6 -r1.7 src/sys/rump/kern/lib/libsysproxy/sysproxy.c cvs rdiff -u -r1.41 -r1.42 src/sys/rump/librump/rumpkern/lwproc.c cvs rdiff -u -r1.333 -r1.334 src/sys/rump/librump/rumpkern/rump.c cvs rdiff -u -r1.182 -r1.183 src/sys/sys/lwp.h cvs rdiff -u -r1.3 -r1.4 src/sys/sys/psref.h cvs rdiff -u -r1.27 -r1.28 src/sys/sys/userret.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.