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

Add proposal for ABI compatible bpf() emulation #3898

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Oct 3, 2024

As discussed during this weeks triage meeting, I've written up my considerations of how I can do a port of ebpf-go to Windows.

Updates #3729

docs/BpfSyscallCompatibility.md Outdated Show resolved Hide resolved
docs/BpfSyscallCompatibility.md Show resolved Hide resolved
docs/BpfSyscallCompatibility.md Outdated Show resolved Hide resolved

### Differing `bpf_cmd_id` values

The values of `bpf_cmd_id` do not match Linux, which leads to ebpf-go performing the wrong syscalls.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if you used the Linux rather than the Windows BTF data, no? If ebpf-go for Windows is generated from Windows BTF why would it perform the wrong syscalls?

docs/BpfSyscallCompatibility.md Outdated Show resolved Hide resolved
```

This is problematic because Linux exposes many more fields in `bpf_map_info`, aliasing with the Windows-specific fields.
Adding a new cross-platform field before the Windows-specific fields will break API compatibility, adding it at the end will cause ABI break with Linux's defininition instead.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that it's not ABI compatible, but why will it break "API" compatibility? (which to me means source level)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah these terms are confusing.

My mental model of efW compatibility is currently that if you compile against your headers, binaries should continue to work with new versions of the runtime (otherwise the discussion of changing bpf_cmd_id etc. becomes moot.) This model breaks when adding a new cross-platform field, since the old binary will interpret it as inner_map_id.

@lmb
Copy link
Collaborator Author

lmb commented Oct 5, 2024

Something that would be useful to know: what projects or code currently relies on the bpf() emulation?

@lmb
Copy link
Collaborator Author

lmb commented Oct 17, 2024

@shankarseal can we please discuss this during the next office hours on Monday 2024-10-21?

@dthaler did my comments make sense to you? What do you think of the current proposal?

@lmb
Copy link
Collaborator Author

lmb commented Oct 22, 2024

Added a link and changed the wording to reflect what we discussed in the last triage meeting.

@Alan-Jowett Alan-Jowett added this pull request to the merge queue Oct 28, 2024
Merged via the queue into microsoft:main with commit 8862f74 Oct 28, 2024
89 checks passed
agarwalishita pushed a commit to agarwalishita/ebpf-for-windows that referenced this pull request Nov 20, 2024
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

Successfully merging this pull request may close these issues.

4 participants