kern_linker.c (92927) | kern_linker.c (93159) |
---|---|
1/*- 2 * Copyright (c) 1997-2000 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1997-2000 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/kern/kern_linker.c 92927 2002-03-22 04:56:09Z arr $ | 26 * $FreeBSD: head/sys/kern/kern_linker.c 93159 2002-03-25 18:26:34Z arr $ |
27 */ 28 29#include "opt_ddb.h" 30 31#include <sys/param.h> 32#include <sys/kernel.h> 33#include <sys/systm.h> 34#include <sys/malloc.h> --- 658 unchanged lines hidden (view full) --- 693{ 694 char *kldname, *modname; 695 char *pathname = NULL; 696 linker_file_t lf; 697 int error = 0; 698 699 td->td_retval[0] = -1; 700 | 27 */ 28 29#include "opt_ddb.h" 30 31#include <sys/param.h> 32#include <sys/kernel.h> 33#include <sys/systm.h> 34#include <sys/malloc.h> --- 658 unchanged lines hidden (view full) --- 693{ 694 char *kldname, *modname; 695 char *pathname = NULL; 696 linker_file_t lf; 697 int error = 0; 698 699 td->td_retval[0] = -1; 700 |
701 if (securelevel > 0) /* redundant, but that's OK */ 702 return (EPERM); 703 | |
704 mtx_lock(&Giant); 705 | 701 mtx_lock(&Giant); 702 |
703 if ((error = securelevel_gt(td->td_ucred, 0)) != 0) 704 goto out; 705 |
|
706 if ((error = suser_xxx(td->td_ucred, NULL, 0)) != 0) 707 goto out; 708 709 pathname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); 710 if ((error = copyinstr(SCARG(uap, file), pathname, MAXPATHLEN, 711 NULL)) != 0) 712 goto out; 713 --- 26 unchanged lines hidden (view full) --- 740 * MPSAFE 741 */ 742int 743kldunload(struct thread *td, struct kldunload_args *uap) 744{ 745 linker_file_t lf; 746 int error = 0; 747 | 706 if ((error = suser_xxx(td->td_ucred, NULL, 0)) != 0) 707 goto out; 708 709 pathname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); 710 if ((error = copyinstr(SCARG(uap, file), pathname, MAXPATHLEN, 711 NULL)) != 0) 712 goto out; 713 --- 26 unchanged lines hidden (view full) --- 740 * MPSAFE 741 */ 742int 743kldunload(struct thread *td, struct kldunload_args *uap) 744{ 745 linker_file_t lf; 746 int error = 0; 747 |
748 if (securelevel > 0) /* redundant, but that's OK */ 749 return (EPERM); 750 | |
751 mtx_lock(&Giant); 752 | 748 mtx_lock(&Giant); 749 |
750 if ((error = securelevel_gt(td->td_ucred, 0)) != 0) 751 goto out; 752 |
|
753 if ((error = suser_xxx(td->td_ucred, NULL, 0)) != 0) 754 goto out; 755 756 lf = linker_find_file_by_id(SCARG(uap, fileid)); 757 if (lf) { 758 KLD_DPF(FILE, ("kldunload: lf->userrefs=%d\n", lf->userrefs)); 759 if (lf->userrefs == 0) { 760 printf("kldunload: attempt to unload file that was" --- 1007 unchanged lines hidden --- | 753 if ((error = suser_xxx(td->td_ucred, NULL, 0)) != 0) 754 goto out; 755 756 lf = linker_find_file_by_id(SCARG(uap, fileid)); 757 if (lf) { 758 KLD_DPF(FILE, ("kldunload: lf->userrefs=%d\n", lf->userrefs)); 759 if (lf->userrefs == 0) { 760 printf("kldunload: attempt to unload file that was" --- 1007 unchanged lines hidden --- |