diff --git a/sbin/modload/modload.8 b/sbin/modload/modload.8 index a35899fea6a7..bbfed2290102 100644 --- a/sbin/modload/modload.8 +++ b/sbin/modload/modload.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: modload.8,v 1.23 2003/02/25 10:34:59 wiz Exp $ +.\" $NetBSD: modload.8,v 1.24 2003/09/06 19:23:21 jdolecek Exp $ .\" .\" Copyright (c) 1993 Christopher G. Demetriou .\" All rights reserved. @@ -32,7 +32,7 @@ .\" .\" <> .\" -.Dd April 30, 1999 +.Dd September 6, 2003 .Dt MODLOAD 8 .Os .Sh NAME @@ -40,7 +40,7 @@ .Nd load a kernel module .Sh SYNOPSIS .Nm -.Op Fl dnvsS +.Op Fl dfnsSv .Op Fl A Ar kernel .Op Fl e Ar entry .Op Fl p Ar postinstall @@ -62,6 +62,14 @@ Debug. Used to debug .Nm itself. +.It Fl f +This forces load of the module, even if it doesn't match currently +running kernel. When LKM is loaded, kernel normally checks if the LKM +is compatible with the running kernel. This option disables this check. +.Em Note +incompatible LKM can cause system instability, including data loss +or corruption. Don't use this option unless you are sure what you +are doing. .It Fl n Do everything, except calling the module entry point (and any post-install program). diff --git a/sbin/modload/modload.c b/sbin/modload/modload.c index 10719f34523f..f24312362abf 100644 --- a/sbin/modload/modload.c +++ b/sbin/modload/modload.c @@ -1,4 +1,4 @@ -/* $NetBSD: modload.c,v 1.40 2003/07/13 07:45:27 itojun Exp $ */ +/* $NetBSD: modload.c,v 1.41 2003/09/06 19:23:20 jdolecek Exp $ */ /* * Copyright (c) 1993 Terrence R. Lambert. @@ -34,7 +34,7 @@ #include #ifndef lint -__RCSID("$NetBSD: modload.c,v 1.40 2003/07/13 07:45:27 itojun Exp $"); +__RCSID("$NetBSD: modload.c,v 1.41 2003/09/06 19:23:20 jdolecek Exp $"); #endif /* not lint */ #include @@ -69,6 +69,7 @@ __RCSID("$NetBSD: modload.c,v 1.40 2003/07/13 07:45:27 itojun Exp $"); int debug = 0; int verbose = 0; +u_long force = 0; char *out = NULL; int symtab = 0; int Sflag; @@ -121,7 +122,7 @@ usage(void) { fprintf(stderr, "usage:\n"); - fprintf(stderr, "modload [-d] [-v] [-n] [-s] [-S] " + fprintf(stderr, "modload [-dfnsSv] " "[-A ] [-e ]\n"); fprintf(stderr, " [-p ] [-o ] \n"); @@ -257,11 +258,14 @@ main(int argc, char **argv) void *modentry; /* XXX */ int noready = 0; - while ((c = getopt(argc, argv, "dnvse:p:o:A:ST:")) != -1) { + while ((c = getopt(argc, argv, "dfnvse:p:o:A:ST:")) != -1) { switch (c) { case 'd': debug = 1; break; /* debug */ + case 'f': + force = 1; + break; /* force load */ case 'v': verbose = 1; break; /* verbose */ @@ -440,6 +444,14 @@ main(int argc, char **argv) fileopen |= PART_RESRV; + if (force) { + if (ioctl(devfd, LMFORCE, &force) == -1) + err(10, "can't force load"); + + warnx("Forced load of LKM '%s'. MAY CAUSE SYSTEM INSTABILITY.", + modout); + } + /* * Relink at kernel load address */