ebpf-verifier icon indicating copy to clipboard operation
ebpf-verifier copied to clipboard

Verifier fails to detect infinite loops on conditional jumps

Open Alan-Jowett opened this issue 4 months ago • 1 comments

All these tests should fail, but currently pass:

---
test-case: simple infinite loop, less than
options: ["termination"]

pre: []

code:
  <start>: |
    r0 = 0
    if r0 < 1 goto <start>
    exit

post: []

messages:
  - "1:2: Code is unreachable after 1:2"
# Message that should be generated by the verifier, but isn't:
#  - "Could not prove termination."
---
test-case: simple infinite loop, less than or equal
options: ["termination"]

pre: []

code:
  <start>: |
    r0 = 0
    if r0 <= 1 goto <start>
    exit

post: []

messages:
  - "1:2: Code is unreachable after 1:2"
# Message that should be generated by the verifier, but isn't:
#  - "Could not prove termination."

---
test-case: simple infinite loop, equal
options: ["termination"]

pre: []

code:
  <start>: |
    r0 = 0
    if r0 == 0 goto <start>
    exit

post: []

messages:
  - "1:2: Code is unreachable after 1:2"
# Message that should be generated by the verifier, but isn't:
#  - "Could not prove termination."

---
test-case: simple infinite loop, greater than
options: ["termination"]

pre: []

code:
  <start>: |
    r0 = 1
    if r0 > 0 goto <start>
    exit

post: []

messages:
  - "1:2: Code is unreachable after 1:2"
# Message that should be generated by the verifier, but isn't:
#  - "Could not prove termination."

---
test-case: simple infinite loop, greater than or equal
options: ["termination"]

pre: []

code:
  <start>: |
    r0 = 1
    if r0 >= 0 goto <start>
    exit

post: []

messages:
  - "1:2: Code is unreachable after 1:2"
# Message that should be generated by the verifier, but isn't:
#  - "Could not prove termination."

Alan-Jowett avatar Oct 18 '24 19:10 Alan-Jowett