-
Notifications
You must be signed in to change notification settings - Fork 444
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
Add P4Smith, a random program generator to the P4Tools framework #4182
Conversation
Hi! This looks like quite an interesting idea. Would this allow easily adding target platforms similarly to P4 testgen? What is currently missing for this to be non-WIP? |
There is not much work left, you can already generate random programs. I just need to finish the target-specific instantiation to make it possible to produce custom code per target. |
f3e8b01
to
1222914
Compare
48a1e94
to
5bb3127
Compare
Depends on #4650. |
5bb3127
to
fe8f10b
Compare
@asl @ChrisDodd We might be able to use this to fuzz #4562. |
@fruffy Does it support loop? |
Not yet, this random program generator uses the P4C IR to generate elements. But it could be extended to support loops. |
c8a1660
to
5036177
Compare
93d7990
to
65ecdb8
Compare
6e4f174
to
837ac83
Compare
@asl @vlstill @jafingerhut Requesting a review on this contribution to the P4Tools framework. This is getting increasingly hard for me to keep in sync with the compiler changes. I think it makes sense to get the initial version of this fuzzer in, then we can iteratively improve it. There are still many things that should be done here, but a rewrite in bulk is currently impractical for me. |
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.
I have only reviewed the two README.md files, and they look good. As far as the C++ code, I am happy to try to build it when this is merged in, and try it out a little bit to see whether it generates some random programs for me.
The tool itself also includes some compilation tests. But they are currently disabled because they are producing |
This is a port of Bludgeon, which has initially been written for Gauntlet.
Bludgeon is a P4 random program generator in the spirit of CSmith. It can generate random programs for p4test, p4c-bm2-ss, p4c-bm2-psa, and for the Tofino compiler.
Porting Bludgeon to the P4Tools framework will make it more extensible and improve its support for P4 targets. The new name of this tool is now P4Smith. This version is simple but can already generate random programs for:
psa
on BMv2.tna
on Tofino 1pna
on DPDKp4test
There is currently a lot of code duplication etc happening. That is an artifact of the port. Also this is still a port of graduate student code, so there is a lot of constructs that could be improved. I am hoping that this initial version is enough to build a common platform for a P4 fuzzer.