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 123742 2003-12-23 02:42:39Z peter $"); |
33 34#include <sys/param.h> 35#include <sys/exec.h> 36#include <sys/fcntl.h> 37#include <sys/imgact.h> 38#include <sys/imgact_elf.h> 39#include <sys/kernel.h> 40#include <sys/lock.h> --- 662 unchanged lines hidden (view full) --- 703 brand_info = __elfN(get_brandinfo)(hdr, interp); 704 if (brand_info == NULL) { 705 uprintf("ELF binary type \"%u\" not known.\n", 706 hdr->e_ident[EI_OSABI]); 707 error = ENOEXEC; 708 goto fail; 709 } 710 sv = brand_info->sysvec; |
711 if (interp != NULL && brand_info->interp_newpath != NULL) 712 interp = brand_info->interp_newpath; |
713 714 if ((error = exec_extract_strings(imgp)) != 0) 715 goto fail; 716 717 exec_new_vmspace(imgp, sv); 718 719 vmspace = imgp->proc->p_vmspace; 720 --- 94 unchanged lines hidden (view full) --- 815 * its maximum allowed size. 816 */ 817 addr = round_page((vm_offset_t)imgp->proc->p_vmspace->vm_daddr + 818 imgp->proc->p_rlimit[RLIMIT_DATA].rlim_max); 819 820 imgp->entry_addr = entry; 821 822 imgp->proc->p_sysent = sv; |
823 if (interp != NULL && brand_info->emul_path != NULL && 824 brand_info->emul_path[0] != '\0') { |
825 path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); 826 snprintf(path, MAXPATHLEN, "%s%s", brand_info->emul_path, 827 interp); |
828 error = __elfN(load_file)(imgp->proc, path, &addr, 829 &imgp->entry_addr, sv->sv_pagesize); |
830 free(path, M_TEMP); |
831 if (error == 0) 832 interp = NULL; |
833 } |
834 if (interp != NULL) { 835 error = __elfN(load_file)(imgp->proc, interp, &addr, 836 &imgp->entry_addr, sv->sv_pagesize); 837 if (error != 0) { 838 uprintf("ELF interpreter %s not found\n", interp); 839 goto fail; 840 } 841 } |
842 843 /* 844 * Construct auxargs table (used by the fixup routine) 845 */ 846 elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_WAITOK); 847 elf_auxargs->execfd = -1; 848 elf_auxargs->phdr = proghdr; 849 elf_auxargs->phent = hdr->e_phentsize; --- 425 unchanged lines hidden --- |