Deleted Added
full compact
imgact_elf.c (120422) imgact_elf.c (123742)
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 120422 2003-09-25 01:10:26Z peter $");
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;
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;
711
712 if ((error = exec_extract_strings(imgp)) != 0)
713 goto fail;
714
715 exec_new_vmspace(imgp, sv);
716
717 vmspace = imgp->proc->p_vmspace;
718

--- 94 unchanged lines hidden (view full) ---

813 * its maximum allowed size.
814 */
815 addr = round_page((vm_offset_t)imgp->proc->p_vmspace->vm_daddr +
816 imgp->proc->p_rlimit[RLIMIT_DATA].rlim_max);
817
818 imgp->entry_addr = entry;
819
820 imgp->proc->p_sysent = sv;
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;
821 if (interp != NULL) {
823 if (interp != NULL && brand_info->emul_path != NULL &&
824 brand_info->emul_path[0] != '\0') {
822 path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
823 snprintf(path, MAXPATHLEN, "%s%s", brand_info->emul_path,
824 interp);
825 path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
826 snprintf(path, MAXPATHLEN, "%s%s", brand_info->emul_path,
827 interp);
825 if ((error = __elfN(load_file)(imgp->proc, path, &addr,
826 &imgp->entry_addr, sv->sv_pagesize)) != 0) {
827 if ((error = __elfN(load_file)(imgp->proc, interp,
828 &addr, &imgp->entry_addr, sv->sv_pagesize)) != 0) {
829 uprintf("ELF interpreter %s not found\n",
830 path);
831 free(path, M_TEMP);
832 goto fail;
833 }
834 }
828 error = __elfN(load_file)(imgp->proc, path, &addr,
829 &imgp->entry_addr, sv->sv_pagesize);
835 free(path, M_TEMP);
830 free(path, M_TEMP);
831 if (error == 0)
832 interp = NULL;
836 }
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 }
837
838 /*
839 * Construct auxargs table (used by the fixup routine)
840 */
841 elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_WAITOK);
842 elf_auxargs->execfd = -1;
843 elf_auxargs->phdr = proghdr;
844 elf_auxargs->phent = hdr->e_phentsize;

--- 425 unchanged lines hidden ---
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 ---