All sorts of places in the ELF loading code assume that filesz <=
memsz, so check that explicitly up front. The kernel already performs
this check for the PT_LOAD segments in the main binary and rtld in
imgact_elf.c.
Details
Details
- Reviewers
kib markj jrtc27 - Commits
- rG144dbb0bc0e1: rtld: Reject ELF files with PT_LOAD or PT_TLS segments where filesz > memsz
rGdb8b81ca99aa: rtld: Reject ELF files with PT_LOAD or PT_TLS segments where filesz > memsz
rG535eb24d8451: rtld: Reject ELF files with PT_LOAD or PT_TLS segments where filesz > memsz
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
I do not object, but I also note that rtld trusts the format of the objects to be correct. There is a lot of missed bounds checks.