Commit Graph

44 Commits

Author SHA1 Message Date
christos ec97828f5a 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.
2011-08-13 21:04:05 +00:00
joerg 3eb244d801 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.
2011-07-17 20:54:30 +00:00
matt a20c25e484 Deal with ELFnn_MACHDEP_ID_CASES a bit better. 2011-01-18 08:15:51 +00:00
pooka da792af712 Add an optional hook for adjusting module string table after load.
Currently to be used for rump "SAOS" namespace trick.
2010-04-26 22:58:53 +00:00
pooka bbc50ef41d Due to the schizophrenic nature of kobj (mem + vfs source),
split the module in twain to subj_kobj.c (master + mem) and
subr_kobj_vfs.c (vfs).
2009-11-27 17:54:11 +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 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 193d553767 Split out kobj structures so crash/ddb can get at them. 2009-05-24 15:00:24 +00:00
ad cb95ab6e35 Fix a crash observed when trying to load a corrupted ELF image. 2009-05-23 15:13:57 +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
pooka e99d5fab49 Sprinkle comments explaining purpose of kobj_machdep(), per email from ad.
no functional change
2009-01-08 01:03:24 +00:00
pooka 2577e51e90 revert previous, disabled aliasing in offending build
(XXX: two evil casts in the original)
2009-01-01 22:17:55 +00:00
pooka 44a89fbb01 Squelch type-punning warnings with void * casts. We are allowed
to do this because the pointers do not have aliases.
2009-01-01 21:35:22 +00:00
ad 38cbe1484b Another fix to previous. 2008-11-16 16:23:58 +00:00
ad e2a270368e Correction to previous. 2008-11-16 14:55:42 +00:00
ad d89eff7233 Do not look up any given symbol more than once. Does away with the vast
majority of symbol table lookups.
2008-11-16 11:26:28 +00:00
ad 6b88fdc0eb Use NOCHROOT when doing the lookup against the standard module path.
Prevents abuse of chroots to load tainted kernel modules.
2008-11-14 22:00:23 +00:00
ad 307004b54f Don't try appending ".o" to the module path. 2008-11-12 14:22:17 +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 19463db480 Correct an error message. 2008-10-20 20:07:35 +00:00
ad ee66516bfd PR kern/38814 ksyms needs locking
- Make ksyms MT safe.
- Fix deadlock from an operation like "modload foo.lkm < /dev/ksyms".
- Fix uninitialized structure members.
- Reduce memory footprint for loaded modules.
- Export ksyms structures for kernel grovellers like savecore.
- Some KNF.
2008-10-20 10:24:18 +00:00
ad 1b31761afa kobj_read: plug a leak. 2008-10-06 10:46:58 +00:00
ad 61270d54f1 If autoloading a module, don't consider the current working directory. 2008-05-20 19:20:38 +00:00
martin bd3d112a87 fix !MODULAR compiles 2008-05-20 16:18:51 +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
jmcneill 3ea8229871 If we see a non-loadable BSS section in a pre-loaded module, make sure we
don't return success from kobj_load or nasty things will happen.
2008-05-19 17:33:42 +00:00
ad 517f9684fe Make it compile as part of librump. 2008-05-04 12:51:44 +00:00
ad 5982e60c2b Broken assertions. 2008-05-03 15:57:17 +00:00
ad 3f1b4f1759 Keep the program table and section strings around after loading the object,
since module_find_section() needs them.
2008-05-02 13:00:01 +00:00
ad 416e98a01e Another fix for pre-loaded modules. 2008-05-01 17:07:10 +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
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
rumble 80993719d2 Before bailing on ENOENT, try one more time with an appended ".o". This
lets us load dependencies by module name and makes 'modload foo' work when
'foo.o' is the file.
2008-01-17 22:32:49 +00:00
ad 9dfa2c0234 Add a function to look up a section by name and return address/size, and
nuke return of object entrypoint from kobj_stat(). It's a lot easier to
denote the module entypoint using a linkset.
2008-01-12 23:34:48 +00:00
ad 574389c2a0 Fix build if !MODULAR. Reported by elad@. 2008-01-07 20:42:48 +00:00
ad b7dafc15be Don't both about module name / ksyms until the name is known for sure. 2008-01-07 18:25:56 +00:00
ad 0805a9416a Add MODULAR option. Include kernel linker stuff if MODULAR. 2008-01-06 18:03:58 +00:00
jmcneill bf49138bfc Fix off-by-one in kobj_read range checking for case KT_MEMORY 2008-01-06 15:13:07 +00:00
ad b9e6d93835 - Allow loading ELF objects from memory. Based on a patch from jmcneill.
- Allow for changing object name later, once known.
- Split open/load of the objects.
2008-01-06 14:47:26 +00:00
ad 4c5e4edd5c Add a kobj_stat() to get basic info about the object, and some other
minor changes.
2008-01-04 14:53:32 +00:00
ad 1dd75d2865 Add a simple in-kernel linker, derived from FreeBSD's link_elf_obj.c. Needs
more work but is enough to load simple LKMs. amd64 is untested.

Locking is caller provided. This is decoupled from the LKM framework because
kernel modules need not be loaded from the file system - they could be built
into the kernel and referenced via link set.
2008-01-04 12:26:20 +00:00