Skip to content
Commit f2244255 authored by Eduard Zingerman's avatar Eduard Zingerman
Browse files

[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
parent a6e81df2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment