This is an archive of the discontinued LLVM Phabricator instance.

[10/10] ELF/Aarch64: Add overflow checks for relocation writes
ClosedPublic

Authored by zatrazz on Apr 7 2015, 7:43 AM.

Details

Summary

Hi ruiu, shankarke,

This is re-post of a previous attempt. This patch adds support for overflow checking when processing
R_AARCH64_CALL26, R_AARCH64_JUMP26, R_AARCH64_CONDBR19,
R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, and R_AARCH64_TLSLE_ADD_TPREL_HI12
relocations.

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 23338.Apr 7 2015, 7:43 AM
zatrazz retitled this revision from to [10/10] ELF/Aarch64: Add overflow checks for relocation writes.
zatrazz updated this object.
zatrazz edited the test plan for this revision. (Show Details)
zatrazz added reviewers: ruiu, shankar.easwaran.
zatrazz added a project: lld.
zatrazz added subscribers: Unknown Object (MLST), lld.
ruiu added inline comments.Apr 7 2015, 9:38 AM
lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.cpp
161

Does the result of S+A-P always fit within int32_t? If not, upper bits are cleared by converting an int64_t result into int32_t, which would result in false test pass in the following isInt<27>() check. Maybe we want to always use int64_t types here to avoid confusion and possible errors.

180

The same comment applies here.

356

Ditto

Hi,

Thanks for the review.

ruiu accepted this revision.Apr 7 2015, 12:51 PM
ruiu edited edge metadata.

LGTM assuming you will change int32 to int64.

This revision is now accepted and ready to land.Apr 7 2015, 12:51 PM
zatrazz closed this revision.Apr 21 2015, 11:15 AM