Page MenuHomeFreeBSD

Always give ELF brands a chance to veto a match.
ClosedPublic

Authored by jhb on Jan 17 2018, 12:21 AM.
Tags
None
Referenced Files
F86958336: D13945.diff
Thu, Jun 27, 6:52 PM
Unknown Object (File)
May 23 2024, 4:24 PM
Unknown Object (File)
May 5 2024, 11:00 AM
Unknown Object (File)
Jan 14 2024, 4:51 PM
Unknown Object (File)
Dec 23 2023, 2:35 AM
Unknown Object (File)
Aug 21 2023, 9:16 PM
Unknown Object (File)
Jun 13 2023, 7:17 AM
Unknown Object (File)
May 26 2023, 9:25 PM
Subscribers
None

Details

Summary

If a brand provides a header_supported hook, check it when trying to find
a brand based on a matching interpreter as well as in the final loop for the
fallback brand. Previously a brand might reject a binary via a
header_supported hook in one of the earlier loops, but still be chosen by
one of these later loops.

Test Plan

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14427
Build 14578: arc lint + arc unit

Event Timeline

kib added inline comments.
sys/kern/imgact_elf.c
375

Why put the condition into the separate if () ? It naturally extends the existing condition with &&.

This revision is now accepted and ready to land.Jan 17 2018, 9:22 AM
sys/kern/imgact_elf.c
375

Mostly because the if condition was starting to get ugly to read. The rest of this function always invokes header_supported in a separate statement as well and this seemed a bit more readable. (The == 0 in the strncmp having to wrap is rather unfortunate for readability.)

389

My one open question is if we should be running header_supported here? On the one hand a fallback brand has to be opted into, OTOH, a header_supported method probably knows it can't possibly handle certain types of files so should probably be honored?

sys/kern/imgact_elf.c
389

I agree that it would be more consistent to check all places where we might to select the brand, against the header_supported. Until we have a case were the matching result changes, it is more theoretical question.

  • Always check header_supported.
This revision now requires review to proceed.Jan 31 2018, 5:48 PM
jhb retitled this revision from Give ELF brands a chance to veto a match based on just the interpreter. to Always give ELF brands a chance to veto a match..Jan 31 2018, 5:50 PM
jhb edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Feb 5 2018, 6:20 PM
This revision was automatically updated to reflect the committed changes.