aya icon indicating copy to clipboard operation
aya copied to clipboard

Inside `aya-ebpf::programs` some `raw` pointers are having `pub` visibility.

Open gabhijit opened this issue 10 months ago • 0 comments

Inside the crate aya-ebpf in the programs module (ebpf/aya-ebpf/src/programs), some internal raw pointers are exposed to user facing code as pub members. For example inside programs/device.rs) -

pub struct DeviceContext {
    pub device: *mut bpf_cgroup_dev_ctx,
}

This would allow the user code to use a raw pointer.

This is not consistent across all sub-modules.

Locally, I tried to fix those pub members and checked following -

$ cargo test
$ cargo xtask integration-tests local

Integration tests suggested a few failures as follows, but they appear to be unrelated.

failures:
    tests::btf_relocations::relocation_tests::_enum_signed_32_checked_variants_true_some_kernelversion_new_6_0_0_https_github_com_torvalds_linux_commit_6089fb3_0x7bbbbbbbi32_as_u64_expects
    tests::btf_relocations::relocation_tests::_enum_signed_32_true_some_kernelversion_new_6_0_0_https_github_com_torvalds_linux_commit_6089fb3_0x7bbbbbbbi32_as_u64_expects
    tests::btf_relocations::relocation_tests::_enum_signed_64_checked_variants_true_some_kernelversion_new_6_0_0_https_github_com_torvalds_linux_commit_6089fb3_0xcccccccdddddddi64_as_u64_expects
    tests::btf_relocations::relocation_tests::_enum_signed_64_true_some_kernelversion_new_6_0_0_https_github_com_torvalds_linux_commit_6089fb3_0xcccccccddddddddi64_as_u64_expects
    tests::btf_relocations::relocation_tests::_enum_unsigned_64_checked_variants_true_some_kernelversion_new_6_0_0_https_github_com_torvalds_linux_commit_6089fb3_0xccccccccdddddddd_expects
    tests::btf_relocations::relocation_tests::_enum_unsigned_64_true_some_kernelversion_new_6_0_0_https_github_com_torvalds_linux_commit_6089fb3_0xccccccccdddddddd_expects

Can send a draft PR for this.

gabhijit avatar Apr 17 '24 03:04 gabhijit