Skip to content

Commit cb7fddd

Browse files
Hubert Badochabadochov
authored andcommitted
proc: do not check sizes in not loadable sections
JIRA: RTOS-912
1 parent 83ffd64 commit cb7fddd

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

proc/process.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,11 @@ static int process_validateElf32(void *iehdr, size_t size)
359359
return -ENOEXEC;
360360
}
361361
for (i = 0; i < ehdr->e_phnum; i++) {
362-
if ((phdr->p_type != PT_LOAD) &&
363-
(process_isPtrValid(iehdr, size, ((char *)ehdr) + phdr[i].p_offset, phdr[i].p_filesz) == 0)) {
364-
return -ENOEXEC;
362+
if (phdr->p_type != PT_LOAD) {
363+
if (process_isPtrValid(iehdr, size, ((char *)ehdr) + phdr[i].p_offset, phdr[i].p_filesz) == 0) {
364+
return -ENOEXEC;
365+
}
366+
continue;
365367
}
366368

367369
offs = phdr->p_offset & ~(phdr->p_align - 1);
@@ -432,9 +434,11 @@ static int process_validateElf64(void *iehdr, size_t size)
432434
return -ENOEXEC;
433435
}
434436
for (i = 0; i < ehdr->e_phnum; i++) {
435-
if ((phdr->p_type != PT_LOAD) &&
436-
(process_isPtrValid(iehdr, size, ((char *)ehdr) + phdr[i].p_offset, phdr[i].p_filesz) == 0)) {
437-
return -ENOEXEC;
437+
if (phdr->p_type != PT_LOAD) {
438+
if (process_isPtrValid(iehdr, size, ((char *)ehdr) + phdr[i].p_offset, phdr[i].p_filesz) == 0) {
439+
return -ENOEXEC;
440+
}
441+
continue;
438442
}
439443

440444
offs = phdr->p_offset & ~(phdr->p_align - 1);

0 commit comments

Comments
 (0)