summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_linker.c
Commit message (Collapse)AuthorAgeFilesLines
* o Move suser() calls in kern/ to using suser_xxx() with an explicitrwatson2001-11-011-2/+2
| | | | | | | | | credential selection, rather than reference via a thread or process pointer. This is part of a gradual migration to suser() accepting a struct ucred instead of a struct proc, simplifying the reference and locking semantics of suser(). Obtained from: TrustedBSD Project
* Add the sysctl "kern.function_list", which currently exports allgreen2001-10-301-0/+31
| | | | | | | | | | | | | | | | | function symbols in the kernel in a list of C strings, with an extra nul-termination at the end. This sysctl requires addition of a new linker operation. Now, linker_file_t's need to respond to "each_function_name" to export their function symbols. Note that the sysctl doesn't currently allow distinguishing multiple symbols with the same name from different modules, but could quite easily without a change to the linker operation. This will be a nicety to have when it can be used. Obtained from: NAI Labs CBOSS project Funded by: DARPA
* KSE Milestone 2julian2001-09-121-44/+43
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Fix the kern.module_path issue that required the trailing '/' characterpeter2001-09-121-12/+15
| | | | | on each module path component. Fix a one-byte buffer overflow at the same time that got highlighted in the process.
* Implement the long-awaited module->file cache database. A userlandpeter2001-09-111-87/+299
| | | | | | | tool (kldxref(8)) keeps a cache of what modules and versions are inside what .ko files. I have tested this on both Alpha and i386. Submitted by: bp
* Giant Pushdown. Saved the worst P4 tree breakage for last.dillon2001-09-011-19/+61
| | | | | | | | | | | | reboot() getpriority() setpriority() rtprio() osetrlimit() ogetrlimit() setrlimit() getrlimit() getrusage() getpid() getppid() getpgrp() getpgid() getsid() getgid() getegid() getgroups() setsid() setpgid() setuid() seteuid() setgid() setegid() setgroups() setreuid() setregid() setresuid() setresgid() getresuid() getresgid () __setugid() getlogin() setlogin() modnext() modfnext() modstat() modfind() kldload() kldunload() kldfind() kldnext() kldstat() kldfirstmod() kldsym() getdtablesize() dup2() dup() fcntl() close() ofstat() fstat() nfsstat() fpathconf() flock()
* Sync the default module search path with the one indd2001-08-201-1/+1
| | | | | | | sys/boot/common/module.c. PR: 21405 Submitted by: Makoto MATSUSHITA <matusita@jp.FreeBSD.org>
* Don't try to print a field that doesn't exist; in usually commentedjake2001-07-311-2/+2
| | | | out debugging code.
* Constify (silence warnings introduced by last commit to sys/module.h)des2001-06-201-7/+7
|
* Add linker_reference_module().brian2001-06-181-0/+25
| | | | | This function loads a module if required, otherwise bumps the reference count -- the opposite of linker_file_unload().
* With this commit, I hereby pronounce gensetdefs past its use-by date.peter2001-06-131-94/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the a.out emulation of 'struct linker_set' with something a little more flexible. <sys/linker_set.h> now provides macros for accessing elements and completely hides the implementation. The linker_set.h macros have been on the back burner in various forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()), John Polstra (ELF clue) and myself (cleaned up API and the conversion of the rest of the kernel to use it). The macros declare a strongly typed set. They return elements with the type that you declare the set with, rather than a generic void *. For ELF, we use the magic ld symbols (__start_<setname> and __stop_<setname>). Thanks to Richard Henderson <rth@redhat.com> for the trick about how to force ld to provide them for kld's. For a.out, we use the old linker_set struct. NOTE: the item lists are no longer null terminated. This is why the code impact is high in certain areas. The runtime linker has a new method to find the linker set boundaries depending on which backend format is in use. linker sets are still module/kld unfriendly and should never be used for anything that may be modular one day. Reviewed by: eivind
* Make the TUNABLE_*() macros look and behave more consistantly like thepeter2001-06-061-4/+2
| | | | | SYSCTL_*() macros. TUNABLE_INT_DECL() was an odd name because it didn't actually declare the int, which is what the name suggests it would do.
* o Actually extract version of interface and store it along with the name.bp2001-03-221-52/+99
| | | | | | | o Add new parameter to the modlist_lookup() function to perform lookups with strict version matching. o Collapse duplicate code to function(s).
* Slightly reorganize code in the linker_load_dependancies() function to makebp2001-03-221-54/+52
| | | | codepath more straightforward.
* Remove support for old way of handling module dependencies.bp2001-03-221-35/+18
| | | | Approved by: peter
* Another round of the <sys/queue.h> FOREACH transmogriffer.phk2001-02-041-2/+1
| | | | | Created with: sed(1) Reviewed by: md5(1)
* Mechanical change to use <sys/queue.h> macro API instead ofphk2001-02-041-12/+12
| | | | | | | fondling implementation details. Created with: sed(1) Reviewed by: md5(1)
* Pull out the module path from the loader. ie: if you boot frompeter2000-12-281-4/+8
| | | | | | | | /boot/kernel.foobar/* then that had better be in the path ahead of the others. Submitted by: Daniel J. O'Connor <darius@dons.net.au> PR: 23662
* Convert more malloc+bzero to malloc+M_ZERO.dwmalone2000-12-081-10/+6
| | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
* Add a workaround for statically linked kernels.dfr2000-10-041-0/+6
|
* The kernel is now known as `kernel.ko' and it and its matching modulesobrien2000-09-061-1/+1
| | | | | | live in ``/boot/kernel/''. Submitted by: Hisashi Hiramoto <hiramoto@phys.chs.nihon-u.ac.jp>
* Fix self referential dependencies. eg: uhub was packaged along withpeter2000-08-021-3/+13
| | | | | | | usb, all in usb.ko. uhub depends on usb. The bug was that the preload processing only adds a module to the list once it's internal dependencies are resolved... Since it was not "seeing" the internal usb module it believed that uhub had a missing dependency.
* Correct SYSINIT execution order in the case when KLD contains morebp2000-07-091-2/+2
| | | | | | than one SYSINIT with the same 'subsystem' id and different 'order' id. Reviewed by: peter
* Move the truncation code out of vn_open and into the open system callmckusick2000-07-041-2/+3
| | | | | | | | | | after the acquisition of any advisory locks. This fix corrects a case in which a process tries to open a file with a non-blocking exclusive lock. Even if it fails to get the lock it would still truncate the file even though its open failed. With this change, the truncation is done only after the lock is successfully acquired. Obtained from: BSD/OS
* Move the securelevel check before loading KLD's into linker_load_file(),archie2000-06-291-2/+10
| | | | | | | | instead of requiring every caller of linker_load_file() to perform the check itself. This avoids netgraph loading KLD's when securelevel > 0, not to mention any future code that may call linker_load_file(). Reviewed by: dfr
* Back out the previous change to the queue(3) interface.jake2000-05-261-3/+3
| | | | | | It was not discussed and should probably not happen. Requested by: msmith and others
* Change the way that the queue(3) structures are declared; don't assume thatjake2000-05-231-3/+3
| | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd
* Remove unneeded #include <vm/vm_zone.h>phk2000-04-301-1/+0
| | | | Generated by: src/tools/tools/kerninclude
* First round implementation of a fine grain enhanced module to modulepeter2000-04-291-130/+480
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | version dependency system. This isn't quite finished, but it is at a useful stage to do a functional checkpoint. Highlights: - version and dependency metadata is gathered via linker sets, so things are handled the same for static kernels and code built to live in a kld. - The dependencies are at module level (versus at file level). - Dependencies determine kld symbol search order - this means that you cannot link against symbols in another file unless you depend on it. This is so that you cannot accidently unload the target out from underneath the ones referencing it. - It is flexible enough that we can put tags in #include files and macros so that we can get decent hooks for enforcing recompiles on incompatable ABI changes. eg: if we change struct proc, we could force a recompile for all kld's that reference the proc struct. - Tangled dependency references at boot time are sorted. Files are relocated once all their dependencies are already relocated. Caveats: - Loader support is incomplete, but has been worked on seperately. - Actual enforcement of the version number tags is not active yet - just the module dependencies are live. The actual structure of versioning hasn't been agreed on yet. (eg: major.minor, or whatever) - There is some backwards compatability for old modules without metadata but I'm not sure how good it is. This is based on work originally done by Boris Popov (bp@freebsd.org), but I'm not sure he'd recognize much of it now. Don't blame him. :-) Also, ideas have been borrowed from Mike Smith.
* * Rewrite to use kobj(9) instead of hard-coded function tables.dfr2000-04-241-47/+33
| | | | | | | * Report link errors to stdout with uprintf() so that the user can see what went wrong (PR kern/9214). * Add support code to allow module symbols to be loaded into GDB using the debugger's "sharedlibrary" command.
* Introduce NDFREE (and remove VOP_ABORTOP)eivind1999-12-151-0/+3
|
* Zap c_index() and c_rindex(). Bruce prefers these to implicitly convertpeter1999-12-101-2/+2
| | | | | a const into a non-const as they do in libc. I feel that defeating the type checking like that quite evil, but that's the way it is.
* Tempt fate and stop index from converting a const char * into a char *.peter1999-11-211-2/+2
| | | | | | | I've made a seperate version (c_index() etc) that use const/const, but I'm not sure it's worth it considering there is one file in the tree that uses index on const strings (kern_linker.c) and it's easily adjusted to scan the strings directly (and is perhaps more efficient that way).
* Trim unused options (or #ifdef for undoc options).peter1999-10-111-3/+0
| | | | Submitted by: phk
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Cast pointers to uintptr_t instead of casting them to u_long. Theybde1999-08-241-5/+5
| | | | | | | | | | | are still converted to u_long by assignment of the uintptr_t, and address calculations are still done using u_long. This is OK for currently supported machines, but addresses should be represented by vm_offset_t or uintptr_t in case pointers are longer than longs. "Fixed" size of linker_path[]. MAXPATHLEN + 1 was 1 too large for search paths with only one file path in them, but much too small for search paths with several long file paths in them.
* Change the name of the static variable 'files' to 'linker_files' ingrog1999-08-201-14/+14
| | | | | | order to be able to refer to it uniquely from the kernel debugger. Approved-by: peter
* Slight reorganization of kernel thread/process creation. Instead of usingpeter1999-07-011-34/+5
| | | | | | | | | | | | | | | SYSINIT_KT() etc (which is a static, compile-time procedure), use a NetBSD-style kthread_create() interface. kproc_start is still available as a SYSINIT() hook. This allowed simplification of chunks of the sysinit code in the process. This kthread_create() is our old kproc_start internals, with the SYSINIT_KT fork hooks grafted in and tweaked to work the same as the NetBSD one. One thing I'd like to do shortly is get rid of nfsiod as a user initiated process. It makes sense for the nfs client code to create them on the fly as needed up to a user settable limit. This means that nfsiod doesn't need to be in /sbin and is always "available". This is a fair bit easier to do outside of the SYSINIT_KT() framework.
* Slight tweak to fork1() calling conventions. Add a third argument sopeter1999-06-301-7/+6
| | | | | | | | the caller can easily find the child proc struct. fork(), rfork() etc syscalls set p->p_retval[] themselves. Simplify the SYSINIT_KT() code and other kernel thread creators to not need to use pfind() to find the child based on the pid. While here, partly tidy up some of the fork1() code for RF_SIGSHARE etc.
* First stages of a module dependency cleanup. This part fixes apeter1999-05-081-5/+12
| | | | | | | | | | | | particularly annoying hack, namely having the linker bash the moduledata to set the container pointer, preventing it being const. In the process, a stack of warnings were fixed and will probably allow a revisit of the const C_SYSINIT() changes. This explicitly registers modules in files or preload areas with the module system first, and let them initialize via SYSINIT/DECLARE_MODULE later in their SI_ORDER_xxx order. The kludge of finding the containing file is no longer needed since the registration of modules onto the modules list is done in the context of initializing the linker file.
* Enable vmspace sharing on SMP. Major changes are,luoqi1999-04-281-3/+1
| | | | | | | | | | | | | | | | | - %fs register is added to trapframe and saved/restored upon kernel entry/exit. - Per-cpu pages are no longer mapped at the same virtual address. - Each cpu now has a separate gdt selector table. A new segment selector is added to point to per-cpu pages, per-cpu global variables are now accessed through this new selector (%fs). The selectors in gdt table are rearranged for cache line optimization. - fask_vfork is now on as default for both UP and SMP. - Some aio code cleanup. Reviewed by: Alan Cox <alc@cs.rice.edu> John Dyson <dyson@iquest.net> Julian Elischer <julian@whistel.com> Bruce Evans <bde@zeta.org.au> David Greenman <dg@root.com>
* Suser() simplification:phk1999-04-271-3/+3
| | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code.
* LK_RETRY is a vn_lock() flag, not one for lockmgr().peter1999-04-061-3/+3
|
* * Register sysctl nodes before running sysinits when loading files anddfr1999-03-071-2/+2
| | | | | | | | unregister them after sysuninits when unloading. * Add code to vfs_register() to set the oid number of vfs sysctls to the type number of the filesystem. Reviewed by: bde
* A correction to the code which attempts to prevent the same moduledfr1999-02-201-1/+3
| | | | | | | | being loaded twice. It used rindex() to strip the pathname but failed to account for the fact that rindex() will return a pointer to the '/', not the first character of the filename. Submitted by: Nick Hibma <hibma@skylink.it>
* * Change sysctl from using linker_set to construct its tree using SLISTs.dfr1999-02-161-2/+42
| | | | | | | | | | This makes it possible to change the sysctl tree at runtime. * Change KLD to find and register any sysctl nodes contained in the loaded file and to unregister them when the file is unloaded. Reviewed by: Archie Cobbs <archie@whistle.com>, Peter Wemm <peter@netplex.com.au> (well they looked at it anyway)
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-8/+8
| | | | | | | kernel compile. This commit includes significant work to proper handle const arguments for the DDB symbol routines.
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-15/+15
| | | | kernel compile
* Don't try to call SYSUNINIT functions if there was a link error.dfr1999-01-251-2/+5
| | | | Reviewed by: Peter Wemm <peter@netplex.com.au>
* Update userref handling after discussion with submitter of previouspeter1999-01-231-4/+4
| | | | | | | | | | patch. lf can't be dereferenced after the unload attempt, in case it was freed. Instead, decrement first and back it out if the unload failed. This should be relatively immune to races caused by the user since the userref count will be zero for the duration of the actual unloading and will stop further kldunload attempts. Submitted by: Ustimenko Semen <semen@iclub.nsu.ru>
OpenPOWER on IntegriCloud