Page MenuHomeFreeBSD

Fix cross-endian ELF note file / memory conversion
ClosedPublic

Authored by emaste on Dec 2 2014, 8:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 11, 9:38 AM
Unknown Object (File)
Thu, Nov 27, 12:32 PM
Unknown Object (File)
Sat, Nov 22, 6:51 AM
Unknown Object (File)
Nov 15 2025, 8:38 PM
Unknown Object (File)
Oct 31 2025, 12:39 PM
Unknown Object (File)
Oct 31 2025, 12:39 PM
Unknown Object (File)
Oct 31 2025, 12:39 PM
Unknown Object (File)
Oct 31 2025, 7:16 AM

Details

Summary

The problem was identified in r273443 but the fix was applied to the wrong place. The sizes are in native order after swapping for the file to memory case, and before swapping in the memory to file case.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste retitled this revision from to Fix cross-endian ELF note file / memory conversion.
emaste updated this object.
emaste edited the test plan for this revision. (Show Details)
emaste added reviewers: marcel, adrian.
emaste added a subscriber: Unknown Object (MLST).
adrian edited edge metadata.
This revision is now accepted and ready to land.Dec 2 2014, 8:25 PM

The first part of the diff is wrong because ROUNDUP2 is called *after* the bytes are swapped. That's exactly the thing you can't do that was fixed by my commit. The second part is correct in that it fixes exactly this problem.

In D1257#6, @marcel wrote:

The first part of the diff is wrong because ROUNDUP2 is called *after* the bytes are swapped.

ROUNDUP2 has to be called with the values in native endianness, which is after swapping in the file-to-memory case.

brooks added a reviewer: brooks.

Ah yes. The first part is in the reader. One needs to swap first.

emaste updated this revision to Diff 2609.

Closed by commit rS275430 (authored by @emaste).