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

Map of maps #366

Merged
merged 8 commits into from Sep 4, 2023
Merged

Map of maps #366

merged 8 commits into from Sep 4, 2023

Conversation

geyslan
Copy link
Member

@geyslan geyslan commented Aug 10, 2023

Close: #93
Context: #343 #213

commit faa3599 (HEAD -> map-of-maps, origin/map-of-maps)
Author: Geyslan Gregório geyslan@gmail.com
Date: Wed Aug 16 09:27:09 2023 -0300

feat(btf): introduce GetBTFFDByID()

This allows to get a FD to a BTF by its ID. This is useful to create a
BPFMapLow passing options set with a BTF ID.

commit cbd23d8
Author: Geyslan Gregório geyslan@gmail.com
Date: Mon Aug 14 09:17:20 2023 -0300

chore(selftest): map-of-maps-outer-low-inner-low

Introduce a new selftest that tests a map of maps with outer and inner
maps not pre-allocated in the BPF program.

commit 8634026
Author: Geyslan Gregório geyslan@gmail.com
Date: Mon Aug 14 09:00:56 2023 -0300

chore(selftest): map-of-maps-outer-high-inner-low

Introduce a new selftest that tests a map of maps with outer map
pre-allocated in the BPF program and an inner map from other origin -
not pre-allocated in the BPF program.

commit 00f47dd
Author: Geyslan Gregório geyslan@gmail.com
Date: Mon Aug 14 08:29:21 2023 -0300

chore(selftest): map-of-maps-outer-high-inner-high

Introduce a new selftest that tests a map of maps with outer and inner
maps pre-allocated in the BPF program.

commit bc7cb55
Author: Geyslan Gregório geyslan@gmail.com
Date: Fri Aug 11 18:30:23 2023 -0300

feat(map): introduce InnerMapInfo()

This allows to query the inner map information from the outer map before
the module is loaded.

Despite acting as a wrapper around bpf_map__inner_map(), which returns a
pointer to a libbpf bpf_map, it is not safe to use it as a BPFMap since
it will never be created. As soon as the module is loaded, the bpf_map
is destroyed. This is the reason why it returns a BPFMapInfo instead.

commit c834f37
Author: Geyslan Gregório geyslan@gmail.com
Date: Fri Aug 11 16:32:48 2023 -0300

feat(map): introduce SetInnerMapFD()

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>

commit b28c448
Author: Geyslan Gregório geyslan@gmail.com
Date: Thu Aug 10 18:53:04 2023 -0300

feat(map): introduce GetMapByID()

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>

commit 26259e3
Author: Geyslan Gregório geyslan@gmail.com
Date: Thu Aug 10 14:41:57 2023 -0300

feat(map): introduce GetMapFDByID()

This function allows to get a file descriptor of a map by its ID.

@geyslan geyslan self-assigned this Aug 10, 2023
@geyslan geyslan force-pushed the map-of-maps branch 9 times, most recently from 4b2d669 to a5838da Compare August 16, 2023 23:54
@geyslan geyslan marked this pull request as ready for review August 16, 2023 23:56
@geyslan geyslan added the feature New feature or request label Aug 16, 2023
geyslan and others added 7 commits August 17, 2023 18:37
This function allows to get a file descriptor of a map by its ID.
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>
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>
This allows to query the inner map information from the outer map before
the module is loaded.

Despite acting as a wrapper around bpf_map__inner_map(), which returns a
pointer to a libbpf bpf_map, it is not safe to use it as a BPFMap since
it will never be created. As soon as the module is loaded, the bpf_map
is destroyed. This is the reason why it returns a BPFMapInfo instead.
Introduce a new selftest that tests a map of maps with outer and inner
maps pre-allocated in the BPF program.
Introduce a new selftest that tests a map of maps with outer map
pre-allocated in the BPF program and an inner map from other origin -
not pre-allocated in the BPF program.
Introduce a new selftest that tests a map of maps with outer and inner
maps not pre-allocated in the BPF program.
This allows to get a FD to a BTF by its ID. This is useful to create a
BPFMapLow passing options set with a BTF ID.
Copy link
Collaborator

@yanivagman yanivagman left a comment

Choose a reason for hiding this comment

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

LGTM

@geyslan geyslan merged commit 4afed55 into aquasecurity:main Sep 4, 2023
10 checks passed
javierhonduco added a commit to parca-dev/parca-agent that referenced this pull request Sep 15, 2023
…-libbpf-1.2 (#2013)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[github.com/aquasecurity/libbpfgo](https://togithub.com/aquasecurity/libbpfgo)
| require | minor | `v0.4.9-libbpf-1.2.0.0.20230817212518-21cf435d454e`
-> `v0.5.0-libbpf-1.2` |

---

### Release Notes

<details>
<summary>aquasecurity/libbpfgo
(github.com/aquasecurity/libbpfgo)</summary>

###
[`v0.5.0-libbpf-1.2`](https://togithub.com/aquasecurity/libbpfgo/releases/tag/v0.5.0-libbpf-1.2)

#### What's Changed

- revive: update revive rules by
[@&#8203;rafaeldtinoco](https://togithub.com/rafaeldtinoco) in
[aquasecurity/libbpfgo#333
- Wrap `bpf_prog_attach` and `bpf_prog_detach2` by
[@&#8203;mozillazg](https://togithub.com/mozillazg) in
[aquasecurity/libbpfgo#335
- ci: running tests on multiple go versions by
[@&#8203;mozillazg](https://togithub.com/mozillazg) in
[aquasecurity/libbpfgo#336
- libbpf: bump to v1.2.2 by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#342
- fix: vagrant image install by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#341
- Add SkipMemlockBump to NewModuleArgs by
[@&#8203;bobrik](https://togithub.com/bobrik) in
[aquasecurity/libbpfgo#337
- fix: trim quote characters in osinfo by
[@&#8203;NDStrahilevitz](https://togithub.com/NDStrahilevitz) in
[aquasecurity/libbpfgo#344
- helpers: handle non numeric kernel versions by
[@&#8203;NDStrahilevitz](https://togithub.com/NDStrahilevitz) in
[aquasecurity/libbpfgo#345
- osinfo: add support for rhel by
[@&#8203;NDStrahilevitz](https://togithub.com/NDStrahilevitz) in
[aquasecurity/libbpfgo#347
- osinfo: support additional alma linux id by
[@&#8203;NDStrahilevitz](https://togithub.com/NDStrahilevitz) in
[aquasecurity/libbpfgo#348
- chore: increase timeout for selftests by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#349
- fix(selftest): handle arm64 function names by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#350
- dependabot add by
[@&#8203;gitworkflows](https://togithub.com/gitworkflows) in
[aquasecurity/libbpfgo#351
- build(deps): bump github.com/stretchr/testify from 1.8.2 to 1.8.4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[aquasecurity/libbpfgo#353
- build(deps): bump actions/checkout from 2 to 3 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[aquasecurity/libbpfgo#352
- chore: minor clang format and tidy adjustments by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#358
- chore: add helpers to dependabot by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#359
- build(deps): bump github.com/stretchr/testify from 1.8.0 to 1.8.4 in
/helpers by [@&#8203;dependabot](https://togithub.com/dependabot) in
[aquasecurity/libbpfgo#360
- build(deps): bump golang.org/x/sys from 0.1.0 to 0.11.0 in /helpers by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[aquasecurity/libbpfgo#361
- fix(selftest): kern_version logic by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#362
- fix(selftest): use channel for sync by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#364
- Split BPFMap API into managed and unmanaged by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#356
- fix(map): fix error wrap by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#368
- fix(helpers): lint err regarding return statement by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#369
- chore(github): add workflow test by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#370
- fix: `GetMap()` comment by
[@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#371
- Map of maps by [@&#8203;geyslan](https://togithub.com/geyslan) in
[aquasecurity/libbpfgo#366
- build(deps): bump golang.org/x/sys from 0.11.0 to 0.12.0 in /helpers
by [@&#8203;dependabot](https://togithub.com/dependabot) in
[aquasecurity/libbpfgo#375
- build(deps): bump actions/checkout from 3 to 4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[aquasecurity/libbpfgo#376

#### New Contributors

- [@&#8203;bobrik](https://togithub.com/bobrik) made their first
contribution in
[aquasecurity/libbpfgo#337
- [@&#8203;gitworkflows](https://togithub.com/gitworkflows) made their
first contribution in
[aquasecurity/libbpfgo#351
- [@&#8203;dependabot](https://togithub.com/dependabot) made their first
contribution in
[aquasecurity/libbpfgo#353

**Full Changelog**:
aquasecurity/libbpfgo@v0.4.9-libbpf-1.2.0...v0.5.0-libbpf-1.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/parca-dev/parca-agent).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
@geyslan geyslan deleted the map-of-maps branch November 28, 2023 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement libbpf bpf_create_map
2 participants