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

Feature Request: Make aya::obj API public to allow usage with different runtime #473

Closed
yesh0 opened this issue Dec 26, 2022 · 2 comments · Fixed by #475
Closed

Feature Request: Make aya::obj API public to allow usage with different runtime #473

yesh0 opened this issue Dec 26, 2022 · 2 comments · Fixed by #475

Comments

@yesh0
Copy link
Contributor

yesh0 commented Dec 26, 2022

There exists some user-space runtime for eBPF programs, like rbpf. However, taking rbpf for an example, it only accepts fully relocated raw eBPF bytecode (similar to BPF_PROG_LOAD in bpf(2)) and does not support loading programs compiled into a .o object.

It really helps if Aya could make its aya::obj API public, so that users of backends other than Linux kernel eBPF runtime can benefit from its .o loading and relocation capabilities.

@alessandrod
Copy link
Collaborator

This has come up a couple of times before. I think we could split the linking/relocation code as part of a separate aya-obj or something crate. I just don't want to commit to exposing it as part of the main aya crate. We're slowly refining the aya API towards releasing 1.0, and at this time I think we should focus on stabilizing the core APIs.

If you wanted to give this a go I'd be happy to review!

@vadorovsky
Copy link
Member

I would love to see that happening. Having proper rbpf support would let us to unit test and debug eBPF programs.

And I agree that we could move things out to a new aya-obj crate (inside monorepo, but released separately).

yesh0 added a commit to yesh0/aya that referenced this issue Dec 27, 2022
Aya::obj depends on bindgen generated files, and we start
by migrating bindgen generated files.

This commit adds the new aya-obj crate to the workplace
and migrates generated files into the crate. We use core
instead of std in an effort to make the final crate no_std.

Bindgen was run against libbpf v1.0.1.

Refs: aya-rs#473
yesh0 added a commit to yesh0/aya that referenced this issue Dec 27, 2022
To split the crate into two, several changes were made:
1. Most `pub(crate)` are now `pub` to allow access from Aya;
2. Parts of BpfError are merged into, for example, RelocationError;
3. BTF part of Features is moved into the new crate;
4. `#![deny(missing_docs)]` is removed temporarily;
5. Some other code gets moved into the new crate, mainly:
   - aya::{bpf_map_def, BtfMapDef, PinningType},
   - aya::programs::{CgroupSock*AttachType},

The new crate is currenly allowing missing_docs. Member visibility
will be adjusted later to minimize exposure of implementation details.

Refs: aya-rs#473
yesh0 added a commit to yesh0/aya that referenced this issue Dec 27, 2022
Aya::obj depends on bindgen generated files, and we start
by migrating bindgen generated files.

This commit adds the new aya-obj crate to the workplace
and migrates generated files into the crate. We use core
instead of std in an effort to make the final crate no_std.

Bindgen was run against libbpf v1.0.1.

Refs: aya-rs#473
yesh0 added a commit to yesh0/aya that referenced this issue Dec 27, 2022
To split the crate into two, several changes were made:
1. Most `pub(crate)` are now `pub` to allow access from Aya;
2. Parts of BpfError are merged into, for example, RelocationError;
3. BTF part of Features is moved into the new crate;
4. `#![deny(missing_docs)]` is removed temporarily;
5. Some other code gets moved into the new crate, mainly:
   - aya::{bpf_map_def, BtfMapDef, PinningType},
   - aya::programs::{CgroupSock*AttachType},

The new crate is currenly allowing missing_docs. Member visibility
will be adjusted later to minimize exposure of implementation details.

Refs: aya-rs#473
yesh0 added a commit to yesh0/aya that referenced this issue Dec 28, 2022
Types relevant to maps are moved into aya_obj::maps.
Some members are marked `pub(crate)` again.

Refs: aya-rs#473
yesh0 added a commit to yesh0/aya that referenced this issue Jan 2, 2023
Aya::obj depends on bindgen generated files, and we start
by migrating bindgen generated files.

This commit adds the new aya-obj crate to the workplace
and migrates generated files into the crate. We use core
instead of std in an effort to make the final crate no_std.

Bindgen was run against libbpf v1.0.1.

Refs: aya-rs#473
yesh0 added a commit to yesh0/aya that referenced this issue Jan 2, 2023
To split the crate into two, several changes were made:
1. Most `pub(crate)` are now `pub` to allow access from Aya;
2. Parts of BpfError are merged into, for example, RelocationError;
3. BTF part of Features is moved into the new crate;
4. `#![deny(missing_docs)]` is removed temporarily;
5. Some other code gets moved into the new crate, mainly:
   - aya::{bpf_map_def, BtfMapDef, PinningType},
   - aya::programs::{CgroupSock*AttachType},

The new crate is currenly allowing missing_docs. Member visibility
will be adjusted later to minimize exposure of implementation details.

Refs: aya-rs#473
yesh0 added a commit to yesh0/aya that referenced this issue Jan 2, 2023
Types relevant to maps are moved into aya_obj::maps.
Some members are marked `pub(crate)` again.

Refs: aya-rs#473
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 a pull request may close this issue.

3 participants