seL4 / seL4_libs

No-assurance libraries for rapid-prototyping of seL4 apps.
https://docs.sel4.systems
Other
51 stars 64 forks source link

Crash in sel4utils_elf_get_vsyscall if __vsyscall section is not present #13

Closed philipderrin closed 5 years ago

philipderrin commented 5 years ago

Commit 9152ea98ac48 introduced a generic sel4utils_elf_get_section() function and made sel4utils_elf_get_vsyscall() a wrapper for it.

Prior to this commit, the result of elf_getSectionNamed() was compared to NULL before it was dereferenced:

https://github.com/seL4/seL4_libs/blob/2ac35765e9aa0e6b38ed7eb0189164b23224ed77/libsel4utils/src/elf.c#L294

After the change, the pointer is dereferenced regardless of whether it is NULL, leading to a crash if the section is not present:

https://github.com/seL4/seL4_libs/blob/9152ea98ac4891733a29def494681f23b77f4612/libsel4utils/src/elf.c#L286

kent-mcleod commented 5 years ago

Thanks for reporting this! I'll close this issue when it is fixed.