Lines Matching defs:imgp

89 static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp,
93 static int __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
95 static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp);
99 static boolean_t __elfN(check_note)(struct image_params *imgp,
313 __elfN(get_brandinfo)(struct image_params *imgp, const char *interp,
316 const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header;
343 ret = __elfN(check_note)(imgp, bi->brand_note, osrel,
347 ret = bi->header_supported(imgp, osrel,
388 bi->header_supported(imgp, NULL, NULL)) {
416 ret = bi->header_supported(imgp, NULL, NULL);
436 bi->header_supported(imgp, NULL, NULL)))
450 bi->header_supported(imgp, NULL, NULL)))
525 __elfN(map_insert)(struct image_params *imgp, vm_map_t map, vm_object_t object,
583 locked = VOP_ISLOCKED(imgp->vp);
584 VOP_UNLOCK(imgp->vp);
586 vn_lock(imgp->vp, locked | LK_RETRY);
589 MPASS(imgp->vp->v_object == object);
590 VOP_SET_TEXT_CHECKED(imgp->vp);
597 __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
618 if ((filsz != 0 && (off_t)filsz + offset > imgp->attr->va_size) ||
624 object = imgp->object;
625 map = &imgp->proc->p_vmspace->vm_map;
647 rv = __elfN(map_insert)(imgp, map, object, file_addr,
670 rv = __elfN(map_insert)(imgp, map, NULL, 0, map_addr,
701 __elfN(load_sections)(struct image_params *imgp, const Elf_Ehdr *hdr,
709 ASSERT_VOP_LOCKED(imgp->vp, __func__);
720 error = __elfN(load_section)(imgp, phdr[i].p_offset,
766 struct image_params *imgp;
783 imgp = &tempdata->image_params;
788 imgp->proc = p;
789 imgp->attr = attr;
798 imgp->vp = nd->ni_vp;
803 error = exec_check_permissions(imgp);
807 error = exec_map_first_page(imgp);
811 imgp->object = nd->ni_vp->v_object;
813 hdr = (const Elf_Ehdr *)imgp->image_header;
831 phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff);
837 error = __elfN(load_sections)(imgp, hdr, phdr, rbase, &base_addr);
845 if (imgp->firstpage)
846 exec_unmap_first_page(imgp);
849 if (imgp->textset)
883 __elfN(enforce_limits)(struct image_params *imgp, const Elf_Ehdr *hdr,
933 PROC_LOCK(imgp->proc);
934 if (data_size > lim_cur_proc(imgp->proc, RLIMIT_DATA))
938 else if (total_size > lim_cur_proc(imgp->proc, RLIMIT_VMEM))
940 else if (racct_set(imgp->proc, RACCT_DATA, data_size) != 0)
942 else if (racct_set(imgp->proc, RACCT_VMEM, total_size) != 0)
944 PROC_UNLOCK(imgp->proc);
950 vmspace = imgp->proc->p_vmspace;
960 __elfN(get_interp)(struct image_params *imgp, const Elf_Phdr *phdr,
969 ASSERT_VOP_LOCKED(imgp->vp, __func__);
993 VOP_UNLOCK(imgp->vp);
995 vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
998 error = vn_rdwr(UIO_READ, imgp->vp, interp,
1014 interp = __DECONST(char *, imgp->image_header) + phdr->p_offset;
1026 __elfN(load_interp)(struct image_params *imgp, const Elf_Brandinfo *brand_info,
1037 error = __elfN(load_file)(imgp->proc, path, addr, entry);
1046 error = __elfN(load_file)(imgp->proc,
1052 error = __elfN(load_file)(imgp->proc, interp, addr, entry);
1067 __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
1085 hdr = (const Elf_Ehdr *)imgp->image_header;
1106 phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff);
1151 error = __elfN(get_interp)(imgp, &phdr[i], &interp,
1158 imgp->stack_prot =
1160 imgp->stack_sz = phdr[i].p_memsz;
1168 brand_info = __elfN(get_brandinfo)(imgp, interp, &osrel, &fctl0);
1192 (imgp->proc->p_flag2 & P2_ASLR_DISABLE) == 0) ||
1193 (imgp->proc->p_flag2 & P2_ASLR_ENABLE) != 0)
1211 VOP_UNLOCK(imgp->vp);
1220 if (imgp->credential_setid) {
1221 PROC_LOCK(imgp->proc);
1222 imgp->proc->p_flag2 &= ~(P2_ASLR_ENABLE | P2_ASLR_DISABLE);
1223 PROC_UNLOCK(imgp->proc);
1226 (imgp->proc->p_flag2 & P2_ASLR_DISABLE) != 0 ||
1230 } else if ((imgp->proc->p_flag2 & P2_ASLR_ENABLE) != 0 ||
1233 imgp->map_flags |= MAP_ASLR;
1241 (imgp->proc->p_flag2 & P2_ASLR_IGNSTART) != 0)
1242 imgp->map_flags |= MAP_ASLR_IGNSTART;
1246 imgp->map_flags |= MAP_WXORX;
1248 error = exec_new_vmspace(imgp, sv);
1249 vmspace = imgp->proc->p_vmspace;
1252 imgp->proc->p_sysent = sv;
1264 vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
1268 error = __elfN(load_sections)(imgp, hdr, phdr, et_dyn_addr, NULL);
1272 error = __elfN(enforce_limits)(imgp, hdr, phdr, et_dyn_addr);
1296 imgp->entry_addr = entry;
1299 VOP_UNLOCK(imgp->vp);
1307 error = __elfN(load_interp)(imgp, brand_info, interp, &addr,
1308 &imgp->entry_addr);
1309 vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
1320 VOP_UNLOCK(imgp->vp);
1322 vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
1334 imgp->auxargs = elf_auxargs;
1335 imgp->interpreted = 0;
1336 imgp->reloc_base = addr;
1337 imgp->proc->p_osrel = osrel;
1338 imgp->proc->p_fctl0 = fctl0;
1339 imgp->proc->p_elf_machine = hdr->e_machine;
1340 imgp->proc->p_elf_flags = hdr->e_flags;
1351 __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base)
1353 Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs;
1370 if (imgp->execpathp != 0)
1371 AUXARGS_ENTRY_PTR(pos, AT_EXECPATH, imgp->execpathp);
1373 imgp->proc->p_ucred->cr_prison->pr_osreldate);
1374 if (imgp->canary != 0) {
1375 AUXARGS_ENTRY_PTR(pos, AT_CANARY, imgp->canary);
1376 AUXARGS_ENTRY(pos, AT_CANARYLEN, imgp->canarylen);
1379 if (imgp->pagesizes != 0) {
1380 AUXARGS_ENTRY_PTR(pos, AT_PAGESIZES, imgp->pagesizes);
1381 AUXARGS_ENTRY(pos, AT_PAGESIZESLEN, imgp->pagesizeslen);
1383 if (imgp->sysent->sv_timekeep_base != 0) {
1385 imgp->sysent->sv_timekeep_base);
1387 AUXARGS_ENTRY(pos, AT_STACKPROT, imgp->sysent->sv_shared_page_obj
1388 != NULL && imgp->stack_prot != 0 ? imgp->stack_prot :
1389 imgp->sysent->sv_stackprot);
1390 if (imgp->sysent->sv_hwcap != NULL)
1391 AUXARGS_ENTRY(pos, AT_HWCAP, *imgp->sysent->sv_hwcap);
1392 if (imgp->sysent->sv_hwcap2 != NULL)
1393 AUXARGS_ENTRY(pos, AT_HWCAP2, *imgp->sysent->sv_hwcap2);
1396 AUXARGS_ENTRY(pos, AT_ARGC, imgp->args->argc);
1397 AUXARGS_ENTRY_PTR(pos, AT_ARGV, imgp->argv);
1398 AUXARGS_ENTRY(pos, AT_ENVC, imgp->args->envc);
1399 AUXARGS_ENTRY_PTR(pos, AT_ENVV, imgp->envv);
1400 AUXARGS_ENTRY_PTR(pos, AT_PS_STRINGS, imgp->ps_strings);
1401 if (imgp->sysent->sv_fxrng_gen_base != 0)
1402 AUXARGS_ENTRY(pos, AT_FXRNG, imgp->sysent->sv_fxrng_gen_base);
1405 free(imgp->auxargs, M_TEMP);
1406 imgp->auxargs = NULL;
1415 __elfN(freebsd_fixup)(uintptr_t *stack_base, struct image_params *imgp)
1421 if (suword(base, imgp->args->argc) == -1)
2637 __elfN(parse_notes)(struct image_params *imgp, Elf_Note *checknote,
2650 ASSERT_VOP_LOCKED(imgp->vp, "parse_notes");
2655 VOP_UNLOCK(imgp->vp);
2657 vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
2659 error = vn_rdwr(UIO_READ, imgp->vp, buf, pnote->p_filesz,
2669 note = note0 = (const Elf_Note *)(imgp->image_header +
2671 note_end = (const Elf_Note *)(imgp->image_header +
2762 __elfN(check_note)(struct image_params *imgp, Elf_Brandnote *brandnote,
2771 hdr = (const Elf_Ehdr *)imgp->image_header;
2772 phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff);
2779 if (phdr[i].p_type == PT_NOTE && __elfN(parse_notes)(imgp,
2784 __elfN(parse_notes)(imgp, &fctl_note,
2840 __elfN(stackgap)(struct image_params *imgp, uintptr_t *stack_base)
2850 range = imgp->eff_stack_sz * pct / 100;