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

[BPF] Update the BPF arch to match the current specification #2544

Open
2 of 5 tasks
Roeegg2 opened this issue Nov 11, 2024 · 4 comments
Open
2 of 5 tasks

[BPF] Update the BPF arch to match the current specification #2544

Roeegg2 opened this issue Nov 11, 2024 · 4 comments
Labels
BPF Arch enhancement outdated-module Issue due to an outdated arch module

Comments

@Roeegg2
Copy link

Roeegg2 commented Nov 11, 2024

Feature

  • New architecture module
  • Support for processor extension
  • Add more instruction details (elaborated below)
  • Binding support for: language
  • Other (elaborated below)

Describe the feature you'd like
Update the BPF architecture to the current specification

Additional context

  • Add JUMP32 instruction class
  • Add SDIV, SMOD, MOVSX instructions
  • Add ATOMIC instruction modifier
  • Add XCHG and CMPXCHG instructions

I think that's everything that needs to be updated, but if you do find something I'm missing, please let me know.

@Roeegg2
Copy link
Author

Roeegg2 commented Nov 11, 2024

If it's OK I would love to implement that :)

@Rot127 Rot127 added enhancement BPF Arch outdated-module Issue due to an outdated arch module labels Nov 11, 2024
@Rot127
Copy link
Collaborator

Rot127 commented Nov 11, 2024

Sure, go ahead!

@Roeegg2
Copy link
Author

Roeegg2 commented Nov 17, 2024

Apparently since around 2019 eBPF programs can jump backwards in code too, so all of the branch instructions are invalid now too... (offset is interpreted as signed value instead of unsigned)
I suspect there are other similar major changes too.
Should we add an option for different major eBPF versions? So we can still support older programs.

@Rot127
Copy link
Collaborator

Rot127 commented Nov 18, 2024

Quickly skimmed the kernel ISA and the RFC ISA. They seem to match. So you can change the bpf_op_mem::disp to be a 64bit field and cast it to what the instruction uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BPF Arch enhancement outdated-module Issue due to an outdated arch module
Projects
None yet
Development

No branches or pull requests

2 participants