Commit Graph

52 Commits

Author SHA1 Message Date
jnemeth 30d0592bd3 allow passing a NULL proplib dictionary to modctl(MODCTL_LOAD, ...) 2009-10-16 00:27:07 +00:00
elad abc7a4290b Put module loading policy back in the subsystem.
Revisit: consider moving kauth_init() above module_init() in main().
2009-10-03 00:06:37 +00:00
elad 53ca19a3b3 First part of secmodel cleanup and other misc. changes:
- Separate the suser part of the bsd44 secmodel into its own secmodel
    and directory, pending even more cleanups. For revision history
    purposes, the original location of the files was

        src/sys/secmodel/bsd44/secmodel_bsd44_suser.c
        src/sys/secmodel/bsd44/suser.h

  - Add a man-page for secmodel_suser(9) and update the one for
    secmodel_bsd44(9).

  - Add a "secmodel" module class and use it. Userland program and
    documentation updated.

  - Manage secmodel count (nsecmodels) through the module framework.
    This eliminates the need for secmodel_{,de}register() calls in
    secmodel code.

  - Prepare for secmodel modularization by adding relevant module bits.
    The secmodels don't allow auto unload. The bsd44 secmodel depends
    on the suser and securelevel secmodels. The overlay secmodel depends
    on the bsd44 secmodel. As the module class is only cosmetic, and to
    prevent ambiguity, the bsd44 and overlay secmodels are prefixed with
    "secmodel_".

  - Adapt the overlay secmodel to recent changes (mainly vnode scope).

  - Stop using link-sets for the sysctl node(s) creation.

  - Keep sysctl variables under nodes of their relevant secmodels. In
    other words, don't create duplicates for the suser/securelevel
    secmodels under the bsd44 secmodel, as the latter is merely used
    for "grouping".

  - For the suser and securelevel secmodels, "advertise presence" in
    relevant sysctl nodes (sysctl.security.models.{suser,securelevel}).

  - Get rid of the LKM preprocessor stuff.

  - As secmodels are now modules, there's no need for an explicit call
    to secmodel_start(); it's handled by the module framework. That
    said, the module framework was adjusted to properly load secmodels
    early during system startup.

  - Adapt rump to changes: Instead of using empty stubs for securelevel,
    simply use the suser secmodel. Also replace secmodel_start() with a
    call to secmodel_suser_start().

  - 5.99.20.

Testing was done on i386 ("release" build). Spearated module_init()
changes were tested on sparc and sparc64 as well by martin@ (thanks!).

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/09/25/msg006135.html
2009-10-02 18:50:12 +00:00
dyoung 61fa5bb9be Make kobj_stat() return ENOSYS instead of panicking ("not modular")
on non-MODULAR kernels.  Make a few kobj_stat() callers check for
a non-zero return code and deal gracefully.
2009-06-17 21:04:25 +00:00
jnemeth cbd3656645 Add the MODCTL_NO_PROP flag to tell the kernel to ignore <module>.prop.
Add the '-P' option to modload(8) to set this flag.
2009-06-09 20:35:02 +00:00
jnemeth 32b670979a Add code to merge the modload "command line" with <module>.prop. 2009-06-09 19:09:03 +00:00
jnemeth 1bdbe18dce Read in a <module>.prop file if it exists and internalize then pass it
to the <module> being loaded.

XXX A <module>.prop file will override anything on the "command line".
This will be fixed in the next commit.
2009-06-07 09:47:31 +00:00
jnemeth d73b80a12b Move all namei flags handling into kobj_load_file().
When I originally wrote this, I was going for maximum flexibility.
However, after a private discussion with dholland@, I see how this
will cause problems with the future world order of namei whenever
that might be.  At the moment, I don't need the extra flexibility,
but if something comes up this may have to be revisited.
2009-05-26 08:34:22 +00:00
jnemeth a15ece476a Phase 0.5 of my options MODULAR enhancements. As suggested by ad@,
these commits move all path handling into module_do_load() from
kobj_load_file().  This way the final path used to load a module
is available for loading <module>.plist, which will store parameters
for a module.  The end goal of this project is good support for
MODULAR device drivers.
2009-05-25 22:33:00 +00:00
ad 27695c89cb ddb: don't try to stat builtin modules. 2009-05-24 14:54:17 +00:00
apb 0cc72e51ac Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.
2009-02-13 22:41:00 +00:00
rmind 6d73ddd355 Revert path of modules back to "/stand". 2009-01-24 22:14:44 +00:00
rmind f0e51651e4 Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0.  Proposed on <tech-kern>.
2009-01-24 00:29:12 +00:00
drochner dc83650fb8 add __gcc__ __format__ __string__ __attributes__ to catch mistakes early 2009-01-20 20:12:41 +00:00
christos 55d90fae57 - Don't autounload modules loaded during boot. In my case, ffs got unloaded
because my cdrom takes too long to initialize.
- Consistently print error messages in all error cases.
2008-12-28 03:21:02 +00:00
ad 8ff4eb83a8 Back out revision 1.35 which is no longer necessary and causes the system
to try autounloading modules perpetually.
2008-12-05 12:55:09 +00:00
ad 6efc20038a PR kern/40110: null, overlay and umap modules loading -> panic (layerfs symbols not there) 2008-12-05 12:51:17 +00:00
christos 579a92f63b PR/40097: bouyer@antioche.lip6.fr: MODULAR tries to unload non-module subsystems
Don't try to unload built-in modules, and if a module is busy don't retry
immediately.
2008-12-03 15:15:01 +00:00
ad 11701b3bf7 Add a couple of sysctls:
kern.module.autoload = 1
kern.module.verbose = 0
2008-12-03 12:14:11 +00:00
ad 6cddbf0ca5 Correct error messages added in revision 1.32. In part from drochner@. 2008-12-03 11:23:15 +00:00
christos 78d77f514f better error messages, and more messages for DIAGNOSTIC. 2008-11-27 21:36:51 +00:00
ad a5a0d68555 Print the size as decimal. 2008-11-25 15:15:28 +00:00
ad 31afc5b6d8 Add some basic DDB stuff for modules. 2008-11-25 15:14:07 +00:00
ad 950585e9b4 module_autoload: disallow path seperators and magic symlinks. 2008-11-19 13:07:42 +00:00
ad 2bae5b390e Some modules may want to avoid autounload because their use is transient.
Their FINI routine may legitimately succeed even though the module is likely
to be used soon again, for example: exec_script. Add a MODULE_CMD_AUTOUNLOAD
to query whether a module wants to avoid autounload.
2008-11-18 11:56:09 +00:00
ad f94a8f9142 - Put modules that depend on others at the head of the queue so autounload
can unload requisite modules with only one pass.

- If loading a requisite module, scan the global queue before checking the
  file system to see if it exists.  If it's already present we don't care.
2008-11-18 11:39:41 +00:00
ad 79d9beffc8 - If the system encounters a severe memory shortage, start unloading
unused kernel modules.
- Try to unload any autoloaded kernel modules 10 seconds after their
  load was successful.
- Keep a counter to track module load/unload events.
2008-11-14 23:06:45 +00:00
ad 0efea177e3 Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
2008-11-12 12:35:50 +00:00
ad 52e9644b6b Make MODCTL_LOAD_FORCE do something. 2008-10-22 11:19:15 +00:00
ad 7b228b5a9c - Be clear about whether module load is explicit or system initiated (auto).
- Require that module_lock is held to autoload, so that any preconditions
  can be safely checked.
2008-10-22 11:16:29 +00:00
pooka b629cd421b expose module_compatible() 2008-08-01 14:05:15 +00:00
ad 4c57df4a3c - Put in place module compatibility check against __NetBSD_Version__,
as discussed on tech-kern.

- Remove unused module_jettison().
2008-05-31 20:14:38 +00:00
ad 61270d54f1 If autoloading a module, don't consider the current working directory. 2008-05-20 19:20:38 +00:00
ad 88435c0e48 Remove stale comment. 2008-05-20 19:16:07 +00:00
ad 67280de1f2 Allow module class to be passed to module_load(), as a basic sanity check
that we are loading the right kind of module.
2008-05-20 17:24:56 +00:00
ad e69aa3297c Take $MACHINE into account when looking for modules. 2008-05-20 16:04:08 +00:00
ad 7a3561a8dc PR kern/38694 module dependencies do not work as expected
Autoload modules from the correct path based on kernel version.
2008-05-20 14:11:55 +00:00
ad d0bd9aa452 - Do local relocs before loading requisite modules, and all others only
after requisite modules have been loaded. For PR kern/38697.
- Simplify kobj interface slightly to make error handling easier.
2008-05-20 13:34:44 +00:00
rumble 7846a18697 Fix an error path that previously panicked when module_fetch_info failed. 2008-05-04 21:35:12 +00:00
ad 5d413581c7 Re-do yesterday's build fix to hook in the MD stuff if available. 2008-05-02 12:59:34 +00:00
ad 1bb1fee762 - Add module_find_section(), allows a module to look up data in its object.
- Work around build failure.
2008-05-01 17:23:16 +00:00
ad 8ef40c772a Get the pre-loaded module code working. 2008-05-01 14:44:48 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
jmmv 3fd8e29a11 Add support for load-time parameters for modules, which are passed through
a dictionary.  As discussed in tech-kern@.
2008-03-02 11:18:43 +00:00
rumble b5723bb617 Ensure that if kobj_load fails we do not call kobj_close followed by
kobj_unload, as an unloaded kobj will already have been freed by an
implicit kobj_unload call in kobj_close. This fixes random panics when a
module fails to load.
2008-01-19 18:20:39 +00:00
rumble 8a7c44d074 Ensure that circular dependencies do not panic the machine by doubly
locking the same file. Remove the special self-dependant case previously
introduced, as the general case handles it properly.
2008-01-19 00:57:35 +00:00
rumble cab5348539 Deal with braindead modules that depend on themselves, rather than inducing
an ambiguous panic later on.
2008-01-18 16:41:46 +00:00
rumble 81097194ca Avoid NULL pointer deref. 2008-01-18 14:29:44 +00:00
simonb 604b8b0477 Fix tyop in a KASSERT: s/mod_required/mod->mod_required/ 2008-01-18 01:41:55 +00:00
rumble 75030bbb1e Fix a panic that occurs when a dependency had already been loaded and a
dependant module is loaded by setting modp when returning ENOENT.

Also, be stricter with regards to MAXMODNAME.
2008-01-17 22:35:53 +00:00