git: bbfd41d4308b - stable/14 - alq, siftr: add panic/debugger checks to shutdown hooks
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Dec 2023 22:03:05 UTC
The branch stable/14 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bbfd41d4308be599a374ce8fba73b2d6ec990dcc commit bbfd41d4308be599a374ce8fba73b2d6ec990dcc Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2023-11-23 15:25:30 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2023-12-08 22:02:44 +0000 alq, siftr: add panic/debugger checks to shutdown hooks Don't try to gracefully terminate the pkt_manager thread if the scheduler is not running. We should not attempt to shutdown ald if RB_NOSYNC is set, and must not if the scheduler is stopped (the function calls wakeup()). Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42340 (cherry picked from commit d79a9edb5ce162c1ba49e12e5c93b894e6a25ad2) --- sys/kern/kern_alq.c | 14 +++++++++----- sys/netinet/siftr.c | 6 +++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c index 51fd66f2fe9f..1bcce92509c5 100644 --- a/sys/kern/kern_alq.c +++ b/sys/kern/kern_alq.c @@ -37,19 +37,20 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/alq.h> +#include <sys/eventhandler.h> +#include <sys/fcntl.h> #include <sys/kernel.h> #include <sys/kthread.h> #include <sys/lock.h> +#include <sys/malloc.h> #include <sys/mount.h> #include <sys/mutex.h> #include <sys/namei.h> #include <sys/proc.h> -#include <sys/vnode.h> -#include <sys/alq.h> -#include <sys/malloc.h> +#include <sys/reboot.h> #include <sys/unistd.h> -#include <sys/fcntl.h> -#include <sys/eventhandler.h> +#include <sys/vnode.h> #include <security/mac/mac_framework.h> @@ -228,6 +229,9 @@ ald_shutdown(void *arg, int howto) { struct alq *alq; + if ((howto & RB_NOSYNC) != 0 || SCHEDULER_STOPPED()) + return; + ALD_LOCK(); /* Ensure no new queues can be created. */ diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c index 58603e4aa53c..52e2b8838b0f 100644 --- a/sys/netinet/siftr.c +++ b/sys/netinet/siftr.c @@ -74,6 +74,7 @@ #include <sys/mutex.h> #include <sys/pcpu.h> #include <sys/proc.h> +#include <sys/reboot.h> #include <sys/sbuf.h> #include <sys/sdt.h> #include <sys/smp.h> @@ -1263,8 +1264,11 @@ siftr_sysctl_enabled_handler(SYSCTL_HANDLER_ARGS) } static void -siftr_shutdown_handler(void *arg) +siftr_shutdown_handler(void *arg, int howto) { + if ((howto & RB_NOSYNC) != 0 || SCHEDULER_STOPPED()) + return; + if (siftr_enabled == 1) { siftr_manage_ops(SIFTR_DISABLE); }