Files
clang-p2996/llvm/lib/Target/BPF/AsmParser
Eduard Zingerman f22442553b [BPF] Check jump and memory offsets to avoid truncation
The following assembly code should issue two errors specifying that
both jump and load offsets are out of range:

  if r1 > r2 goto +100500
  r1 = *(u64 *)(r1 - 100500)

This commit updates BPFAsmParser to check that:
- offset specified for jump is either identifier (label) or a 16-bit
  signed constant;
- offset specified for memory operations is a signed 16-bit constant.

(Which matches expectations in the BPFELFObjectWriter and
 BPFMCCodeEmitter).

Differential Revision: https://reviews.llvm.org/D158425
2023-09-23 19:39:24 +03:00
..