1/*- 2 * Copyright (c) 1998-2000 Doug Rabson 3 * Copyright (c) 2004 Peter Wemm 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/kern/link_elf_obj.c 241896 2012-10-22 17:50:54Z kib $"); |
30 31#include "opt_ddb.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/lock.h> 37#include <sys/malloc.h> --- 407 unchanged lines hidden (view full) --- 445 elf_file_t ef; 446 linker_file_t lf; 447 int symtabindex; 448 int symstrindex; 449 int shstrindex; 450 int nsym; 451 int pb, rl, ra; 452 int alignmask; |
453 454 shdr = NULL; 455 lf = NULL; 456 mapsize = 0; 457 hdr = NULL; 458 |
459 NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, td); |
460 flags = FREAD; 461 error = vn_open(&nd, &flags, 0, NULL); 462 if (error) 463 return error; |
464 NDFREE(&nd, NDF_ONLY_PNBUF); 465 if (nd.ni_vp->v_type != VREG) { 466 error = ENOEXEC; 467 goto out; 468 } 469#ifdef MAC 470 error = mac_kld_check_load(td->td_ucred, nd.ni_vp); 471 if (error) { --- 387 unchanged lines hidden (view full) --- 859 if (error) 860 goto out; 861 862 *result = lf; 863 864out: 865 VOP_UNLOCK(nd.ni_vp, 0); 866 vn_close(nd.ni_vp, FREAD, td->td_ucred, td); |
867 if (error && lf) 868 linker_file_unload(lf, LINKER_UNLOAD_FORCE); 869 if (hdr) 870 free(hdr, M_LINKER); 871 872 return error; 873} 874 --- 501 unchanged lines hidden --- |