Skip to content
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

Trying to prove properties about eBPF programs (Clightgen issue) #792

Open
swarnpriya opened this issue Aug 26, 2024 · 7 comments
Open

Trying to prove properties about eBPF programs (Clightgen issue) #792

swarnpriya opened this issue Aug 26, 2024 · 7 comments

Comments

@swarnpriya
Copy link

Hello,

I am a new user and want to use VST to prove properties about eBPF programs (programs written in C that can be used to interact with Linux kernel from user space). Before diving into the actual proofs, I am facing challenges on using Clightgen. As I want to write my own C program and transform them to Clight, I want to use the tool Clightgen. But I am not sure how to install Clightgen tool inside VST. Also, in the coming future I want to use my own version of CompCert (targeting BPF bytecode) instead of the default one (compcert or compcert_new). I would appreciate if someone could share their thoughts of on how to install Clightgen inside VST.

Thanks.

@mansky1
Copy link
Collaborator

mansky1 commented Aug 26, 2024

Hi! I'm excited to hear that you're interested in this topic; I've been thinking about looking into eBPF verification myself recently. VST doesn't ship with Clightgen for copyright reasons, so you should install CompCert separately (if you're using OPAM, this is as simple as opam install coq-compcert; otherwise, you can download it from compcert.org and build it from source) to get access to Clightgen. If you just want to apply VST to the generated programs, that's all you need to do; if you're looking at building VST from source or modifying it, see the build instructions for how to build VST on top of an external CompCert installation. Please let me know if you run into any more questions or problems, and more generally, I'd love to hear how your project progresses!

Best,
William

@swarnpriya
Copy link
Author

Thank you William @mansky1 for the response. I solved the issue of Clightgen. I still need to figure out how to configure VST with my version of CompCert that targets BPF bytecode instead of x86 or ARM. I will keep you posted about my progress and once I get myself familiar with using VST, we can chat more.
On another note, I have worked with Coq proof assistant in several projects. How difficult is the learning curve for VST and do you have some suggestions about any other good document to follow apart from Software Foundation and the VerifiableC manual.

@mansky1
Copy link
Collaborator

mansky1 commented Aug 27, 2024

VST works on the Clight output of Clightgen, so the question is whether your modified CompCert does something different at the Clight level or only further down the chain.

I think VST is not too bad to learn if you work through the Verifiable C volume of Software Foundations (as distinct from the manual, which is quite hard to learn from if you don't already understand VST). But if you have questions, we do have a VST-user mailing list.

@swarnpriya
Copy link
Author

Can we reason about termination in VST? If yes, is there any specific example or papers you have in mind that would give me some better understanding about how it does? I am still wondering that proving functional correctness for eBPF programs won't be enough as we need to deal with helper functions properties and properties like termination, stack usage etc.

@andrew-appel
Copy link
Collaborator

We cannot reason about termination in VST.

@Salamari
Copy link
Contributor

Salamari commented Sep 2, 2024 via email

@mansky1
Copy link
Collaborator

mansky1 commented Sep 3, 2024

There's been some work on proving termination in the Iris separation logic framework: see for instance https://iris-project.org/pdfs/2019-esop-time.pdf and https://dl.acm.org/doi/pdf/10.1145/3453483.3454031. VST 3.0 is built on Iris, so we might be able to integrate some of these developments, though it'll definitely take some effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants