Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177952920
D61999.1795636297.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D61999.1795636297.diff
View Options
diff --git a/sys/arm64/arm64/elf_machdep.c b/sys/arm64/arm64/elf_machdep.c
--- a/sys/arm64/arm64/elf_machdep.c
+++ b/sys/arm64/arm64/elf_machdep.c
@@ -73,7 +73,8 @@
struct arm64_addr_mask elf64_addr_mask_14;
#endif
-static void arm64_exec_protect(struct image_params *, int);
+static void arm64_exec_protect(struct image_params *, unsigned long,
+ const void *, int);
static struct sysentvec elf64_freebsd_sysvec = {
.sv_size = SYS_MAXSYSCALL,
@@ -365,7 +366,8 @@
}
static void
-arm64_exec_protect(struct image_params *imgp, int flags __unused)
+arm64_exec_protect(struct image_params *imgp, unsigned long base_addr,
+ const void *_phdr, int flags __unused)
{
const Elf_Ehdr *hdr;
const Elf_Phdr *phdr;
@@ -378,7 +380,7 @@
return;
hdr = (const Elf_Ehdr *)imgp->image_header;
- phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff);
+ phdr = (const Elf_Phdr *)_phdr;
found = false;
for (i = 0; i < hdr->e_phnum; i++) {
@@ -396,7 +398,7 @@
if (phdr[i].p_type != PT_LOAD || phdr[i].p_memsz == 0)
continue;
- sva = phdr[i].p_vaddr + imgp->et_dyn_addr;
+ sva = phdr[i].p_vaddr + base_addr;
eva = sva + phdr[i].p_memsz;
pmap_bti_set(vmspace_pmap(imgp->proc->p_vmspace), sva, eva);
}
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -875,7 +875,7 @@
goto fail;
if (imgp->proc->p_sysent->sv_protect != NULL)
- imgp->proc->p_sysent->sv_protect(imgp, SVP_INTERP);
+ imgp->proc->p_sysent->sv_protect(imgp, rbase, phdr, SVP_INTERP);
*addr = base_addr;
*entry = (unsigned long)hdr->e_entry + rbase;
@@ -1405,7 +1405,7 @@
imgp->entry_addr = entry;
if (sv->sv_protect != NULL)
- sv->sv_protect(imgp, SVP_IMAGE);
+ sv->sv_protect(imgp, imgp->et_dyn_addr, phdr, SVP_IMAGE);
if (interp != NULL) {
VOP_UNLOCK(imgp->vp);
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h
--- a/sys/sys/sysent.h
+++ b/sys/sys/sysent.h
@@ -152,7 +152,8 @@
vm_offset_t sv_fxrng_gen_offset;
void (*sv_onexec_old)(struct thread *td);
int (*sv_onexec)(struct proc *, struct image_params *);
- void (*sv_protect)(struct image_params *, int);
+ void (*sv_protect)(struct image_params *, unsigned long,
+ const void *, int);
void (*sv_onexit)(struct proc *);
void (*sv_ontdexit)(struct thread *td);
int (*sv_setid_allowed)(struct thread *td,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 25, 7:51 PM (19 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41997263
Default Alt Text
D61999.1795636297.diff (2 KB)
Attached To
Mode
D61999: imgact_elf: Pass program headers to the sv_protect hook
Attached
Detach File
Event Timeline