The NetBSD Project

CVS log for src/sys/kern/kern_module.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.153 / (download) - annotate - [select for diffs], Thu Sep 16 21:29:42 2021 UTC (2 months, 1 week ago) by andvar
Branch: MAIN
CVS Tags: HEAD
Changes since 1.152: +3 -3 lines
Diff to previous 1.152 (unified)

fix typos in word "successfully", mainly s/succesfully/successfully/.

Revision 1.152 / (download) - annotate - [select for diffs], Fri Jun 11 23:41:47 2021 UTC (5 months, 2 weeks ago) by pgoyette
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-futex2-base, thorpej-futex2, thorpej-cfargs2-base, thorpej-cfargs2
Changes since 1.151: +3 -3 lines
Diff to previous 1.151 (unified)

Remove extraneous '\n' from debug message.

Revision 1.151 / (download) - annotate - [select for diffs], Thu Jun 11 19:20:46 2020 UTC (17 months, 2 weeks ago) by ad
Branch: MAIN
CVS Tags: thorpej-futex-base, thorpej-futex, thorpej-cfargs-base, thorpej-cfargs, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Branch point for: thorpej-i2c-spi-conf
Changes since 1.150: +3 -3 lines
Diff to previous 1.150 (unified)

uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched.  It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.

Revision 1.150 / (download) - annotate - [select for diffs], Mon Jun 8 20:19:50 2020 UTC (17 months, 3 weeks ago) by thorpej
Branch: MAIN
Changes since 1.149: +3 -3 lines
Diff to previous 1.149 (unified)

Update for proplib(3) API changes.

Revision 1.149 / (download) - annotate - [select for diffs], Sat Apr 4 19:50:54 2020 UTC (19 months, 3 weeks ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh
Changes since 1.148: +15 -2 lines
Diff to previous 1.148 (unified)

Infrastructure for putting kernel+modules in /netbsd/kernel and
/netbsd/modules respectively instead of /netbsd and
/stand/<arch>/<version>/modules.  This is only supported for x86,
and is turned off by default. To try it, add KERNEL_DIR=yes in your
/mk.conf and install a system from that build.

Revision 1.148 / (download) - annotate - [select for diffs], Fri Mar 20 23:09:01 2020 UTC (20 months, 1 week ago) by pgoyette
Branch: MAIN
Changes since 1.147: +4 -4 lines
Diff to previous 1.147 (unified)

Improve error message - at least indicate which value comes from the
module vs which was requested/wanted by the caller.

Revision 1.147 / (download) - annotate - [select for diffs], Sat Feb 22 19:51:57 2020 UTC (21 months, 1 week ago) by pgoyette
Branch: MAIN
CVS Tags: is-mlppp-base, is-mlppp, ad-namecache-base3
Changes since 1.146: +72 -4 lines
Diff to previous 1.146 (unified)

Teach module infrastructure to attach any static evcnts that might be
defined in a module, similar to the automatic invocation of sysctl(9)
setup functions.  As requested by riastradh@

Revision 1.146 / (download) - annotate - [select for diffs], Wed Jan 22 22:39:27 2020 UTC (22 months, 1 week ago) by pgoyette
Branch: MAIN
CVS Tags: ad-namecache-base2
Changes since 1.145: +6 -2 lines
Diff to previous 1.145 (unified)

Enhance debug message when autoloading a module.  Identify the pid
of the process that triggered the autoload, as well as its p_comm
and the status.

This is only triggered if you've requested DEBUG messages by setting
the kern.module.verbose sysctl(8) variable.

Revision 1.145 / (download) - annotate - [select for diffs], Tue Jan 21 15:26:36 2020 UTC (22 months, 1 week ago) by christos
Branch: MAIN
Changes since 1.144: +0 -79 lines
Diff to previous 1.144 (unified)

oops, undo this (committed accidentally)

Revision 1.144 / (download) - annotate - [select for diffs], Tue Jan 21 15:25:38 2020 UTC (22 months, 1 week ago) by christos
Branch: MAIN
Changes since 1.143: +81 -2 lines
Diff to previous 1.143 (unified)

Don't crash if we are on a hippie trail, head full of zombie

Revision 1.143 / (download) - annotate - [select for diffs], Tue Dec 31 13:07:13 2019 UTC (23 months ago) by ad
Branch: MAIN
CVS Tags: ad-namecache-base1, ad-namecache-base
Branch point for: ad-namecache
Changes since 1.142: +3 -3 lines
Diff to previous 1.142 (unified)

Rename uvm_free() -> uvm_availmem().

Revision 1.142 / (download) - annotate - [select for diffs], Sat Dec 21 13:00:24 2019 UTC (23 months, 1 week ago) by ad
Branch: MAIN
Changes since 1.141: +3 -3 lines
Diff to previous 1.141 (unified)

uvmexp.free -> uvm_free()

Revision 1.141 / (download) - annotate - [select for diffs], Thu Dec 12 22:55:20 2019 UTC (23 months, 2 weeks ago) by pgoyette
Branch: MAIN
Changes since 1.140: +2 -12 lines
Diff to previous 1.140 (unified)

Eliminate per-hook duplication of common code as suggested by
(and with major contributions from) riastradh@

Welcome to 9.99.23

Revision 1.140 / (download) - annotate - [select for diffs], Thu Dec 12 16:36:25 2019 UTC (23 months, 2 weeks ago) by pgoyette
Branch: MAIN
Changes since 1.139: +3 -2 lines
Diff to previous 1.139 (unified)

Make sure to #include to get required definitions.

Should fix the build break reported by martin@

Revision 1.139 / (download) - annotate - [select for diffs], Thu Dec 12 02:15:43 2019 UTC (23 months, 2 weeks ago) by pgoyette
Branch: MAIN
Changes since 1.138: +12 -2 lines
Diff to previous 1.138 (unified)

Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !

Revision 1.138 / (download) - annotate - [select for diffs], Thu Aug 8 18:08:41 2019 UTC (2 years, 3 months ago) by pgoyette
Branch: MAIN
CVS Tags: phil-wifi-20191119
Changes since 1.137: +10 -3 lines
Diff to previous 1.137 (unified)

When modules are unloaded, we call sysctl_teardown() before calling
the module's modcmd(CMD_FINI) code.  If the modcmd() call returns an
error, we attempted to re-instate the module's sysctl stuff.

This doesn't work well for built-in modulesi (where "unload" actually
means "disable"), since they don't have any ``struct kobj''.

So check first, and don't try to find the __link_set_sysctl_funcs for
built-in modules.

Revision 1.137 / (download) - annotate - [select for diffs], Wed Aug 7 00:38:02 2019 UTC (2 years, 3 months ago) by pgoyette
Branch: MAIN
Changes since 1.136: +42 -2 lines
Diff to previous 1.136 (unified)

Many years ago someone created a new __link_set_sysctl_funcs to hold
the list of routines that need to be called for setting up sysctl
variables.  This worked great for all code included in the kernel
itself, but didn't deal with modules that want to create their own
sysctl data.  So, we ended up with a lot of #ifdef _MODULE blocks
so modules could explicitly call their setup functions when loaded
as non-built-in modules.

So today, we complete the task that was started so many years ago.

When modules are loaded, after we've called xxx_modcmd(INIT...) we
check if the module contains its own __link_set_sysctl_funcs, and
if so we call the functions listed.  We add a struct sysctllog member
to the struct module so we can call sysctl_teardown() when the module
gets unloaded.  (The sequence of events ensures that the sysctl stuff
doesn't get created until the rest of the module's init code does any
required memory allocation.)

So, no more need to explicitly call the sysctl setup routines when
built as a loadable module.

Revision 1.136 / (download) - annotate - [select for diffs], Wed Jun 19 15:01:01 2019 UTC (2 years, 5 months ago) by pgoyette
Branch: MAIN
CVS Tags: netbsd-9-base, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9
Changes since 1.135: +17 -8 lines
Diff to previous 1.135 (unified)

In case of error resolving symbol references, we cannot rely on the
module's name still being available - it may be destroyed when
kobj_affix() unloads the object.  So make a copy of the name first
so we can use it in a useful error message.

(Without this, I've have affix errors go into an infinite loop
trying to print the error message!)

Revision 1.135 / (download) - annotate - [select for diffs], Tue Jun 11 15:20:57 2019 UTC (2 years, 5 months ago) by pgoyette
Branch: MAIN
Changes since 1.134: +3 -3 lines
Diff to previous 1.134 (unified)

Improve error message

Revision 1.134 / (download) - annotate - [select for diffs], Mon Apr 8 11:32:49 2019 UTC (2 years, 7 months ago) by pgoyette
Branch: MAIN
CVS Tags: phil-wifi-20190609, isaki-audio2-base, isaki-audio2
Changes since 1.133: +10 -3 lines
Diff to previous 1.133 (unified)

Improve kernel module validation.  First, set a limit on how much of the
module name field to check when validation name's length.  Second, check
the module's mi_class to ensure it is valid.

Update the commenet in sys/module.h to indicate that the module classes
are now being validated.

Revision 1.133 / (download) - annotate - [select for diffs], Sun Jan 27 02:08:43 2019 UTC (2 years, 10 months ago) by pgoyette
Branch: MAIN
Changes since 1.132: +109 -66 lines
Diff to previous 1.132 (unified)

Merge the [pgoyette-compat] branch

Revision 1.132 / (download) - annotate - [select for diffs], Mon Sep 3 16:29:35 2018 UTC (3 years, 2 months ago) by riastradh
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906
Changes since 1.131: +3 -3 lines
Diff to previous 1.131 (unified)

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)

Revision 1.131 / (download) - annotate - [select for diffs], Mon May 28 21:04:40 2018 UTC (3 years, 6 months ago) by chs
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-0728, pgoyette-compat-0625
Branch point for: phil-wifi
Changes since 1.130: +212 -27 lines
Diff to previous 1.130 (unified)

add more accessor functions for various struct module fields.
add a mechanism for registering callbacks to be called upon module load/unload.

Revision 1.130 / (download) - annotate - [select for diffs], Thu Dec 14 22:28:59 2017 UTC (3 years, 11 months ago) by pgoyette
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Changes since 1.129: +17 -14 lines
Diff to previous 1.129 (unified)

Remove the check for duplicate-module-name-on-pending-list since it really
doesn't help.  The check really cannot fail, and it only looks at the list
belonging to the current level of recursion.

Instead, verify that the module's modcmd(MODULE_CMD_INIT, ...) does not
introduce a duplicate module name as a result of recursively calling
module_do_load().

Revision 1.129 / (download) - annotate - [select for diffs], Thu Dec 14 11:45:40 2017 UTC (3 years, 11 months ago) by pgoyette
Branch: MAIN
Changes since 1.128: +10 -2 lines
Diff to previous 1.128 (unified)

When looking for a duplicate module name, also check the pending list.

Revision 1.128 / (download) - annotate - [select for diffs], Thu Dec 14 10:39:32 2017 UTC (3 years, 11 months ago) by martin
Branch: MAIN
Changes since 1.127: +6 -4 lines
Diff to previous 1.127 (unified)

Change a KASSERTMSG into a regular module_error - not nice for the kernel
to panic when I try to modload the 'ntfs' module.

Revision 1.127 / (download) - annotate - [select for diffs], Mon Dec 11 22:00:26 2017 UTC (3 years, 11 months ago) by pgoyette
Branch: MAIN
Changes since 1.126: +4 -3 lines
Diff to previous 1.126 (unified)

Use KASSERT to ensure that the newly-added module's name can be found.

XXX Pull-up to -8

Revision 1.126 / (download) - annotate - [select for diffs], Sun Dec 10 03:08:32 2017 UTC (3 years, 11 months ago) by pgoyette
Branch: MAIN
Changes since 1.125: +19 -2 lines
Diff to previous 1.125 (unified)

Add additional duplicate-module-name check in case we have two modules
with the same internal name but no conflicting symbol definitions.

When we load a module from the file system, the filename may have no
relationship to the internal module's name.  Furthermore, comparing
the module's filename is insufficient if the file is loaded from an
absolute path.

XXX pullup to netbsd-8

Revision 1.125 / (download) - annotate - [select for diffs], Thu Jun 1 02:45:13 2017 UTC (4 years, 6 months ago) by chs
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825, netbsd-8-base, matt-nb8-mediatek-base, matt-nb8-mediatek
Branch point for: netbsd-8
Changes since 1.124: +5 -7 lines
Diff to previous 1.124 (unified)

remove checks for failure after memory allocation calls that cannot fail:

  kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.

Revision 1.124 / (download) - annotate - [select for diffs], Tue Apr 18 18:07:29 2017 UTC (4 years, 7 months ago) by christos
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, bouyer-socketcan-base1
Changes since 1.123: +2 -11 lines
Diff to previous 1.123 (unified)

PR/52174: Remove root test, it is too verbose. XXX: need to come up with
something better.

Revision 1.123 / (download) - annotate - [select for diffs], Tue Apr 11 21:15:57 2017 UTC (4 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.122: +3 -3 lines
Diff to previous 1.122 (unified)

use a different root vnode variable to appease the rump gods.

Revision 1.122 / (download) - annotate - [select for diffs], Tue Apr 11 14:37:07 2017 UTC (4 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.121: +3 -3 lines
Diff to previous 1.121 (unified)

return EPERM like the other failures.

Revision 1.121 / (download) - annotate - [select for diffs], Tue Apr 11 14:31:55 2017 UTC (4 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.120: +11 -2 lines
Diff to previous 1.120 (unified)

Don't try to autoload modules before root is mounted.

Revision 1.120 / (download) - annotate - [select for diffs], Wed Feb 1 01:51:07 2017 UTC (4 years, 9 months ago) by maya
Branch: MAIN
CVS Tags: pgoyette-localcount-20170320, nick-nhusb-base-20170204, jdolecek-ncq-base, jdolecek-ncq
Changes since 1.119: +18 -7 lines
Diff to previous 1.119 (unified)

restore r1.118

Revision 1.119 / (download) - annotate - [select for diffs], Tue Dec 27 09:34:44 2016 UTC (4 years, 11 months ago) by maya
Branch: MAIN
CVS Tags: pgoyette-localcount-20170107, bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.118: +5 -16 lines
Diff to previous 1.118 (unified)

Revert previous commit (to r1.117)

Superfluous warnings in simple userland programs is not a valid reason to
break a security model.

Revision 1.118 / (download) - annotate - [select for diffs], Fri Dec 9 13:06:41 2016 UTC (4 years, 11 months ago) by roy
Branch: MAIN
Changes since 1.117: +18 -7 lines
Diff to previous 1.117 (unified)

When loading a kernel, test if it's already loaded before authorizing.
This allows us to return EEXIST instead of EPERM for higher secure levels.

My use case was to stop npfctl complaining that it could not load bpfjit
on ERLITE when it was compiled into the kernel.
It then went on to complain that NPF performance would be de-graded,
but this is clearly not the case.

Revision 1.117 / (download) - annotate - [select for diffs], Sat Aug 13 12:05:49 2016 UTC (5 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-20161104, nick-nhusb-base-20161204, nick-nhusb-base-20161004, localcount-20160914
Changes since 1.116: +7 -6 lines
Diff to previous 1.116 (unified)

tidy up messages and indentation

Revision 1.116 / (download) - annotate - [select for diffs], Thu Aug 4 06:13:15 2016 UTC (5 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-20160806
Changes since 1.115: +17 -13 lines
Diff to previous 1.115 (unified)

Print the parent module that asked for the builtin to be loaded and failed.
XXX: if a driver is built-in why can't it ask for a filesystem module to
be loaded?

Revision 1.115 / (download) - annotate - [select for diffs], Thu Jul 7 06:55:43 2016 UTC (5 years, 4 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20160726, nick-nhusb-base-20160907
Branch point for: pgoyette-localcount
Changes since 1.114: +3 -3 lines
Diff to previous 1.114 (unified)

KNF. Remove extra spaces. No functional change.

Revision 1.114 / (download) - annotate - [select for diffs], Mon Jul 4 23:55:54 2016 UTC (5 years, 4 months ago) by pgoyette
Branch: MAIN
Changes since 1.113: +5 -5 lines
Diff to previous 1.113 (unified)

Don't declare module_verbose_on or module_autoload_on static.  It is useful
for these variables to be global, so they can be modified by ddb(4)
(entered via "boot -d") early in startup.

Revision 1.113 / (download) - annotate - [select for diffs], Fri Jun 24 23:04:09 2016 UTC (5 years, 5 months ago) by pgoyette
Branch: MAIN
Changes since 1.112: +5 -8 lines
Diff to previous 1.112 (unified)

Simplfy insertion of newly-activated modules into the list.  There's no
good reason to treat modules without dependencies differently from those
which do require other modules.

Revision 1.112 / (download) - annotate - [select for diffs], Thu Jun 23 04:41:03 2016 UTC (5 years, 5 months ago) by pgoyette
Branch: MAIN
Changes since 1.111: +19 -9 lines
Diff to previous 1.111 (unified)

When importing modules from the boot loader we should check for duplicate
module names both in the built-in list and in the list of previously
"pushed" modules.

While here, delay allocating the new 'struct module' until we've passed
the duplicate-name checks.

Revision 1.111 / (download) - annotate - [select for diffs], Thu Jun 16 23:09:44 2016 UTC (5 years, 5 months ago) by pgoyette
Branch: MAIN
Changes since 1.110: +18 -4 lines
Diff to previous 1.110 (unified)

Check for duplicate module names before loading modules that were
"pushed" by the boot loader.  The boot loader pushes the module
name for the root file system (unless the root file system is ffs)
even if the file system module is built into the kernel.  When
this happens, we get a lot of "redefined symbol" error messages.

This fix does not alter the behavior of pushing the file system
name.  It simply avoids the redefined symbol errors by detecting
that the module is already built-in to the kernel and not trying
to load another copy.

While here, differentiate the error message text between "failed
to load" and "failed to fetch_info" conditions.

Addresses PR kern/50357

Revision 1.110 / (download) - annotate - [select for diffs], Sat Feb 6 22:48:07 2016 UTC (5 years, 9 months ago) by pgoyette
Branch: MAIN
CVS Tags: nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319
Changes since 1.109: +13 -28 lines
Diff to previous 1.109 (unified)

In module_do_load(), consolidate checking for a pre-existing module,
and return a single error value EEXIST.  When making a recursive
call (to load required modules), treat a pre-existing module as
success.

Without this change, when a module was loaded by specific request
(as opposed to being loaded as a requirement of some other module),
we would always load the module from the file-system, and then
after making various sanity/compatability checks we would destroy
the new copy if there was a pre-existing copy.

Fixes PR kern/40764

XXX Note that if the module exists, we bypass all of the various
XXX "compatability" checks, including whether or not the existing
XXX module is of any particular class!  (In the previous code, we
XXX checked to see if the newly-loaded copy had the correct class,
XXX but not the pre-existing copy, which could have been loaded
XXX from a different path/filename.)

Revision 1.109 / (download) - annotate - [select for diffs], Wed Dec 9 16:26:16 2015 UTC (5 years, 11 months ago) by maxv
Branch: MAIN
CVS Tags: nick-nhusb-base-20151226
Changes since 1.108: +5 -5 lines
Diff to previous 1.108 (unified)

KNF

Revision 1.108 / (download) - annotate - [select for diffs], Tue Nov 3 03:33:43 2015 UTC (6 years ago) by pgoyette
Branch: MAIN
Changes since 1.107: +3 -3 lines
Diff to previous 1.107 (unified)

Remove extraneous ')' from previous.

Revision 1.107 / (download) - annotate - [select for diffs], Tue Nov 3 02:04:12 2015 UTC (6 years ago) by pgoyette
Branch: MAIN
Changes since 1.106: +15 -4 lines
Diff to previous 1.106 (unified)

Add some additional status messages for kern.module.verbose=TRUE

Revision 1.106 / (download) - annotate - [select for diffs], Mon Jun 22 16:35:13 2015 UTC (6 years, 5 months ago) by matt
Branch: MAIN
CVS Tags: nick-nhusb-base-20150921
Changes since 1.105: +3 -3 lines
Diff to previous 1.105 (unified)

Make module_machine const char *

Revision 1.105 / (download) - annotate - [select for diffs], Sun Mar 8 01:17:42 2015 UTC (6 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: nick-nhusb-base-20150606, nick-nhusb-base-20150406
Changes since 1.104: +3 -3 lines
Diff to previous 1.104 (unified)

Fix thinko

Revision 1.104 / (download) - annotate - [select for diffs], Sat Mar 7 23:20:19 2015 UTC (6 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.103: +4 -4 lines
Diff to previous 1.103 (unified)

Fix compilation.

Revision 1.103 / (download) - annotate - [select for diffs], Sat Feb 28 23:04:34 2015 UTC (6 years, 9 months ago) by jmcneill
Branch: MAIN
Changes since 1.102: +4 -3 lines
Diff to previous 1.102 (unified)

if the root file-system is not yet mounted, hide "vfs load failed" spam with options DEBUG

Revision 1.102 / (download) - annotate - [select for diffs], Tue Dec 2 13:00:38 2014 UTC (6 years, 11 months ago) by pooka
Branch: MAIN
Changes since 1.101: +2 -3 lines
Diff to previous 1.101 (unified)

print kernel module path only in kernels which support paths

Revision 1.101 / (download) - annotate - [select for diffs], Fri Sep 5 06:50:58 2014 UTC (7 years, 2 months ago) by matt
Branch: MAIN
CVS Tags: nick-nhusb-base
Branch point for: nick-nhusb
Changes since 1.100: +3 -3 lines
Diff to previous 1.100 (unified)

Missed a C++ keyword (DEBUG case)

Revision 1.100 / (download) - annotate - [select for diffs], Fri Sep 5 05:57:21 2014 UTC (7 years, 2 months ago) by matt
Branch: MAIN
Changes since 1.99: +19 -19 lines
Diff to previous 1.99 (unified)

Don't next structure and enum definitions.
Don't use C++ keywords new, try, class, private, etc.

Revision 1.99 / (download) - annotate - [select for diffs], Sun Aug 24 11:36:11 2014 UTC (7 years, 3 months ago) by nonaka
Branch: MAIN
Changes since 1.98: +3 -3 lines
Diff to previous 1.98 (unified)

fix typo. (s/MODULE_DEFAULT_AUTOLOAD/MODULAR_DEFAULT_AUTOLOAD/)

Revision 1.98 / (download) - annotate - [select for diffs], Sun Aug 24 07:59:23 2014 UTC (7 years, 3 months ago) by jnemeth
Branch: MAIN
Changes since 1.97: +6 -2 lines
Diff to previous 1.97 (unified)

Create an "options MODULAR_DEFAULT_AUTOLOAD" config option and add
it to all kernel configs that contain "options MODULAR".  This
option turns on module autoloading by default (which is the current
default).  This allows people who don't want module autoloading on
by default to disable it by simply removing/commentting this line.

Revision 1.97 / (download) - annotate - [select for diffs], Mon Aug 11 03:43:25 2014 UTC (7 years, 3 months ago) by jnemeth
Branch: MAIN
CVS Tags: tls-maxphys-base, netbsd-7-base
Branch point for: netbsd-7
Changes since 1.96: +9 -2 lines
Diff to previous 1.96 (unified)

Add the infrastructure for MODULAR support for Xen kernels.  At
the moment, this can only load very simple modules due to missing
symbols.  It is being add at this time to make pullups to the
netbsd-7 branch easier.  It is not enabled by default in any kernels.

Revision 1.96 / (download) - annotate - [select for diffs], Mon Jul 14 16:06:48 2014 UTC (7 years, 4 months ago) by maxv
Branch: MAIN
CVS Tags: tls-earlyentropy-base
Changes since 1.95: +5 -4 lines
Diff to previous 1.95 (unified)

Tell which dependency has failed

Revision 1.95 / (download) - annotate - [select for diffs], Tue Feb 25 18:30:11 2014 UTC (7 years, 9 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-pagecache-base9, rmind-smpnet-nbase, rmind-smpnet-base, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Branch point for: tls-earlyentropy
Changes since 1.94: +2 -7 lines
Diff to previous 1.94 (unified)

Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.

Revision 1.94 / (download) - annotate - [select for diffs], Sun Dec 15 21:09:50 2013 UTC (7 years, 11 months ago) by pgoyette
Branch: MAIN
Changes since 1.93: +38 -6 lines
Diff to previous 1.93 (unified)

Make the auto-unload timeout configurable via sysctl, and if the timeout
is set to zero, disable all auto-unloads (even those that were "scheduled"
previously).

Revision 1.93 / (download) - annotate - [select for diffs], Fri Sep 13 07:18:34 2013 UTC (8 years, 2 months ago) by jnemeth
Branch: MAIN
Changes since 1.92: +3 -3 lines
Diff to previous 1.92 (unified)

fix compilation error; hi christos!

Revision 1.92 / (download) - annotate - [select for diffs], Thu Sep 12 19:02:05 2013 UTC (8 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.91: +11 -4 lines
Diff to previous 1.91 (unified)

Silence some common module load errors and explain why.

Revision 1.91 / (download) - annotate - [select for diffs], Sun Mar 24 22:06:37 2013 UTC (8 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, khorben-n900
Branch point for: rmind-smpnet
Changes since 1.90: +4 -2 lines
Diff to previous 1.90 (unified)

downgrade an error to debug.

Revision 1.90 / (download) - annotate - [select for diffs], Sun Mar 10 04:25:06 2013 UTC (8 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: agc-symver-base, agc-symver
Changes since 1.89: +36 -25 lines
Diff to previous 1.89 (unified)

more detailed/consistent error messages.

Revision 1.89 / (download) - annotate - [select for diffs], Tue Mar 5 03:04:00 2013 UTC (8 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.88: +4 -12 lines
Diff to previous 1.88 (unified)

remove extra chatty messages

Revision 1.88 / (download) - annotate - [select for diffs], Sun Mar 3 16:55:26 2013 UTC (8 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.87: +29 -8 lines
Diff to previous 1.87 (unified)

more debugging

Revision 1.87 / (download) - annotate - [select for diffs], Tue Feb 12 19:14:50 2013 UTC (8 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.86: +4 -4 lines
Diff to previous 1.86 (unified)

Can you please tell us the module name that had the wrong version? Thanks.

Revision 1.86 / (download) - annotate - [select for diffs], Sun Dec 4 19:24:59 2011 UTC (9 years, 11 months ago) by jym
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2, jmcneill-usbmp-base10
Branch point for: tls-maxphys
Changes since 1.85: +2 -9 lines
Diff to previous 1.85 (unified)

Implement the register/deregister/evaluation API for secmodel(9). It
allows registration of callbacks that can be used later for
cross-secmodel "safe" communication.

When a secmodel wishes to know a property maintained by another
secmodel, it has to submit a request to it so the other secmodel can
proceed to evaluating the request. This is done through the
secmodel_eval(9) call; example:

    bool isroot;
    error = secmodel_eval("org.netbsd.secmodel.suser", "is-root",
        cred, &isroot);
    if (error == 0 && !isroot)
            result = KAUTH_RESULT_DENY;

This one asks the suser module if the credentials are assumed to be root
when evaluated by suser module. If the module is present, it will
respond. If absent, the call will return an error.

Args and command are arbitrarily defined; it's up to the secmodel(9) to
document what it expects.

Typical example is securelevel testing: when someone wants to know
whether securelevel is raised above a certain level or not, the caller
has to request this property to the secmodel_securelevel(9) module.
Given that securelevel module may be absent from system's context (thus
making access to the global "securelevel" variable impossible or
unsafe), this API can cope with this absence and return an error.

We are using secmodel_eval(9) to implement a secmodel_extensions(9)
module, which plugs with the bsd44, suser and securelevel secmodels
to provide the logic behind curtain, usermount and user_set_cpu_affinity
modes, without adding hooks to traditional secmodels. This solves a
real issue with the current secmodel(9) code, as usermount or
user_set_cpu_affinity are not really tied to secmodel_suser(9).

The secmodel_eval(9) is also used to restrict security.models settings
when securelevel is above 0, through the "is-securelevel-above"
evaluation:
- curtain can be enabled any time, but cannot be disabled if
securelevel is above 0.
- usermount/user_set_cpu_affinity can be disabled any time, but cannot
be enabled if securelevel is above 0.

Regarding sysctl(7) entries:
curtain and usermount are now found under security.models.extensions
tree. The security.curtain and vfs.generic.usermount are still
accessible for backwards compat.

Documentation is incoming, I am proof-reading my writings.

Written by elad@, reviewed and tested (anita test + interact for rights
tests) by me. ok elad@.

See also
http://mail-index.netbsd.org/tech-security/2011/11/29/msg000422.html

XXX might consider va0 mapping too.

XXX Having a secmodel(9) specific printf (like aprint_*) for reporting
secmodel(9) errors might be a good idea, but I am not sure on how
to design such a function right now.

Revision 1.85 / (download) - annotate - [select for diffs], Mon Nov 28 03:13:31 2011 UTC (10 years ago) by jnemeth
Branch: MAIN
CVS Tags: jmcneill-usbmp-pre-base2, jmcneill-usbmp-base
Branch point for: jmcneill-usbmp
Changes since 1.84: +4 -3 lines
Diff to previous 1.84 (unified)

Move "unloaded module" debug message higher as it appears that name
sometimes points to memory that gets freed causing the system to crash.

Revision 1.84 / (download) - annotate - [select for diffs], Sun Nov 6 12:40:04 2011 UTC (10 years ago) by tron
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, jmcneill-audiomp3-base, jmcneill-audiomp3
Changes since 1.83: +3 -3 lines
Diff to previous 1.83 (unified)

Return ENOEXEC instead of 0 if the info of a kernel module doesn't have the
expected size. This prevents kernel panics when loading broken modules.

Revision 1.83 / (download) - annotate - [select for diffs], Tue Oct 18 12:25:31 2011 UTC (10 years, 1 month ago) by jmcneill
Branch: MAIN
CVS Tags: yamt-pagecache-base
Branch point for: yamt-pagecache
Changes since 1.82: +10 -2 lines
Diff to previous 1.82 (unified)

Don't try to auto-unload modules unless they were auto-loaded.

Revision 1.82 / (download) - annotate - [select for diffs], Mon Sep 19 00:40:22 2011 UTC (10 years, 2 months ago) by pgoyette
Branch: MAIN
Changes since 1.81: +4 -3 lines
Diff to previous 1.81 (unified)

When "loading" a built-in module needs to autoload a dependant module
which is not already loaded (or was loaded, and then unloaded), make
sure we return a pointer to the built-in module.  Otherwise, when the
initial module tries to update its dependancies' reference counts, we
trigger a KASSERT in module_enqueue().

Revision 1.81 / (download) - annotate - [select for diffs], Wed Sep 14 12:29:22 2011 UTC (10 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.80: +4 -4 lines
Diff to previous 1.80 (unified)

don't increment the number of referenced module as a side effect if we fail.
From jmcneill

Revision 1.80 / (download) - annotate - [select for diffs], Sat Aug 13 21:04:06 2011 UTC (10 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.79: +4 -4 lines
Diff to previous 1.79 (unified)

Always provide a meaningful short name for the kobj in the error message,
as well as the function name and the linenumber, without extra line feeds.

Revision 1.79 / (download) - annotate - [select for diffs], Sun Jul 17 20:54:52 2011 UTC (10 years, 4 months ago) by joerg
Branch: MAIN
Changes since 1.78: +2 -4 lines
Diff to previous 1.78 (unified)

Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.

Revision 1.78 / (download) - annotate - [select for diffs], Sun Apr 17 05:16:28 2011 UTC (10 years, 7 months ago) by mrg
Branch: MAIN
CVS Tags: rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base, cherry-xenmp
Changes since 1.77: +7 -4 lines
Diff to previous 1.77 (unified)

add a "module_machine", that defaults to machine.
allows MD code to override the default subdir for modules.

Revision 1.77 / (download) - annotate - [select for diffs], Sat Apr 2 08:11:31 2011 UTC (10 years, 8 months ago) by mbalmer
Branch: MAIN
Changes since 1.76: +3 -3 lines
Diff to previous 1.76 (unified)

Fix misplaced parenthesis.  From henning.petersen@t-online.de, thanks.

Revision 1.76 / (download) - annotate - [select for diffs], Mon Feb 21 09:53:06 2011 UTC (10 years, 9 months ago) by pooka
Branch: MAIN
CVS Tags: bouyer-quota2-nbase
Changes since 1.75: +11 -2 lines
Diff to previous 1.75 (unified)

Don't allow disabling a builtin secmodel: too many questionable
security implications.

Revision 1.75 / (download) - annotate - [select for diffs], Fri Jan 14 10:18:21 2011 UTC (10 years, 10 months ago) by martin
Branch: MAIN
CVS Tags: jruoho-x86intr-base, bouyer-quota2-base
Branch point for: jruoho-x86intr, bouyer-quota2
Changes since 1.74: +4 -4 lines
Diff to previous 1.74 (unified)

Using "int" variables with sysctl's CTLTYPE_BOOL is a simple receipt to
loose on big endian machines. So make the variables "bool".

Revision 1.74 / (download) - annotate - [select for diffs], Wed Dec 29 15:07:36 2010 UTC (10 years, 11 months ago) by pooka
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231
Changes since 1.73: +10 -9 lines
Diff to previous 1.73 (unified)

Pass potential prop dictionary to modcmd when reenabling a builtin
module.

Revision 1.73 / (download) - annotate - [select for diffs], Sat Oct 16 18:09:02 2010 UTC (11 years, 1 month ago) by pgoyette
Branch: MAIN
CVS Tags: uebayasi-xip-base4, uebayasi-xip-base3
Changes since 1.72: +2 -3 lines
Diff to previous 1.72 (unified)

Remove double-inclusion of <sys/kauth.c>

Revision 1.72 / (download) - annotate - [select for diffs], Sat Aug 21 13:17:31 2010 UTC (11 years, 3 months ago) by pgoyette
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11
Changes since 1.71: +75 -60 lines
Diff to previous 1.71 (unified)

Define a set of new kernel locking primitives to implement the recursive
kernconfig_mutex.  Update module subsystem to use this mutex rather than
its own internal (non-recursive) mutex.  Make module_autoload() do its
own locking to be consistent with the rest of the module_xxx() calls.
Update module(9) man page appropriately.

As discussed on tech-kern over the last few weeks.

Welcome to NetBSD 5.99.39 !

Revision 1.71 / (download) - annotate - [select for diffs], Wed Aug 11 12:04:49 2010 UTC (11 years, 3 months ago) by pgoyette
Branch: MAIN
CVS Tags: uebayasi-xip-base2
Changes since 1.70: +3 -3 lines
Diff to previous 1.70 (unified)

Keep condvar wmesg within 8 char limit

Revision 1.70 / (download) - annotate - [select for diffs], Sat Jun 26 07:23:57 2010 UTC (11 years, 5 months ago) by pgoyette
Branch: MAIN
CVS Tags: yamt-nfs-mp-base10
Changes since 1.69: +70 -20 lines
Diff to previous 1.69 (unified)

1. Add an allocator for 'struct module *' and use it instead of local
   allocations.

2. Add a new member mod_flags to the 'struct module *' and define
   MODFLG_MUST_FORCE.  If this flag is set and the entry is on the list
   of builtins, it means that the module has been explicitly unloaded
   and any re-loads will require the MODCTL_LOAD_FORCE flag. Provide a
   module_require_force() method to set this flag;  once set, it should
   never be unset.

3. Rename original module_init2() to module_start_unload_thread() to be
   more descriptive of what it does.

4. Add a new module_builtin_require_force() routine that sets the
   MODFLG_MUST_FORCE flag for any module that has not yet successfully
   been initialized.  Call it after module_init_class(MODULE_CLASS_ANY)
   to disable remaining built-in modules.

This makes built-in versions of the xxxVERBOSE modules work once more,
resolving breakage reported by jruoho@ and njoly@.

Discussed on tech-kern, and comments and suggestions implemented.  No
additional discussion for last week.  Tested only on amd64 systems, but
there's nothing here that should be port- or architecture-specific (no
more specific than existing module implementation) so others should not
break.

Revision 1.69 / (download) - annotate - [select for diffs], Wed May 26 23:53:21 2010 UTC (11 years, 6 months ago) by pooka
Branch: MAIN
Changes since 1.68: +14 -7 lines
Diff to previous 1.68 (unified)

Feed dust to a few linkset uses and explicitly call the constructor.

Revision 1.68 / (download) - annotate - [select for diffs], Mon May 24 16:37:17 2010 UTC (11 years, 6 months ago) by pgoyette
Branch: MAIN
Changes since 1.67: +4 -2 lines
Diff to previous 1.67 (unified)

Move definition of module_load_vfs_vec from kern_module_vfs.c to
kern_module.c - keeps rump happy.

Thanks, pooka!

Revision 1.67 / (download) - annotate - [select for diffs], Mon May 24 15:34:48 2010 UTC (11 years, 6 months ago) by pgoyette
Branch: MAIN
Changes since 1.66: +4 -25 lines
Diff to previous 1.66 (unified)

Clean up kern_module.c rev 1.66, thanks to pooka@ for review & suggestions

Revision 1.66 / (download) - annotate - [select for diffs], Mon May 24 03:50:25 2010 UTC (11 years, 6 months ago) by pgoyette
Branch: MAIN
Changes since 1.65: +19 -6 lines
Diff to previous 1.65 (unified)

Protect against attempting to load modules from the filesystem until we
have mounted the root file-system.  This allows us to load built-in and
boot-loader-provided modules much earlier during startup.

Revision 1.65 / (download) - annotate - [select for diffs], Sun May 2 11:01:03 2010 UTC (11 years, 7 months ago) by pooka
Branch: MAIN
Changes since 1.64: +11 -4 lines
Diff to previous 1.64 (unified)

If a builtin dependency is missing, error instead of panic.  As
pointed out by martin, configurations like builtin nfsserver can
be succesfully linked without including all dependencies (specifically,
nfs).  Until all such weirdosities are fixed, opt for at least a
semifunctional system.

Revision 1.64 / (download) - annotate - [select for diffs], Mon Apr 19 11:20:56 2010 UTC (11 years, 7 months ago) by jruoho
Branch: MAIN
CVS Tags: uebayasi-xip-base1
Changes since 1.63: +4 -4 lines
Diff to previous 1.63 (unified)

Use CTLTYPE_BOOL.

Revision 1.63 / (download) - annotate - [select for diffs], Fri Apr 16 11:51:23 2010 UTC (11 years, 7 months ago) by pooka
Branch: MAIN
Changes since 1.62: +20 -3 lines
Diff to previous 1.62 (unified)

Don't loop eternal if init of a builtin module fails.

Revision 1.62 / (download) - annotate - [select for diffs], Thu Mar 18 18:25:45 2010 UTC (11 years, 8 months ago) by pooka
Branch: MAIN
Changes since 1.61: +6 -4 lines
Diff to previous 1.61 (unified)

Print builtin "use -f" message only if not autoloading.  Otherwise
it'll get spammy.

XXX: this should probably be printed iff the toplevel module is
not being autoloaded (i.e. there is a human to interpret the error).
Otherwise disabled dependencies give a misleading EPERM.

Revision 1.61 / (download) - annotate - [select for diffs], Thu Mar 18 17:33:18 2010 UTC (11 years, 8 months ago) by pooka
Branch: MAIN
Changes since 1.60: +4 -2 lines
Diff to previous 1.60 (unified)

Never autounload builtin modules (they will never be autoloaded if disabled).

Revision 1.60 / (download) - annotate - [select for diffs], Fri Mar 5 20:10:05 2010 UTC (11 years, 8 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-nfs-mp-base9
Branch point for: rmind-uvmplock
Changes since 1.59: +5 -2 lines
Diff to previous 1.59 (unified)

Make module_{lookup,enqueue}() static now that it's possible again
(effectively reverts my kern_module rev. 1.53 from some months ago)

Revision 1.59 / (download) - annotate - [select for diffs], Fri Mar 5 18:35:01 2010 UTC (11 years, 8 months ago) by pooka
Branch: MAIN
Changes since 1.58: +223 -62 lines
Diff to previous 1.58 (unified)

Move builtin modules to a list in init and load them from there
instead of using linksets directly.  This has two implications:

1) It is now possible to "unload" a builtin module provided it is
   not busy.  This is useful e.g. to disable a kernel feature as
   an immediate workaround to a security problem.  To re-initialize
   the module, modload -f <name> is required.
2) It is possible to use builtin modules which were linked at
   runtime with an external linker (dlopen + rump).

Revision 1.58 / (download) - annotate - [select for diffs], Wed Mar 3 17:58:36 2010 UTC (11 years, 9 months ago) by pooka
Branch: MAIN
Changes since 1.57: +5 -4 lines
Diff to previous 1.57 (unified)

Replace unsafe use of TAILQ_FOREACH: as the comment says, the
structures are pulled off the list in the loop and it's anyone's
guess where they go after that.

Revision 1.57 / (download) - annotate - [select for diffs], Tue Jan 19 15:23:14 2010 UTC (11 years, 10 months ago) by pooka
Branch: MAIN
CVS Tags: uebayasi-xip-base
Branch point for: uebayasi-xip
Changes since 1.56: +3 -6 lines
Diff to previous 1.56 (unified)

Update comment: unloaded modules which were pumped up by the
bootloader are not freed at the end of bootstrap (there should be
none, although this is not asserted.  maybe it should be?).

Revision 1.56 / (download) - annotate - [select for diffs], Fri Jan 1 03:22:13 2010 UTC (11 years, 11 months ago) by dholland
Branch: MAIN
Changes since 1.55: +3 -3 lines
Diff to previous 1.55 (unified)

typo in comment

Revision 1.55 / (download) - annotate - [select for diffs], Tue Dec 29 17:49:21 2009 UTC (11 years, 11 months ago) by elad
Branch: MAIN
Changes since 1.54: +21 -21 lines
Diff to previous 1.54 (unified)

Move the listener plugging to module_init(), as it runs after kauth_init()
now. (Leaving only the module kthread creation in module_init2().)

Revision 1.54 / (download) - annotate - [select for diffs], Wed Nov 18 17:40:45 2009 UTC (12 years ago) by pooka
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.53: +36 -154 lines
Diff to previous 1.53 (unified)

* make it possible to include kern_module in a kernel without vfs
  support, i.e. move vfs functionality to a separate module
  (kern_module_vfs.c)
* make module proplist size an MI constant (now 8k) instead of PAGE_SIZE
* change some error values to something else than the karmic EINVAL

Revision 1.53 / (download) - annotate - [select for diffs], Thu Nov 5 14:09:14 2009 UTC (12 years ago) by pooka
Branch: MAIN
Changes since 1.52: +5 -4 lines
Diff to previous 1.52 (unified)

expose module_{lookup,enqueue}()

Revision 1.52 / (download) - annotate - [select for diffs], Fri Oct 16 00:27:07 2009 UTC (12 years, 1 month ago) by jnemeth
Branch: MAIN
CVS Tags: jym-xensuspend-nbase
Changes since 1.51: +6 -2 lines
Diff to previous 1.51 (unified)

allow passing a NULL proplib dictionary to modctl(MODCTL_LOAD, ...)

Revision 1.51 / (download) - annotate - [select for diffs], Sat Oct 3 00:06:37 2009 UTC (12 years, 2 months ago) by elad
Branch: MAIN
Changes since 1.50: +24 -2 lines
Diff to previous 1.50 (unified)

Put module loading policy back in the subsystem.

Revisit: consider moving kauth_init() above module_init() in main().

Revision 1.50 / (download) - annotate - [select for diffs], Fri Oct 2 18:50:14 2009 UTC (12 years, 2 months ago) by elad
Branch: MAIN
Changes since 1.49: +19 -3 lines
Diff to previous 1.49 (unified)

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

Revision 1.49 / (download) - annotate - [select for diffs], Wed Jun 17 21:04:25 2009 UTC (12 years, 5 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-nfs-mp-base8, yamt-nfs-mp-base7, yamt-nfs-mp-base6, yamt-nfs-mp-base5, jymxensuspend-base
Changes since 1.48: +7 -7 lines
Diff to previous 1.48 (unified)

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.

Revision 1.48 / (download) - annotate - [select for diffs], Tue Jun 9 20:35:02 2009 UTC (12 years, 5 months ago) by jnemeth
Branch: MAIN
Changes since 1.47: +4 -3 lines
Diff to previous 1.47 (unified)

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.

Revision 1.47 / (download) - annotate - [select for diffs], Tue Jun 9 19:09:03 2009 UTC (12 years, 5 months ago) by jnemeth
Branch: MAIN
Changes since 1.46: +42 -3 lines
Diff to previous 1.46 (unified)

Add code to merge the modload "command line" with <module>.prop.

Revision 1.46 / (download) - annotate - [select for diffs], Sun Jun 7 09:47:31 2009 UTC (12 years, 5 months ago) by jnemeth
Branch: MAIN
Changes since 1.45: +121 -5 lines
Diff to previous 1.45 (unified)

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.

Revision 1.45 / (download) - annotate - [select for diffs], Tue May 26 08:34:23 2009 UTC (12 years, 6 months ago) by jnemeth
Branch: MAIN
Changes since 1.44: +7 -5 lines
Diff to previous 1.44 (unified)

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.

Revision 1.44 / (download) - annotate - [select for diffs], Mon May 25 22:33:00 2009 UTC (12 years, 6 months ago) by jnemeth
Branch: MAIN
Changes since 1.43: +21 -5 lines
Diff to previous 1.43 (unified)

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.

Revision 1.43 / (download) - annotate - [select for diffs], Sun May 24 14:54:17 2009 UTC (12 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.42: +11 -3 lines
Diff to previous 1.42 (unified)

ddb: don't try to stat builtin modules.

Revision 1.42 / (download) - annotate - [select for diffs], Fri Feb 13 22:41:04 2009 UTC (12 years, 9 months ago) by apb
Branch: MAIN
CVS Tags: yamt-nfs-mp-base4, yamt-nfs-mp-base3, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base2, nick-hppapmap-base, jym-xensuspend-base
Changes since 1.41: +3 -2 lines
Diff to previous 1.41 (unified)

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.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Jan 24 22:14:45 2009 UTC (12 years, 10 months ago) by rmind
Branch: MAIN
Branch point for: jym-xensuspend
Changes since 1.40: +4 -4 lines
Diff to previous 1.40 (unified)

Revert path of modules back to "/stand".

Revision 1.40 / (download) - annotate - [select for diffs], Sat Jan 24 00:29:12 2009 UTC (12 years, 10 months ago) by rmind
Branch: MAIN
Changes since 1.39: +4 -4 lines
Diff to previous 1.39 (unified)

Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0.  Proposed on <tech-kern>.

Revision 1.39 / (download) - annotate - [select for diffs], Tue Jan 20 20:12:41 2009 UTC (12 years, 10 months ago) by drochner
Branch: MAIN
Changes since 1.38: +6 -4 lines
Diff to previous 1.38 (unified)

add __gcc__ __format__ __string__ __attributes__ to catch mistakes early

Revision 1.38 / (download) - annotate - [select for diffs], Sun Dec 28 03:21:02 2008 UTC (12 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: mjf-devfs2-base
Changes since 1.37: +6 -3 lines
Diff to previous 1.37 (unified)

- 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.

Revision 1.37 / (download) - annotate - [select for diffs], Fri Dec 5 12:55:09 2008 UTC (12 years, 11 months ago) by ad
Branch: MAIN
CVS Tags: haad-nbase2, haad-dm-base2, haad-dm-base, ad-audiomp2-base, ad-audiomp2
Changes since 1.36: +6 -9 lines
Diff to previous 1.36 (unified)

Back out revision 1.35 which is no longer necessary and causes the system
to try autounloading modules perpetually.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Dec 5 12:51:17 2008 UTC (12 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.35: +4 -3 lines
Diff to previous 1.35 (unified)

PR kern/40110: null, overlay and umap modules loading -> panic (layerfs symbols not there)

Revision 1.35 / (download) - annotate - [select for diffs], Wed Dec 3 15:15:01 2008 UTC (12 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.34: +9 -6 lines
Diff to previous 1.34 (unified)

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.

Revision 1.34 / (download) - annotate - [select for diffs], Wed Dec 3 12:14:11 2008 UTC (12 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.33: +72 -21 lines
Diff to previous 1.33 (unified)

Add a couple of sysctls:

kern.module.autoload = 1
kern.module.verbose = 0

Revision 1.33 / (download) - annotate - [select for diffs], Wed Dec 3 11:23:15 2008 UTC (12 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.32: +8 -6 lines
Diff to previous 1.32 (unified)

Correct error messages added in revision 1.32. In part from drochner@.

Revision 1.32 / (download) - annotate - [select for diffs], Thu Nov 27 21:36:51 2008 UTC (13 years ago) by christos
Branch: MAIN
Changes since 1.31: +42 -13 lines
Diff to previous 1.31 (unified)

better error messages, and more messages for DIAGNOSTIC.

Revision 1.31 / (download) - annotate - [select for diffs], Tue Nov 25 15:15:28 2008 UTC (13 years ago) by ad
Branch: MAIN
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (unified)

Print the size as decimal.

Revision 1.30 / (download) - annotate - [select for diffs], Tue Nov 25 15:14:07 2008 UTC (13 years ago) by ad
Branch: MAIN
Changes since 1.29: +67 -2 lines
Diff to previous 1.29 (unified)

Add some basic DDB stuff for modules.

Revision 1.29 / (download) - annotate - [select for diffs], Wed Nov 19 13:07:42 2008 UTC (13 years ago) by ad
Branch: MAIN
Changes since 1.28: +8 -2 lines
Diff to previous 1.28 (unified)

module_autoload: disallow path seperators and magic symlinks.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Nov 18 11:56:09 2008 UTC (13 years ago) by ad
Branch: MAIN
Changes since 1.27: +15 -3 lines
Diff to previous 1.27 (unified)

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.

Revision 1.27 / (download) - annotate - [select for diffs], Tue Nov 18 11:39:41 2008 UTC (13 years ago) by ad
Branch: MAIN
Changes since 1.26: +60 -28 lines
Diff to previous 1.26 (unified)

- 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.

Revision 1.26 / (download) - annotate - [select for diffs], Fri Nov 14 23:06:45 2008 UTC (13 years ago) by ad
Branch: MAIN
Changes since 1.25: +85 -3 lines
Diff to previous 1.25 (unified)

- 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.

Revision 1.25 / (download) - annotate - [select for diffs], Wed Nov 12 12:36:16 2008 UTC (13 years ago) by ad
Branch: MAIN
Changes since 1.24: +10 -10 lines
Diff to previous 1.24 (unified)

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.

Revision 1.24 / (download) - annotate - [select for diffs], Wed Oct 22 11:19:15 2008 UTC (13 years, 1 month ago) by ad
Branch: MAIN
CVS Tags: netbsd-5-base, netbsd-5-0-RC1, matt-mips64-base2
Branch point for: nick-hppapmap, netbsd-5
Changes since 1.23: +8 -4 lines
Diff to previous 1.23 (unified)

Make MODCTL_LOAD_FORCE do something.

Revision 1.23 / (download) - annotate - [select for diffs], Wed Oct 22 11:16:29 2008 UTC (13 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.22: +26 -4 lines
Diff to previous 1.22 (unified)

- 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.

Revision 1.22 / (download) - annotate - [select for diffs], Fri Aug 1 14:05:15 2008 UTC (13 years, 4 months ago) by pooka
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-4, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, haad-dm-base1
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (unified)

expose module_compatible()

Revision 1.21 / (download) - annotate - [select for diffs], Sat May 31 20:14:38 2008 UTC (13 years, 6 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, wrstuden-revivesa-base-1, wrstuden-revivesa-base, simonb-wapbl-nbase, simonb-wapbl-base, simonb-wapbl
Branch point for: haad-dm
Changes since 1.20: +20 -7 lines
Diff to previous 1.20 (unified)

- Put in place module compatibility check against __NetBSD_Version__,
  as discussed on tech-kern.

- Remove unused module_jettison().

Revision 1.20 / (download) - annotate - [select for diffs], Tue May 20 19:20:38 2008 UTC (13 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.19: +12 -9 lines
Diff to previous 1.19 (unified)

If autoloading a module, don't consider the current working directory.

Revision 1.19 / (download) - annotate - [select for diffs], Tue May 20 19:16:07 2008 UTC (13 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.18: +2 -6 lines
Diff to previous 1.18 (unified)

Remove stale comment.

Revision 1.18 / (download) - annotate - [select for diffs], Tue May 20 17:24:56 2008 UTC (13 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.17: +35 -10 lines
Diff to previous 1.17 (unified)

Allow module class to be passed to module_load(), as a basic sanity check
that we are loading the right kind of module.

Revision 1.17 / (download) - annotate - [select for diffs], Tue May 20 16:04:08 2008 UTC (13 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.16: +6 -6 lines
Diff to previous 1.16 (unified)

Take $MACHINE into account when looking for modules.

Revision 1.16 / (download) - annotate - [select for diffs], Tue May 20 14:11:55 2008 UTC (13 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.15: +13 -3 lines
Diff to previous 1.15 (unified)

PR kern/38694 module dependencies do not work as expected

Autoload modules from the correct path based on kernel version.

Revision 1.15 / (download) - annotate - [select for diffs], Tue May 20 13:34:44 2008 UTC (13 years, 6 months ago) by ad
Branch: MAIN
CVS Tags: hpcarm-cleanup-nbase
Changes since 1.14: +14 -46 lines
Diff to previous 1.14 (unified)

- 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.

Revision 1.14 / (download) - annotate - [select for diffs], Sun May 4 21:35:12 2008 UTC (13 years, 6 months ago) by rumble
Branch: MAIN
CVS Tags: yamt-pf42-base2, yamt-nfs-mp-base2
Branch point for: wrstuden-revivesa
Changes since 1.13: +6 -4 lines
Diff to previous 1.13 (unified)

Fix an error path that previously panicked when module_fetch_info failed.

Revision 1.13 / (download) - annotate - [select for diffs], Fri May 2 12:59:34 2008 UTC (13 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.12: +5 -3 lines
Diff to previous 1.12 (unified)

Re-do yesterday's build fix to hook in the MD stuff if available.

Revision 1.12 / (download) - annotate - [select for diffs], Thu May 1 17:23:16 2008 UTC (13 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.11: +30 -2 lines
Diff to previous 1.11 (unified)

- Add module_find_section(), allows a module to look up data in its object.
- Work around build failure.

Revision 1.11 / (download) - annotate - [select for diffs], Thu May 1 14:44:48 2008 UTC (13 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.10: +62 -24 lines
Diff to previous 1.10 (unified)

Get the pre-loaded module code working.

Revision 1.10 / (download) - annotate - [select for diffs], Mon Apr 28 20:24:03 2008 UTC (13 years, 7 months ago) by martin
Branch: MAIN
Changes since 1.9: +2 -9 lines
Diff to previous 1.9 (unified)

Remove clause 3 and 4 from TNF licenses

Revision 1.9 / (download) - annotate - [select for diffs], Sun Mar 2 11:18:43 2008 UTC (13 years, 9 months ago) by jmmv
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base, yamt-nfs-mp-base, yamt-lazymbuf-base15, yamt-lazymbuf-base14, matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base, ad-socklock-base1
Branch point for: yamt-pf42, yamt-nfs-mp, matt-armv6
Changes since 1.8: +13 -11 lines
Diff to previous 1.8 (unified)

Add support for load-time parameters for modules, which are passed through
a dictionary.  As discussed in tech-kern@.

Revision 1.8 / (download) - annotate - [select for diffs], Sat Jan 19 18:20:39 2008 UTC (13 years, 10 months ago) by rumble
Branch: MAIN
CVS Tags: nick-net80211-sync-base, nick-net80211-sync, mjf-devfs-base, hpcarm-cleanup-base, bouyer-xeni386-nbase, bouyer-xeni386-base
Branch point for: yamt-lazymbuf, mjf-devfs2, mjf-devfs, keiichi-mipv6
Changes since 1.7: +6 -5 lines
Diff to previous 1.7 (unified)

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.

Revision 1.7 / (download) - annotate - [select for diffs], Sat Jan 19 00:57:35 2008 UTC (13 years, 10 months ago) by rumble
Branch: MAIN
Branch point for: bouyer-xeni386
Changes since 1.6: +18 -5 lines
Diff to previous 1.6 (unified)

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.

Revision 1.6 / (download) - annotate - [select for diffs], Fri Jan 18 16:41:46 2008 UTC (13 years, 10 months ago) by rumble
Branch: MAIN
Changes since 1.5: +9 -2 lines
Diff to previous 1.5 (unified)

Deal with braindead modules that depend on themselves, rather than inducing
an ambiguous panic later on.

Revision 1.5 / (download) - annotate - [select for diffs], Fri Jan 18 14:29:44 2008 UTC (13 years, 10 months ago) by rumble
Branch: MAIN
Changes since 1.4: +4 -3 lines
Diff to previous 1.4 (unified)

Avoid NULL pointer deref.

Revision 1.4 / (download) - annotate - [select for diffs], Fri Jan 18 01:41:55 2008 UTC (13 years, 10 months ago) by simonb
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (unified)

Fix tyop in a KASSERT:  s/mod_required/mod->mod_required/

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jan 17 22:35:53 2008 UTC (13 years, 10 months ago) by rumble
Branch: MAIN
Changes since 1.2: +24 -6 lines
Diff to previous 1.2 (unified)

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.

Revision 1.2 / (download) - annotate - [select for diffs], Wed Jan 16 18:28:32 2008 UTC (13 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.1: +11 -3 lines
Diff to previous 1.1 (unified)

- Include lkm_map if !LKM. XXX
- Add a comment about dependencies.

Revision 1.1 / (download) - annotate - [select for diffs], Wed Jan 16 12:34:52 2008 UTC (13 years, 10 months ago) by ad
Branch: MAIN

Pull in my modules code for review/test/hacking.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>