git: 2b92b754f18c - main - kldxref: Be more conservative about what we reject.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Jan 2024 04:46:17 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2b92b754f18ce86e11e56f91c73aae8d89be80cc commit 2b92b754f18ce86e11e56f91c73aae8d89be80cc Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2024-01-29 04:45:03 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-01-29 04:45:23 +0000 kldxref: Be more conservative about what we reject. kldxref anything whose name doesn't end in .ko or that has no dots (eg the kernel). Sponsored by: Netflix Reviewed by: jrtc27, jhb Differential Revision: https://reviews.freebsd.org/D43507 --- usr.sbin/kldxref/kldxref.8 | 14 ++++++-------- usr.sbin/kldxref/kldxref.c | 7 ++++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/usr.sbin/kldxref/kldxref.8 b/usr.sbin/kldxref/kldxref.8 index 0b141bb18a1c..1704847592cd 100644 --- a/usr.sbin/kldxref/kldxref.8 +++ b/usr.sbin/kldxref/kldxref.8 @@ -50,14 +50,12 @@ file is created, and the preexisting hint file (if there was one in that directory) is removed. .Pp .Nm -ignores files with at least two "."s in the filename, such as -.Pa foo.ko.debug -or -.Pa bar.ko.pkgsave . -Note that this means that modules cannot have names such as -.Pa foo.bar.ko . -This limitation however, has been lived practice since the beginning of -FreeBSD's kernel modules. +only processes files that either have no dots in their name like +.Pa kernel +or that end in +.Dq .ko +like +.Pa foo.ko . .Pp The following options are available: .Bl -tag -width indent diff --git a/usr.sbin/kldxref/kldxref.c b/usr.sbin/kldxref/kldxref.c index 1694f069564b..1f06ad811d91 100644 --- a/usr.sbin/kldxref/kldxref.c +++ b/usr.sbin/kldxref/kldxref.c @@ -842,10 +842,11 @@ main(int argc, char *argv[]) continue; /* * Skip files that generate errors like .debug, .symbol and .pkgsave - * by generally skipping all files with 2 dots. + * by generally skipping all files not ending with ".ko" or that have + * no dots in the name (like kernel). */ - dot = strchr(p->fts_name, '.'); - if (dot && strchr(dot + 1, '.') != NULL) + dot = strrchr(p->fts_name, '.'); + if (dot != NULL && strcmp(dot, ".ko") != 0) continue; read_kld(p->fts_path, p->fts_name); }