Handle "global and assumed valid" messages #66
Merged
Conversation
Collaborator
Author
|
Closes #64 |
jordalgo
reviewed
Aug 28, 2025
Verifier may emit a message indicating a global function call, which
is not verified inline, for example:
565: (85) call pc+234
Func#5 ('pick_any_bit') is global and assumed valid.
This is important for visualizer, because so far `call pc+offset`
pattern was handled exclusively as subprogram call.
A small challenge with this is that the overall design of bpfvv
expects line-by-line processing of the input log. And to handle cases
like this some backtracking (or lookahead) mechanism is necessary,
even though it is convenient to work with "lines" fundamentally.
Address this with the following changes:
* introduce ParsedLineType.KNOWN_MESSAGE and KnownMessageInfo to
recognize particular verifier messages
* leave parser interface unchanged (parseLine)
* split parsed lines processing in the analyzer into separate steps
* parse lines individually
* process known messages, potentially editing parsedLines
array (this is backtracking essentially)
* and then build bpfStates and cSourceMap
Fix off-by-one bug in LogLineRaw component when computing indentation.
Before this fix, the following fragment would not be indented:
586: (85) call pc+243
...
830: frame1: R1_w=map_value(map=third_pa.bss,ks=4,vs=5044,off=128,smin=smin32=0,smax=umax=smax32=umax32=4416,var_off=(0x0; 0x1fc0)) R10=fp0
; static int pick_most_loaded_cpu(struct cpdom_ctx *cpdomc) { @ balance.bpf.inc:180
830: (7b) *(u64 *)(r10 -32) = r1 ; frame1: R1_w=map_value(map=third_pa.bss,ks=4,vs=5044,off=128,smin=smin32=0,smax=umax=smax32=umax32=4416,var_off=(0x0; 0x1fc0)) R10=fp0 fp-32_w=map_value(map=third_pa.bss,ks=4,vs=5044,off=128,smin=smin32=0,smax=umax=smax32=umax32=4416,var_off=(0x0; 0x1fc0))
831: (b4) w0 = -2 ; frame1: R0_w=0xfffffffe
; if (!per_cpu_dsq) @ balance.bpf.inc:185
832: (18) r1 = 0xffffc90001bdfc1a ; frame1: R1_w=map_value(map=third_pa.rodata,ks=4,vs=17826,off=3098)
834: (71) r1 = *(u8 *)(r1 +0) ; frame1: R1_w=0
835: (56) if w1 != 0x1 goto pc+78 ; frame1: R1_w=0
; } @ balance.bpf.inc:206
914: (95) exit
7ff8d3e to
54fb5e1
Compare
jordalgo
approved these changes
Aug 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Verifier may emit a message indicating a global function call, which
is not verified inline, for example:
This is important for visualizer, because so far
call pc+offsetpattern was handled exclusively as subprogram call.
A small challenge with this is that the overall design of bpfvv
expects line-by-line processing of the input log. And to handle cases
like this some backtracking (or lookahead) mechanism is necessary,
even though it is convenient to work with "lines" fundamentally.
Address this with the following changes:
recognize particular verifier messages
array (this is backtracking essentially)