imgact_elf.c (241025) | imgact_elf.c (241896) |
---|---|
1/*- 2 * Copyright (c) 2000 David O'Brien 3 * Copyright (c) 1995-1996 S��ren Schmidt 4 * Copyright (c) 1996 Peter Wemm 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 15 unchanged lines hidden (view full) --- 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 David O'Brien 3 * Copyright (c) 1995-1996 S��ren Schmidt 4 * Copyright (c) 1996 Peter Wemm 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 15 unchanged lines hidden (view full) --- 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/kern/imgact_elf.c 241025 2012-09-28 11:25:02Z kib $"); | 32__FBSDID("$FreeBSD: head/sys/kern/imgact_elf.c 241896 2012-10-22 17:50:54Z kib $"); |
33 34#include "opt_capsicum.h" 35#include "opt_compat.h" 36#include "opt_core.h" 37 38#include <sys/param.h> 39#include <sys/capability.h> 40#include <sys/exec.h> --- 549 unchanged lines hidden (view full) --- 590 const Elf_Ehdr *hdr = NULL; 591 const Elf_Phdr *phdr = NULL; 592 struct nameidata *nd; 593 struct vattr *attr; 594 struct image_params *imgp; 595 vm_prot_t prot; 596 u_long rbase; 597 u_long base_addr = 0; | 33 34#include "opt_capsicum.h" 35#include "opt_compat.h" 36#include "opt_core.h" 37 38#include <sys/param.h> 39#include <sys/capability.h> 40#include <sys/exec.h> --- 549 unchanged lines hidden (view full) --- 590 const Elf_Ehdr *hdr = NULL; 591 const Elf_Phdr *phdr = NULL; 592 struct nameidata *nd; 593 struct vattr *attr; 594 struct image_params *imgp; 595 vm_prot_t prot; 596 u_long rbase; 597 u_long base_addr = 0; |
598 int vfslocked, error, i, numsegs; | 598 int error, i, numsegs; |
599 600#ifdef CAPABILITY_MODE 601 /* 602 * XXXJA: This check can go away once we are sufficiently confident 603 * that the checks in namei() are correct. 604 */ 605 if (IN_CAPABILITY_MODE(curthread)) 606 return (ECAPMODE); --- 9 unchanged lines hidden (view full) --- 616 */ 617 imgp->proc = p; 618 imgp->attr = attr; 619 imgp->firstpage = NULL; 620 imgp->image_header = NULL; 621 imgp->object = NULL; 622 imgp->execlabel = NULL; 623 | 599 600#ifdef CAPABILITY_MODE 601 /* 602 * XXXJA: This check can go away once we are sufficiently confident 603 * that the checks in namei() are correct. 604 */ 605 if (IN_CAPABILITY_MODE(curthread)) 606 return (ECAPMODE); --- 9 unchanged lines hidden (view full) --- 616 */ 617 imgp->proc = p; 618 imgp->attr = attr; 619 imgp->firstpage = NULL; 620 imgp->image_header = NULL; 621 imgp->object = NULL; 622 imgp->execlabel = NULL; 623 |
624 NDINIT(nd, LOOKUP, MPSAFE|LOCKLEAF|FOLLOW, UIO_SYSSPACE, file, 625 curthread); 626 vfslocked = 0; | 624 NDINIT(nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_SYSSPACE, file, curthread); |
627 if ((error = namei(nd)) != 0) { 628 nd->ni_vp = NULL; 629 goto fail; 630 } | 625 if ((error = namei(nd)) != 0) { 626 nd->ni_vp = NULL; 627 goto fail; 628 } |
631 vfslocked = NDHASGIANT(nd); | |
632 NDFREE(nd, NDF_ONLY_PNBUF); 633 imgp->vp = nd->ni_vp; 634 635 /* 636 * Check permissions, modes, uid, etc on the file, and "open" it. 637 */ 638 error = exec_check_permissions(imgp); 639 if (error) --- 61 unchanged lines hidden (view full) --- 701 702fail: 703 if (imgp->firstpage) 704 exec_unmap_first_page(imgp); 705 706 if (nd->ni_vp) 707 vput(nd->ni_vp); 708 | 629 NDFREE(nd, NDF_ONLY_PNBUF); 630 imgp->vp = nd->ni_vp; 631 632 /* 633 * Check permissions, modes, uid, etc on the file, and "open" it. 634 */ 635 error = exec_check_permissions(imgp); 636 if (error) --- 61 unchanged lines hidden (view full) --- 698 699fail: 700 if (imgp->firstpage) 701 exec_unmap_first_page(imgp); 702 703 if (nd->ni_vp) 704 vput(nd->ni_vp); 705 |
709 VFS_UNLOCK_GIANT(vfslocked); | |
710 free(tempdata, M_TEMP); 711 712 return (error); 713} 714 715static int 716__CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) 717{ --- 1007 unchanged lines hidden --- | 706 free(tempdata, M_TEMP); 707 708 return (error); 709} 710 711static int 712__CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) 713{ --- 1007 unchanged lines hidden --- |