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: Maps live in maps section #248

Merged
merged 1 commit into from May 4, 2022
Merged

Conversation

dave-tucker
Copy link
Member

This forces all maps to the maps section so we remain compatible with
libbpf. This requires #181 to avoid breaking userspace.

Signed-off-by: Dave Tucker dave@dtucker.co.uk

@dave-tucker
Copy link
Member Author

Note to self: add userspace component to the test case that uses the maps...

@@ -49,11 +49,13 @@ impl Map {
}

pub fn expand(&self) -> Result<TokenStream> {
let section_name = format!("maps/{}", self.name);
let section_name = "maps".to_string();
Copy link
Contributor

Choose a reason for hiding this comment

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

libbpf expects maps live in .maps section.

Choose a reason for hiding this comment

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

It only expects them in .maps BTF maps.

But that being said, I think we need a way to specify it by using this macro.

I'm not suggesting it's the right PR to do this, it might be add as part of BTF map support.

Copy link
Contributor

Choose a reason for hiding this comment

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

The legacy one is deprecated.

Copy link
Member Author

Choose a reason for hiding this comment

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

The legacy, bpf_map_def style of map definition is the only style that we support in aya-bpf right now.

But that being said, I think we need a way to specify it by using this macro.

Not really. If we supported BTF defs, all maps would use BTF map defs.
I'm not sure if libbpf's deprecation notice means support will be removed from the kernel (I doubt it) or whether it's to give users a push to use BTF.

Anyhow, userspace support for BTF maps is proposed in #140 but still needs work.
Support in aya-bpf for BTF maps is sadly not as simple as the BTF generated for Rust programs by LLVM isn't correct.

@dave-tucker dave-tucker added fix A PR that is a small change or fixes a bug aya-bpf This is about aya-bpf (kernel) labels Apr 28, 2022
This forces all maps to the maps section so we remain compatible with
libbpf. This requires aya-rs#181 to avoid breaking userspace.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
@dave-tucker dave-tucker marked this pull request as ready for review May 3, 2022 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya-bpf This is about aya-bpf (kernel) fix A PR that is a small change or fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants