From: Emil Velikov Date: Wed, 18 Sep 2024 15:49:08 +0000 (+0100) Subject: tools/insmod: add --force longopt and document it X-Git-Tag: v34~310 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e102d2c070c869d8c9e097a1c1b1989b2faa9af6;p=thirdparty%2Fkmod.git tools/insmod: add --force longopt and document it As of the initial import to git, the option was silently ignored. Shortly afterwards, functionality was reinstated lacking a longopt and any documentation. As per insmod(8) for most use-cases you'd want to use modprobe(8). Although since the option is available and we have an equivalent in rmmod(8) having it documented and consistent triumphs. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/138 Signed-off-by: Lucas De Marchi --- diff --git a/man/insmod.8.scd b/man/insmod.8.scd index 4c6d1f7a..5c304aff 100644 --- a/man/insmod.8.scd +++ b/man/insmod.8.scd @@ -20,6 +20,12 @@ information about errors. # OPTIONS +*-f* +*--force* + This option can be extremely dangerous: it tells the kernel to ignore + the module version and vermagic fields when loading. With this option, + you can load modules build locally or by third parties, although this + can lead to memory corruption, system crashes and data loss. *-s* *--syslog* Send errors to syslog instead of standard error. diff --git a/tools/insmod.c b/tools/insmod.c index 7c8b385e..0f58f42e 100644 --- a/tools/insmod.c +++ b/tools/insmod.c @@ -18,6 +18,7 @@ static const char cmdopts_s[] = "fsvVh"; static const struct option cmdopts[] = { // clang-format off + { "force", no_argument, 0, 'f' }, { "syslog", no_argument, 0, 's' }, { "verbose", no_argument, 0, 'v' }, { "version", no_argument, 0, 'V' }, @@ -31,6 +32,8 @@ static void help(void) printf("Usage:\n" "\t%s [options] filename [args]\n" "Options:\n" + "\t-f, --force DANGEROUS: forces a module load, may cause\n" + "\t data corruption and crash your machine\n" "\t-s, --syslog print to syslog, not stderr\n" "\t-v, --verbose enables more messages\n" "\t-V, --version show version\n"