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 Skipped - Unit
Tests Skipped - Build Status
Buildable 75276 Build 72159: arc lint + arc unit
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.