Commit Graph

98 Commits

Author SHA1 Message Date
dsl 7e2790cf6f Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
    int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
2007-12-20 23:02:38 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
yamt 1a7bc55dcc remove some __unused from function parameters. 2006-11-01 10:17:58 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
elad bada0c776a Don't use KAUTH_RESULT_* where it's not applicable.
Prompted by yamt@.
2006-09-13 10:07:42 +00:00
elad 5f7169ccb1 First take at security model abstraction.
- Add a few scopes to the kernel: system, network, and machdep.

- Add a few more actions/sub-actions (requests), and start using them as
  opposed to the KAUTH_GENERIC_ISSUSER place-holders.

- Introduce a basic set of listeners that implement our "traditional"
  security model, called "bsd44". This is the default (and only) model we
  have at the moment.

- Update all relevant documentation.

- Add some code and docs to help folks who want to actually use this stuff:

  * There's a sample overlay model, sitting on-top of "bsd44", for
    fast experimenting with tweaking just a subset of an existing model.

    This is pretty cool because it's *really* straightforward to do stuff
    you had to use ugly hacks for until now...

  * And of course, documentation describing how to do the above for quick
    reference, including code samples.

All of these changes were tested for regressions using a Python-based
testsuite that will be (I hope) available soon via pkgsrc. Information
about the tests, and how to write new ones, can be found on:

	http://kauth.linbsd.org/kauthwiki

NOTE FOR DEVELOPERS: *PLEASE* don't add any code that does any of the
following:

  - Uses a KAUTH_GENERIC_ISSUSER kauth(9) request,
  - Checks 'securelevel' directly,
  - Checks a uid/gid directly.

(or if you feel you have to, contact me first)

This is still work in progress; It's far from being done, but now it'll
be a lot easier.

Relevant mailing list threads:

http://mail-index.netbsd.org/tech-security/2006/01/25/0011.html
http://mail-index.netbsd.org/tech-security/2006/03/24/0001.html
http://mail-index.netbsd.org/tech-security/2006/04/18/0000.html
http://mail-index.netbsd.org/tech-security/2006/05/15/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/01/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/25/0000.html

Many thanks to YAMAMOTO Takashi, Matt Thomas, and Christos Zoulas for help
stablizing kauth(9).

Full credit for the regression tests, making sure these changes didn't break
anything, goes to Matt Fleming and Jaime Fournier.

Happy birthday Randi! :)
2006-09-08 20:58:56 +00:00
christos e04bc58b1a Add missing initializer 2006-09-02 06:26:13 +00:00
drochner 8c61e0077d Request executable memory for LKM code/data areas. This fixes LKMs
on alpha (which were broken for more than a year appearently and noone
noticed). (The other archs didn't suffer because their pmap_kenter_pa()
doesn't support non-executable mappings.)
2006-07-05 14:31:00 +00:00
yamt dae53410a7 - tweak RUN_ONCE api to allow init_func returns an error.
- physio: handle failure of workqueue_create.
2006-01-16 21:45:38 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
thorpej 6685f0f408 Use a once control to initialize the LKM subsystem on first open. Remove
the lkm_init() call from main().
2005-11-25 20:13:54 +00:00
hannken 23bc271d48 `lkmlookup()' is called with its name argument either from kernel or from
user space. Add an argument `need_copyin' to only use `copyinstr()' if
the name is from user space.

modstat -n NAME works again.

Reviewed by: Peter Postma <peter@netbsd.org>
2005-04-12 14:13:16 +00:00
yamt 6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
matt 9034eca609 Add code to preen proc0 cache fter loading a LKM.
(conditional on PMAP_NEED_PROCWR)
2005-03-27 08:34:41 +00:00
perry da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00
yamt f6e639255b lkmunreserve: free memory to the correct vm_map when kernel_map != lkm_map. 2005-01-23 08:41:02 +00:00
jdolecek f201f239e3 #ifdef DDB rdyfail label, too 2004-12-30 12:12:16 +00:00
jdolecek aca74c5304 only do the temporary symbol table load #ifdef DDB and add comment for
the code block, so that the purpose is more clear

avoid NULL pointer dereference in lkmunreserve() called on lkm device
close when ksym_addsymtab() fails for the temporary symbol table
(sanity change only, this can never happen at the moment)
2004-12-30 11:47:02 +00:00
jdolecek b90395b379 fix two issues regarding handling of ksyms (modload -s):
* only add the symbol table for the current module if the LKM_E_LOAD
  hook returns success; otherwise we overwrite the LKM_E_LOAD error,
  which may ultimately lead to (incorrectly) allowing the module load
* only delete the sumbol table for current module if we actually added
  the symbol table; avoids deleting symbol table of previously loaded
  module when the same module is loaded twice, when the second load
  fails with EEXIST

fixes PR kern/28803 by Jens Kessmeier
2004-12-30 11:35:41 +00:00
peter 8270ea3f59 Use ANSI function decls. 2004-10-25 23:37:58 +00:00
peter 7101691fa3 Remove two redundant conditionals. 2004-10-25 23:06:41 +00:00
peter 993460fbb1 Change the static array to a linked list, removes the limit of max 20 LKMs.
Mostly from OpenBSD.
Reviewed by several people on tech-kern.
2004-10-25 22:59:12 +00:00
peter 5d3f22a6e3 Remove the confusing PAGESIZE macro and calculate the size by doing
size / 1024.

Approved by mrg.
2004-10-22 09:49:18 +00:00
drochner 6860e77f9d include <sys/device> explicitely, found by Havard Eidnes 2004-08-19 15:12:36 +00:00
drochner d95b59fae8 add a new "DRV" LKM type, and some glue code to make it use the new
autoconf capabilities
2004-08-17 22:38:50 +00:00
junyoung fdc32973e7 - Nuke __P().
- Drop trailing spaces.
2004-03-23 13:22:32 +00:00
matt f01501b2c6 Support really large LKMs. Find out how much space is needed for symbols
and then allocate it on demand.  Rename some common symbols (__bss_start,
_edata, _end, __start_link_set_*, __stop_link_set_*) so that ".<module>"
is appended to them.  This shrinks an amd64 kernel by 20KB of BSS.
2004-02-18 23:44:49 +00:00
cube d3730f1c68 o Fix a bug in ksyms that changed the real meaning of st_name entries for
symbols, and made it impossible for the kernel to use that value, and
  correctly find symbols from LKMs.
o Allow LKM users to use DDB to debug the entry function of a LKM by
  loading the symbol table with the temporary name /lkmtemp/ before calling
  it, and then renaming it once we know the module name.

Approved by ragge@.
2003-11-17 10:16:18 +00:00
christos ddb8b44bce include opt_malloclog.h 2003-11-01 07:07:31 +00:00
jdolecek 465f95a5ec Embed information about kernel version and some of used kernel options
into compiled LKMs. Check this information when LKM is loaded into kernel
and refuse LKMs not matching currently running kernel. Provide LMFORCE
ioctl to skip this check for those feeling adventurous.

as discussed on tech-kern@, thanks to feedback from Bill Studenmund and others
2003-09-06 19:08:53 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
ragge f5cb3ec885 Teach the lkm code to add loaded module symbols to the in-kernel symbol table.
XXX - The way this works is clumsy, at least. It will be fixed as soon as
the in-kernel linker is in place.
2003-04-24 20:09:43 +00:00
jdolecek 075efbb3db desupport LMRESERV_O, anything using it doesn't have chance of working
anyway due to numerous kernel structure changes
2003-04-10 19:06:04 +00:00
thorpej e0d8d366df Merge the nathanw_sa branch. 2003-01-18 10:06:22 +00:00
thorpej 80f8dbe30a Add a new VM map, lkm_map, which machine-dependent code can provide
in the event that it needs to use a special VM range (x86_64 falls
into this category).  We fall back onto kernel_map if machine-dependent
code doesn't create a special map.
2002-11-05 01:24:35 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
lha 4fa2032edc uppercase the lkm kernel-userspace dev macros and prefix them with LKM_
make modload print the bdev and cdev major when its a dev lkm
2002-09-18 22:59:36 +00:00
gehenna a1d78935eb overload block/character into u_long field.
kern/18234: slightly modified
2002-09-13 13:08:53 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
lukem adc783d537 add RCSIDs 2001-11-12 15:25:01 +00:00
mrg b49770c009 add a DEBUG for why the lkm entry point failed. 2001-06-05 12:36:08 +00:00
jdolecek 5a8911a72d Call module "stat" entry where appropriate.
Problem reported and patch provided by SATOU Takashi in kern/12037.
2001-02-24 10:16:46 +00:00
jdolecek 0576f87ad3 add infrastructure to load emulations and their executable support dynamically
via LKM
2000-12-08 19:42:11 +00:00
jdolecek e5b244c609 disable the LM_EXEC stuff for now, it doesn't work anyway
this will be fixed 'soon'
2000-11-21 00:11:38 +00:00
mrg 32aa199ccf remove include of <vm/vm.h> 2000-06-27 17:41:07 +00:00
mrg 2f159a1bac remove/move more mach vm header files:
<vm/pglist.h> -> <uvm/uvm_pglist.h>
	<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
	<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
	<vm/vm_object.h> -> nothing
	<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
2000-06-26 14:20:25 +00:00
simonb 071bde5df6 Don't need to declare nblkdev, nchrdev - these are in <sys/systm.h>. 2000-03-28 06:26:22 +00:00
jdolecek e49c7e1186 LMREADY: kill the DEBUG message "LKM: try ready"
LMLOADSYMS: print the DEBUG message only when (lkm_debug & LKMDB_LOAD)
1999-09-03 17:07:52 +00:00