Date: Thu, 25 May 2006 21:19:28 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 97825 for review Message-ID: <200605252119.k4PLJSTP063379@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=97825 Change 97825 by jhb@jhb_mutex on 2006/05/25 21:19:00 - linker_reference_module() is never called with the KLD_LOCK held anymore. - Use securelevel_gt() rather than checking the securelevel variable directly. Affected files ... .. //depot/projects/smpng/sys/kern/kern_linker.c#58 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_linker.c#58 (text+ko) ==== @@ -356,8 +356,8 @@ int foundfile, error; /* Refuse to load modules if securelevel raised */ - if (securelevel > 0) - return (EPERM); + if ((error = securelevel_gt(curthread->td_ucred, 0)) != 0) + return (error); KLD_LOCK_ASSERT(); lf = linker_find_file_by_name(filename); @@ -427,21 +427,17 @@ modlist_t mod; int error, locked; - locked = KLD_LOCKED(); - if (!locked) - KLD_LOCK(); + KLD_LOCK(); if ((mod = modlist_lookup2(modname, verinfo)) != NULL) { *result = mod->container; (*result)->refs++; - if (!locked) - KLD_UNLOCK(); + KLD_UNLOCK(); return (0); } error = linker_load_module(NULL, modname, NULL, verinfo, result); - if (!locked) - KLD_UNLOCK(); + KLD_UNLOCK(); return (error); } @@ -542,8 +538,8 @@ int error, i; /* Refuse to unload modules if securelevel raised. */ - if (securelevel > 0) - return (EPERM); + if ((error = securelevel_gt(curthread->td_ucred, 0)) != 0) + return (error); #ifdef MAC error = mac_check_kld_unload(curthread->td_ucred); if (error)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605252119.k4PLJSTP063379>