Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109826507
D26339.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
D26339.diff
View Options
Index: head/sys/kern/imgact_elf.c
===================================================================
--- head/sys/kern/imgact_elf.c
+++ head/sys/kern/imgact_elf.c
@@ -448,6 +448,13 @@
return (NULL);
}
+static bool
+__elfN(phdr_in_zero_page)(const Elf_Ehdr *hdr)
+{
+ return (hdr->e_phoff <= PAGE_SIZE &&
+ (u_int)hdr->e_phentsize * hdr->e_phnum <= PAGE_SIZE - hdr->e_phoff);
+}
+
static int
__elfN(check_header)(const Elf_Ehdr *hdr)
{
@@ -811,8 +818,7 @@
}
/* Only support headers that fit within first page for now */
- if ((hdr->e_phoff > PAGE_SIZE) ||
- (u_int)hdr->e_phentsize * hdr->e_phnum > PAGE_SIZE - hdr->e_phoff) {
+ if (!__elfN(phdr_in_zero_page)(hdr)) {
error = ENOEXEC;
goto fail;
}
@@ -1088,9 +1094,7 @@
* detected an ELF file.
*/
- if ((hdr->e_phoff > PAGE_SIZE) ||
- (u_int)hdr->e_phentsize * hdr->e_phnum > PAGE_SIZE - hdr->e_phoff) {
- /* Only support headers in first page for now */
+ if (!__elfN(phdr_in_zero_page)(hdr)) {
uprintf("Program headers not in the first page\n");
return (ENOEXEC);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 11, 1:03 AM (9 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16586620
Default Alt Text
D26339.diff (1 KB)
Attached To
Mode
D26339: imgact_elf.c: unify check for phdr fitting into the first page
Attached
Detach File
Event Timeline
Log In to Comment