Skip to content

Verification fails for program of sample extension type. #455

Answered by dthaler
shankarseal asked this question in Q&A
Discussion options

You must be logged in to vote

It worked by chance because in the passing case (sample_ext) but not in the failing case (sample_ext/1), the compiler put a "r0 = 42" instruction after the call to bpf_map_lookup_elem, which meant it was initialized to 42 since that register was copied to the 3rd argument. In the failing case, r0 held the result of bpf_map_lookup_elem which was not an integer. So the byte code would verify even if the source code had a bug. The verified code was safe but probably didn't do what you wanted it to do.

BTW, the fact that the output only showed the first two args to sample_ebpf_extension_replace is a display bug, fixed in vbpf/ebpf-verifier#253

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@shankarseal
Comment options

shankarseal Aug 30, 2021
Maintainer Author

Comment options

You must be logged in to vote
5 replies
@shankarseal
Comment options

shankarseal Aug 30, 2021
Maintainer Author

@dthaler
Comment options

@shankarseal
Comment options

shankarseal Aug 30, 2021
Maintainer Author

@dthaler
Comment options

@shankarseal
Comment options

shankarseal Aug 30, 2021
Maintainer Author

Answer selected by shankarseal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants