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)
Feb 17 2024, 3:13 PM
Unknown Object (File)
Dec 20 2023, 1:15 AM
Unknown Object (File)
Dec 13 2023, 11:08 AM
Unknown Object (File)
Nov 16 2023, 9:57 AM
Unknown Object (File)
Oct 3 2023, 4:44 AM
Unknown Object (File)
Sep 24 2023, 11:36 AM
Unknown Object (File)
Sep 12 2023, 9:43 PM
Unknown Object (File)
Aug 27 2023, 12:09 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.