Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/kern_hook.c
RevisionDateAuthorComments
 1.15  17-Jan-2024  hannken Protect kernel hooks exechook, exithook and forkhook with rwlock.
Lock as writer on establish/disestablish and as reader on list traverse.

For exechook ride "exec_lock" as it is already take as reader when
traversing the list. Add local locks for exithook and forkhook.

Move exec_init before signal_init as signal_init calls exechook_establish()
that needs "exec_lock".

PR kern/39913 "exec, fork, exit hooks need locking"
 1.14  26-Oct-2022  riastradh branches: 1.14.2;
kern/kern_hook.c: Get exec_lock from sys/exec.h.
 1.13  31-May-2022  andvar fix various typos in comments, documentation and messages.
 1.12  03-Dec-2021  gson Only one space after comma
 1.11  30-Sep-2021  skrll Some platforms need sys/cpu.h for curlwp so #include it
 1.10  30-Sep-2021  skrll KNF
 1.9  30-Sep-2021  yamaguchi Introduce a generic linear hook list
 1.8  16-Oct-2019  christos Add and use __FPTRCAST, requested by uwe@
 1.7  16-Oct-2019  christos Add void * function pointer casts. There are different ways to "fix" those
warnings:
1. this one: add a void * cast (which I think is the least intrusive)
2. add pragmas to elide the warning
3. add intermediate inline conversion functions
4. change the called function prototypes, adding unused arguments and
converting some of the pointer arguments to void *.
5. make the functions varyadic (which defeats the purpose of checking)
6. pass command line flags to elide the warning
I did try 3 and 4 and I was not pleased with the result (sys_ptrace_common.c)
(3) added too much code and defines, and (4) made the regular use clumsy.
 1.6  22-Nov-2013  christos branches: 1.6.30;
convert vmem, signals, powerhooks from CIRCLEQ -> TAILQ.
 1.5  27-Oct-2012  chs branches: 1.5.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.4  11-Dec-2010  matt branches: 1.4.8; 1.4.18;
Add critpoll (critical polling) hooks. These are keep things like watchdogs
from firing when the system is doing stuff like waiting at a ddb prompt or
the kernel is doing a lot of printing.
 1.3  31-Jan-2010  martin branches: 1.3.4; 1.3.6;
This is using device_t, so it needs to include <sys/device.h>.
 1.2  31-Jan-2010  pooka Pass root device as a parameter to domountroothook().
 1.1  31-Jan-2010  pooka Place *hook implementations in kern_hook.c instead of them floating
around in the kern_subr.c gruel. Arrrrr.
 1.3.6.1  05-Mar-2011  rmind sync with head
 1.3.4.2  11-Mar-2010  yamt sync with head
 1.3.4.1  31-Jan-2010  yamt file kern_hook.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:16 +0000
 1.4.18.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.18.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.4.8.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.8.1  30-Oct-2012  yamt sync with head
 1.5.2.1  18-May-2014  rmind sync with head
 1.6.30.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.14.2.1  18-Apr-2024  martin Pull up following revision(s) (requested by hannken in ticket #668):

sys/miscfs/procfs/procfs.h: revision 1.83
sys/miscfs/procfs/procfs.h: revision 1.84
sys/kern/vfs_mount.c: revision 1.104
sys/miscfs/procfs/procfs_vnops.c: revision 1.230
sys/kern/init_main.c: revision 1.547
sys/kern/kern_hook.c: revision 1.15
sys/miscfs/procfs/procfs_vfsops.c: revision 1.112
sys/miscfs/procfs/procfs_vfsops.c: revision 1.113
sys/miscfs/procfs/procfs_vfsops.c: revision 1.114
sys/miscfs/procfs/procfs_subr.c: revision 1.117

Print dangling vnode before panic() to help debug.

PR kern/57775 ""panic: unmount: dangling vnode" while umounting procfs"
Protect kernel hooks exechook, exithook and forkhook with rwlock.

Lock as writer on establish/disestablish and as reader on list traverse.

For exechook ride "exec_lock" as it is already take as reader when
traversing the list. Add local locks for exithook and forkhook.

Move exec_init before signal_init as signal_init calls exechook_establish()
that needs "exec_lock".

PR kern/39913 "exec, fork, exit hooks need locking"

Add a hashmap to access all procfs nodes by pid.

Using the exechook to revoke procfs nodes is racy and may deadlock:
one thread runs doexechooks() -> procfs_revoke_vnodes() and wants to suspend
the file system for vgone(), while another thread runs a forced unmount,
has the file system suspended, tries to disestablish the exechook and
waits for doexechooks() to complete.

Establish/disestablish the exechook on module load/unload instead
mount/unmount and use the hashmap to access all procfs nodes for this pid.

May fix PR kern/57775 ""panic: unmount: dangling vnode" while umounting procfs"

Remove all procfs nodes for this process on process exit.

RSS XML Feed