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

Repr C for zero_copy #1106

Merged
merged 3 commits into from Dec 23, 2021
Merged

Repr C for zero_copy #1106

merged 3 commits into from Dec 23, 2021

Conversation

y2kappa
Copy link
Contributor

@y2kappa y2kappa commented Dec 5, 2021

Fixes #813

@y2kappa y2kappa marked this pull request as ready for review December 5, 2021 14:43
@y2kappa
Copy link
Contributor Author

y2kappa commented Dec 5, 2021

@armaniferrante @dovahcrow

Not ready yet, would like to see if there are any failing tests.

@fanatid
Copy link
Contributor

fanatid commented Dec 5, 2021

I think this can be considered as a breaking change and require a major version bump.

@dovahcrow
Copy link

Btw what is the alignment requirement for eBPF? E.g. if I run the VM on a 32bit machine, will it change the alignment requirement from 64to 32?

@archseer
Copy link
Contributor

archseer commented Dec 9, 2021

The VM registers are always 64-bit wide (even when running inside a 32-bit ARM processor kernel!) and support 32-bit subregister addressing [...]

https://www.collabora.com/news-and-blog/blog/2019/04/15/an-ebpf-overview-part-2-machine-and-bytecode/

So looks like 64 bit alignment.

@archseer
Copy link
Contributor

archseer commented Dec 9, 2021

A tip for figuring alignment out: compile with cargo rustc -- -Zprint-type-sizes and then inspect the types for any generated padding.

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.

Using repr(C) instead of repr(packed) for zero_copy?
5 participants