[PATCH] D107328: [JITLink] Add fixup value range check

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 16:20:57 PST 2022


lhames added inline comments.


================
Comment at: llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp:212
+      if (LLVM_UNLIKELY(!isInRangeForImmU32(Value)))
+        return makeTargetOutOfRangeError(G, B, E);
       int32_t Lo = Value & 0xFFF;
----------------
jrtc27 wrote:
> LO12 should never be range checked, it's a waste of time as the HI20 half will also range check.
If LO12/HI20 relocations are always paired then it seems reasonable to elide the range check here, but we'd need a check that both elements of the pair are present in the input object: JITLink's policy is to assume that objects may be malformed / maliciously crafted and always check.

That needn't be addressed straight away, but we should at least add a FIXME for it. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107328/new/

https://reviews.llvm.org/D107328



More information about the llvm-commits mailing list