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

Malicious eBPF - slow JIT via expensive static analysis #186

Closed
jon-chuang opened this issue Jun 26, 2021 · 4 comments
Closed

Malicious eBPF - slow JIT via expensive static analysis #186

jon-chuang opened this issue Jun 26, 2021 · 4 comments

Comments

@jon-chuang
Copy link

jon-chuang commented Jun 26, 2021

I'd like to know what the worst case compilation+static analysis time for an eBPF program of size up to 10MB, by causing the static analysis to become very slow (for instance, jumping randomly on every instruction).

Still, a BTreeMap with 10M entries with integer keys doesn't seem that daunting... Cfg graph also has branching factor at most 2 - this means at most 20M edges.

@jon-chuang jon-chuang changed the title Malicious eBPF - slow JIT when deploy static analysis Malicious eBPF - slow JIT via expensive static analysis Jun 26, 2021
@Lichtso
Copy link

Lichtso commented Jun 28, 2021

Short answer: We don't know and it is quite likely that it can even run into infinite loops.
That is why we currently use the static analysis for debugging only and not in production.

@jon-chuang
Copy link
Author

I see, thanks.

May I know if a non-uniform opcode compute unit cost table is on the horizon? In the other issue I created, I argue for why it could be sensible to do so: #185.

I mistakenly assumed that CFG analysis was for the express purpose of facilitating the use of the compute meter for a non-uniform opcode cost.

@Lichtso
Copy link

Lichtso commented Jun 28, 2021

The static analysis was developed for a number of reasons:

  • Better debugging tools (what it is currently used for)
  • Hoist VM address translation from loop bodies outward (planned, but not implemented)
  • Advanced machine code diversification (this turned out to be impossible because of dynamic jumps)

@jon-chuang
Copy link
Author

I see, thanks.

Maybe it's worth considering this if static analysis is used for async compilation of cached executors in the future.

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

2 participants