PERFORCE change 38227 for review
Andrew Reisse
areisse at FreeBSD.org
Thu Sep 18 14:03:28 GMT 2003
http://perforce.freebsd.org/chv.cgi?CH=38227
Change 38227 by areisse at areisse_tislabs on 2003/09/18 07:02:42
linker_preload no longer crashes when modules fail to load
Affected files ...
.. //depot/projects/trustedbsd/sebsd/sys/kern/kern_linker.c#5 edit
Differences ...
==== //depot/projects/trustedbsd/sebsd/sys/kern/kern_linker.c#5 (text+ko) ====
@@ -478,11 +478,6 @@
/* Refuse to unload modules if securelevel raised. */
if (securelevel > 0)
return (EPERM);
-#ifdef MAC
- error = mac_check_kld_unload(curthread->td_ucred);
- if (error)
- return (error);
-#endif
KLD_DPF(FILE, ("linker_file_unload: lf->refs=%d\n", file->refs));
if (file->refs == 1) {
@@ -801,6 +796,12 @@
if ((error = cap_check (td, CAP_SYS_MODULE)) != 0)
goto out;
+#ifdef MAC
+ error = mac_check_kld_unload(curthread->td_ucred);
+ if (error)
+ goto out;
+#endif
+
lf = linker_find_file_by_id(uap->fileid);
if (lf) {
KLD_DPF(FILE, ("kldunload: lf->userrefs=%d\n", lf->userrefs));
@@ -1281,6 +1282,7 @@
* We made it. Finish off the linking in the order we determined.
*/
TAILQ_FOREACH(lf, &depended_files, loaded) {
+reloop:
if (linker_kernel_file) {
linker_kernel_file->refs++;
error = linker_file_add_dependency(lf,
@@ -1314,8 +1316,10 @@
if (error) {
printf("KLD file %s - could not finalize loading\n",
lf->filename);
+ linker_file_t next = TAILQ_NEXT (lf, loaded);
linker_file_unload(lf);
- continue;
+ lf = next;
+ goto reloop;
}
linker_file_register_modules(lf);
if (linker_file_lookup_set(lf, "sysinit_set", &si_start,
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list