Page MenuHomeFreeBSD

Only allow one PT_INTERP ELF program header
ClosedPublic

Authored by jtl on Dec 23 2015, 3:58 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 10 2024, 5:47 PM
Unknown Object (File)
Sep 21 2024, 5:48 AM
Unknown Object (File)
Sep 16 2024, 12:52 PM
Unknown Object (File)
Sep 8 2024, 9:21 PM
Unknown Object (File)
Sep 8 2024, 12:33 PM
Unknown Object (File)
Sep 7 2024, 6:13 PM
Unknown Object (File)
Aug 21 2024, 10:30 PM
Unknown Object (File)
Aug 13 2024, 12:43 PM
Subscribers

Details

Summary

Only allow one PT_INTERP ELF program header. This fixes a memory leak introduced by rS289322 (D3871). When there is more than one PT_INTERP header with an offset beyond the first page, the code would allocate interp_buf multiple times, but only free the last allocation.

Because it doesn't make sense to have multiple PT_INTERP headers, we can eliminate the problem by just enforcing that restriction.

Test Plan

It compiles. I can still run ELF binaries with a single PT_INTERP program header.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jtl retitled this revision from to Only allow one PT_INTERP ELF program header.
jtl updated this object.
jtl edited the test plan for this revision. (Show Details)
jtl added reviewers: kib, emaste, jhb.
kib edited edge metadata.

Similar, but less serious issue exists in the libexec/rtld-elf/map_object,c for PT_NOTE handler mmaping the note segment.

This revision is now accepted and ready to land.Dec 23 2015, 11:09 AM
This revision was automatically updated to reflect the committed changes.