Skip to content

Commit d94df04

Browse files
committed
Add text about underflow, overflow, and division by zero
Signed-off-by: Dave Thaler <[email protected]>
1 parent 09c647d commit d94df04

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

isa/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Some documentation links include:
77
* https://docs.cilium.io/en/stable/bpf/
88
* https://www.kernel.org/doc/Documentation/networking/filter.txt
99
* https://pchaigno.github.io/bpf/2021/10/20/ebpf-instruction-sets.html
10+
* https://www.kernel.org/doc/html/latest/bpf/bpf_design_QA.html#instruction-level-questions
1011

1112
Some implementation links include:
1213

isa/kernel.org/instruction-set.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ The 4-bit 'code' field encodes the operation as follows:
185185
BPF_END 0xd0 byte swap operations (see `Byte swap instructions`_ below)
186186
======== ===== =================================================
187187

188+
Underflow and overflow are allowed during arithmetic operations,
189+
meaning the 64-bit or 32-bit value will wrap.
190+
191+
``BPF_DIV`` has an implicit program exit condition as well. If
192+
eBPF program execution would result in division by zero,
193+
program execution must be gracefully aborted.
194+
188195
Examples:
189196

190197
``BPF_ADD | BPF_X | BPF_ALU`` (0x0c) means::

0 commit comments

Comments
 (0)