-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement callx instruction #584
Conversation
13c247e
to
4bd4861
Compare
These instructions are generated by both clang (under -O0 or -O1) and gcc (if the experimental -mxbpf option is passed to the compiler), but are not supported by Linux. Per mailing list discussion at https://mailarchive.ietf.org/arch/msg/bpf/CDQjTO8R8gdPdfeKVnoxWco8_Lw/ the intent is to support them eventually, and with this PR, ebpf-for-windows can support them now. This will also unblock the ability to use versions of clang later than clang-11 by using -O1 instead of -O2 (which generates correlated branches PREVAIL can't deal with). The mailing list discussion at https://mailarchive.ietf.org/arch/msg/bpf/Vx1H3ViPUWoGKNssCO22lOIjyXU/ agreed that inst.dst is where to put the register to use going forward and clang v.19 will do so but earlier versions of clang used inst.imm. Signed-off-by: Dave Thaler <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I will merge after the style comments are addressed.
I'd do some of it differently, but it can probably wait for a future PR:
Instead of a dedicated Callx
struct, we can have a Value
function as a field in Call
.
Other fields in Call
go either into a Signature
struct or left as platform details (name).
The value of the register will not be replaced by multiple instruction, but with the meet-over-signatures of possible values (signature, as a type, is itself an abstract domain; meet can be as simple as "either a single value or BOTTOM").
get_assertions()
will not be needed as a general interface to the assertions
module; we only need it for callx, and we pass instruction because we don't have a "signature" struct/abstract domain.
Signed-off-by: Dave Thaler <[email protected]>
Signed-off-by: Dave Thaler <[email protected]>
@elazarg I believe I've now addressed your comments. Please re-review. |
"callx" instructions are generated by both clang (under -O0 or -O1) and gcc (if the
experimental -mxbpf option is passed to the compiler), but are not supported by Linux.
Per mailing list discussion at
https://mailarchive.ietf.org/arch/msg/bpf/CDQjTO8R8gdPdfeKVnoxWco8_Lw/ the intent is for the Linux verifier to support them eventually, and with this PR, PREVAIL and dependent projects like ebpf-for-windows can support them now. This will also unblock the ability to use versions of clang later than clang-11 by using -O1 instead of -O2, which generates correlated branches PREVAIL can't deal with.
The approach taken by this PR is:
integer value at the time of the instruction. This covers the common case.
been done with the normal BPF_CALL instruction.
The mailing list discussion at
https://mailarchive.ietf.org/arch/msg/bpf/Vx1H3ViPUWoGKNssCO22lOIjyXU/
agreed that inst.dst is where to put the register to use going forward.
Clang v.19 will do so but earlier versions of clang all used inst.imm.