[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
Loading
Please sign in to comment