1/*- 2 * Copyright (c) 1998-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/link_elf_obj.c 107089 2002-11-19 22:12:42Z rwatson $ |
27 */ 28 29#include "opt_ddb.h" |
30#include "opt_mac.h" |
31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/lock.h> |
36#include <sys/mac.h> |
37#include <sys/malloc.h> 38#include <sys/mutex.h> 39#include <sys/proc.h> 40#include <sys/namei.h> 41#include <sys/fcntl.h> 42#include <sys/vnode.h> 43#include <sys/linker.h> 44 --- 508 unchanged lines hidden (view full) --- 553 lf = NULL; 554 555 NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, td); 556 flags = FREAD; 557 error = vn_open(&nd, &flags, 0); 558 if (error) 559 return error; 560 NDFREE(&nd, NDF_ONLY_PNBUF); |
561#ifdef MAC 562 error = mac_check_kld_load(curthread->td_ucred, nd.ni_vp); 563 if (error) { 564 firstpage = NULL; 565 goto out; 566 } 567#endif |
568 569 /* 570 * Read the elf header from the file. 571 */ 572 firstpage = malloc(PAGE_SIZE, M_LINKER, M_WAITOK); 573 if (firstpage == NULL) { 574 error = ENOMEM; 575 goto out; --- 693 unchanged lines hidden --- |