Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159223219
D57498.id179398.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D57498.id179398.diff
View Options
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
@@ -858,12 +858,12 @@
goto fail;
}
- if (!aligned(imgp->image_header + hdr->e_phoff, Elf_Addr) ||
- hdr->e_phnum > __elfN(phnums)) {
+ if (hdr->e_phnum > __elfN(phnums)) {
error = ENOEXEC;
goto fail;
}
- if (__elfN(phdr_in_zero_page)(hdr)) {
+ if (__elfN(phdr_in_zero_page)(hdr) &&
+ aligned(imgp->image_header + hdr->e_phoff, Elf_Addr)) {
phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff);
} else {
VOP_UNLOCK(imgp->vp);
@@ -1157,10 +1157,6 @@
free_interp = false;
m_phdrs = NULL;
- if (!aligned(imgp->image_header + hdr->e_phoff, Elf_Addr)) {
- uprintf("Unaligned program headers\n");
- return (ENOEXEC);
- }
if (hdr->e_phoff + hdr->e_phnum * hdr->e_phentsize < hdr->e_phoff) {
uprintf("PHDRS wrap\n");
return (ENOEXEC);
@@ -1170,7 +1166,8 @@
hdr->e_phnum, __elfN(phnums));
return (ENOEXEC);
}
- if (__elfN(phdr_in_zero_page)(hdr)) {
+ if (__elfN(phdr_in_zero_page)(hdr) &&
+ aligned(imgp->image_header + hdr->e_phoff, Elf_Addr)) {
phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff);
} else {
VOP_UNLOCK(imgp->vp);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jun 12, 12:58 PM (4 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33822620
Default Alt Text
D57498.id179398.diff (1 KB)
Attached To
Mode
D57498: imgact_elf: handle unaligned phdrs
Attached
Detach File
Event Timeline
Log In to Comment