git: b50abe6bd45d - main - namei: Treat non-tied KLDs as if they had INVARIANTS enabled
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Mar 2022 14:17:27 UTC
The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=b50abe6bd45dde2baac130d4c4da097598c3b9c0 commit b50abe6bd45dde2baac130d4c4da097598c3b9c0 Author: Andrew Gallatin <gallatin@FreeBSD.org> AuthorDate: 2022-03-18 14:14:14 +0000 Commit: Andrew Gallatin <gallatin@FreeBSD.org> CommitDate: 2022-03-18 14:14:14 +0000 namei: Treat non-tied KLDs as if they had INVARIANTS enabled When working with a vendor to debug their kernel module, I found that a non-tied kld which uses NDINIT will panic due to "namei: bad debugflags " on a kernel compiled with INVARIANTS because non-tied KLDs do not pick up the initialization that is done in NDINIT_DBG/NDREINIT_DBG(). Fix this by making this initialization happen for non-KLD_TIED as well as INVARIANTS Reviewed by: mjg Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D34588 --- sys/sys/namei.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 23718dde5bed..98cbc2ca6ed9 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -228,8 +228,11 @@ int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, /* * Note the constant pattern may *hide* bugs. + * Note also that we enable debug checks for non-TIED KLDs + * so that they can run on an INVARIANTS kernel without tripping over + * assertions on ni_debugflags state. */ -#ifdef INVARIANTS +#if defined(INVARIANTS) || (defined(KLD_MODULE) && !defined(KLD_TIED)) #define NDINIT_PREFILL(arg) memset(arg, 0xff, offsetof(struct nameidata, \ ni_dvp_seqc)) #define NDINIT_DBG(arg) { (arg)->ni_debugflags = NAMEI_DBG_INITED; }