Skip to content

Commit 2d71a90

Browse files
hawkinswborkmann
authored andcommitted
bpf, docs: Correct source of offset for program-local call
The offset to use when calculating the target of a program-local call is in the instruction's imm field, not its offset field. Signed-off-by: Will Hawkins <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Eduard Zingerman <[email protected]> Acked-by: David Vernet <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 5439cfa commit 2d71a90

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Documentation/bpf/standardization/instruction-set.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ BPF_JNE 0x5 any PC += offset if dst != src
373373
BPF_JSGT 0x6 any PC += offset if dst > src signed
374374
BPF_JSGE 0x7 any PC += offset if dst >= src signed
375375
BPF_CALL 0x8 0x0 call helper function by address see `Helper functions`_
376-
BPF_CALL 0x8 0x1 call PC += offset see `Program-local functions`_
376+
BPF_CALL 0x8 0x1 call PC += imm see `Program-local functions`_
377377
BPF_CALL 0x8 0x2 call helper function by BTF ID see `Helper functions`_
378378
BPF_EXIT 0x9 0x0 return BPF_JMP only
379379
BPF_JLT 0xa any PC += offset if dst < src unsigned
@@ -424,8 +424,8 @@ Program-local functions
424424
~~~~~~~~~~~~~~~~~~~~~~~
425425
Program-local functions are functions exposed by the same BPF program as the
426426
caller, and are referenced by offset from the call instruction, similar to
427-
``BPF_JA``. A ``BPF_EXIT`` within the program-local function will return to
428-
the caller.
427+
``BPF_JA``. The offset is encoded in the imm field of the call instruction.
428+
A ``BPF_EXIT`` within the program-local function will return to the caller.
429429

430430
Load and store instructions
431431
===========================

0 commit comments

Comments
 (0)