Date: Thu, 18 Sep 2003 07:03:28 -0700 (PDT) From: Andrew Reisse <areisse@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 38227 for review Message-ID: <200309181403.h8IE3SA8044845@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=38227 Change 38227 by areisse@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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309181403.h8IE3SA8044845>
