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 APIs to utilize map of maps #213

Closed
wants to merge 1 commit into from

Conversation

kakkoyun
Copy link
Contributor

@kakkoyun kakkoyun commented Aug 17, 2022

Add selftest for the map of map interactions.

TODO

  • Properly test (I'm having problems testing this on the ARM64)

Copy link
Contributor

@javierhonduco javierhonduco left a comment

Choose a reason for hiding this comment

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

Left some initial comments, will do another pass later

selftest/map-of-maps/main.go Outdated Show resolved Hide resolved
//
// See usage of `bpf_map_get_fd_by_id()` in kernel selftests for more info.
func (m *Module) GetMapByID(id uint32) (*BPFMap, error) {
fdOrError := C.bpf_map_get_fd_by_id(C.uint(id))
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we perhaps check the second return value (errno)?

// This is only to satify the eBPF verifier and needs to be called before loading the module.
func (b *BPFMap) SetInnerMap(innerMap *BPFMap) error {
// b is the outer map.
errC := C.bpf_map__set_inner_map_fd(b.bpfMap, C.int(innerMap.fd))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

libbpfgo.go Outdated Show resolved Hide resolved
@kakkoyun kakkoyun force-pushed the add_map_of_map_apis branch 2 times, most recently from c67f0cb to 5621189 Compare August 18, 2022 05:40
Add selftest for these interactions
@grantseltzer
Copy link
Contributor

Hi @kakkoyun Should this still be set as a draft? Do you think it's ready for review and if not can I help you with it?

@kakkoyun
Copy link
Contributor Author

kakkoyun commented Sep 1, 2022

Hi @kakkoyun Should this still be set as a draft? Do you think it's ready for review and if not can I help you with it?

This is still a draft. I'll give it another shot now that I'm back to my usual working environment (better for testing), hopefully soon.

I could use an initial review and suggestions regarding the APIs though.

@grantseltzer
Copy link
Contributor

@kakkoyun Sounds good! i'll take a look later today. There may be a new API in libbpf 1.0 that could help with this as well.

@rafaeldtinoco rafaeldtinoco added this to the next-feature-milestone milestone Dec 12, 2022
@geyslan
Copy link
Member

geyslan commented Feb 1, 2023

@kakkoyun do you still have plans to get going with this PR? Thanks for contributing.

@kakkoyun
Copy link
Contributor Author

kakkoyun commented Feb 1, 2023

@geyslan I still want to have it in libbpfgo. I just need to spare time to figure out how to make it happen. Feel free to help me guide me :)

@geyslan
Copy link
Member

geyslan commented Feb 1, 2023

@geyslan I still want to have it in libbpfgo. I just need to spare time to figure out how to make it happen. Feel free to help me guide me :)

Ok then. First, could you resolve the conflicts? After call me for review. 👍🏼

@rafaeldtinoco
Copy link
Contributor

Is there any interest in continuing this work ? I'm afraid we did not have enough time to rebase and fix the issues, I'll keep it opened for sometime to see if there is any movement here. Cheers!

@kakkoyun
Copy link
Contributor Author

kakkoyun commented Jul 5, 2023

Is there any interest in continuing this work ? I'm afraid we did not have enough time to rebase and fix the issues, I'll keep it opened for sometime to see if there is any movement here. Cheers!

I would love to revisit this. However, I don't have enough free-cycles to work on this. Please feel free to just close it. I'll get back to it when I have time again.

@geyslan
Copy link
Member

geyslan commented Jul 20, 2023

@kakkoyun I'll continue this. 👍🏼

@geyslan
Copy link
Member

geyslan commented Jul 20, 2023

I gave some air to this in #343.

@geyslan geyslan closed this Jul 20, 2023
@geyslan geyslan mentioned this pull request Aug 10, 2023
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 11, 2023
This function allows to retrieve a map (BPFMapLow) by its ID. This is
useful when a map is created by a different origin.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 11, 2023
This allows to set the inner map definition of a map of maps which
doesn't have a preallocated inner map.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 11, 2023
This allows to set the inner map prototype of a map of maps which
doesn't have a pre-allocated inner map.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 11, 2023
This allows to set the inner map prototype of a map of maps which
doesn't have a pre-allocated inner map.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 16, 2023
This function allows to retrieve a map (BPFMapLow) by its ID. This is
useful when a map is created by a different origin.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 16, 2023
This allows to set the inner map prototype of a map of maps which
doesn't have a pre-allocated inner map.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 17, 2023
This function allows to retrieve a map (BPFMapLow) by its ID. This is
useful when a map is created by a different origin.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 17, 2023
This allows to set the inner map prototype of a map of maps which
doesn't have a pre-allocated inner map.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 24, 2023
This function allows to retrieve a map (BPFMapLow) by its ID. This is
useful when a map is created by a different origin.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 24, 2023
This allows to set the inner map prototype of a map of maps which
doesn't have a pre-allocated inner map.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 30, 2023
This function allows to retrieve a map (BPFMapLow) by its ID. This is
useful when a map is created by a different origin.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit to geyslan/libbpfgo that referenced this pull request Aug 30, 2023
This allows to set the inner map prototype of a map of maps which
doesn't have a pre-allocated inner map.

Initial effort: aquasecurity#213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit that referenced this pull request Sep 4, 2023
This function allows to retrieve a map (BPFMapLow) by its ID. This is
useful when a map is created by a different origin.

Initial effort: #213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
geyslan added a commit that referenced this pull request Sep 4, 2023
This allows to set the inner map prototype of a map of maps which
doesn't have a pre-allocated inner map.

Initial effort: #213

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
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.

None yet

5 participants