Merge branch 'main' into ebpfloader_disable_unsupported_maps

pull/968/head
martinsoees 2 months ago
commit 37de0d1a26

@ -256,7 +256,7 @@ jobs:
# TODO: enable tests on kernels before 6.0. # TODO: enable tests on kernels before 6.0.
# linux-image-5.10.0-23-cloud-arm64-unsigned_5.10.179-3_arm64.deb \ # linux-image-5.10.0-23-cloud-arm64-unsigned_5.10.179-3_arm64.deb \
printf '%s\0' \ printf '%s\0' \
linux-image-6.1.0-15-cloud-arm64-unsigned_6.1.66-1_arm64.deb \ linux-image-6.1.0-16-cloud-arm64-unsigned_6.1.67-1_arm64.deb \
| xargs -0 -t -P0 -I {} wget -nd -nv -P test/.tmp/debian-kernels/arm64 ftp://ftp.us.debian.org/debian/pool/main/l/linux/{} | xargs -0 -t -P0 -I {} wget -nd -nv -P test/.tmp/debian-kernels/arm64 ftp://ftp.us.debian.org/debian/pool/main/l/linux/{}
- name: Download debian kernels - name: Download debian kernels
@ -268,7 +268,7 @@ jobs:
# linux-image-4.19.0-21-cloud-amd64-unsigned_4.19.249-2_amd64.deb \ # linux-image-4.19.0-21-cloud-amd64-unsigned_4.19.249-2_amd64.deb \
# linux-image-5.10.0-23-cloud-amd64-unsigned_5.10.179-3_amd64.deb \ # linux-image-5.10.0-23-cloud-amd64-unsigned_5.10.179-3_amd64.deb \
printf '%s\0' \ printf '%s\0' \
linux-image-6.1.0-15-cloud-amd64-unsigned_6.1.66-1_amd64.deb \ linux-image-6.1.0-16-cloud-amd64-unsigned_6.1.67-1_amd64.deb \
| xargs -0 -t -P0 -I {} wget -nd -nv -P test/.tmp/debian-kernels/amd64 ftp://ftp.us.debian.org/debian/pool/main/l/linux/{} | xargs -0 -t -P0 -I {} wget -nd -nv -P test/.tmp/debian-kernels/amd64 ftp://ftp.us.debian.org/debian/pool/main/l/linux/{}
- name: Extract debian kernels - name: Extract debian kernels

@ -29,7 +29,7 @@ jobs:
- name: Install headers - name: Install headers
run: | run: |
sudo apt -y update sudo apt -y update
sudo apt -y install libc6-dev libc6-dev-{arm64,armel,riscv64}-cross sudo apt -y install libelf-dev libc6-dev libc6-dev-{arm64,armel,riscv64,ppc64el,s390x}-cross
- name: Run codegen - name: Run codegen
run: | run: |

@ -81,7 +81,7 @@ num_enum = { version = "0.7", default-features = false }
object = { version = "0.36", default-features = false } object = { version = "0.36", default-features = false }
proc-macro-error = { version = "1.0", default-features = false } proc-macro-error = { version = "1.0", default-features = false }
proc-macro2 = { version = "1", default-features = false } proc-macro2 = { version = "1", default-features = false }
public-api = { version = "0.35.0", default-features = false } public-api = { version = "0.36.0", default-features = false }
quote = { version = "1", default-features = false } quote = { version = "1", default-features = false }
rand = { version = "0.8", default-features = false } rand = { version = "0.8", default-features = false }
rbpf = { version = "0.2.0", default-features = false } rbpf = { version = "0.2.0", default-features = false }

@ -2403,24 +2403,23 @@ pub struct tcmsg {
pub tcm_parent: __u32, pub tcm_parent: __u32,
pub tcm_info: __u32, pub tcm_info: __u32,
} }
pub const TCA_UNSPEC: _bindgen_ty_172 = 0; pub const TCA_UNSPEC: _bindgen_ty_170 = 0;
pub const TCA_KIND: _bindgen_ty_172 = 1; pub const TCA_KIND: _bindgen_ty_170 = 1;
pub const TCA_OPTIONS: _bindgen_ty_172 = 2; pub const TCA_OPTIONS: _bindgen_ty_170 = 2;
pub const TCA_STATS: _bindgen_ty_172 = 3; pub const TCA_STATS: _bindgen_ty_170 = 3;
pub const TCA_XSTATS: _bindgen_ty_172 = 4; pub const TCA_XSTATS: _bindgen_ty_170 = 4;
pub const TCA_RATE: _bindgen_ty_172 = 5; pub const TCA_RATE: _bindgen_ty_170 = 5;
pub const TCA_FCNT: _bindgen_ty_172 = 6; pub const TCA_FCNT: _bindgen_ty_170 = 6;
pub const TCA_STATS2: _bindgen_ty_172 = 7; pub const TCA_STATS2: _bindgen_ty_170 = 7;
pub const TCA_STAB: _bindgen_ty_172 = 8; pub const TCA_STAB: _bindgen_ty_170 = 8;
pub const TCA_PAD: _bindgen_ty_172 = 9; pub const TCA_PAD: _bindgen_ty_170 = 9;
pub const TCA_DUMP_INVISIBLE: _bindgen_ty_172 = 10; pub const TCA_DUMP_INVISIBLE: _bindgen_ty_170 = 10;
pub const TCA_CHAIN: _bindgen_ty_172 = 11; pub const TCA_CHAIN: _bindgen_ty_170 = 11;
pub const TCA_HW_OFFLOAD: _bindgen_ty_172 = 12; pub const TCA_HW_OFFLOAD: _bindgen_ty_170 = 12;
pub const TCA_INGRESS_BLOCK: _bindgen_ty_172 = 13; pub const TCA_INGRESS_BLOCK: _bindgen_ty_170 = 13;
pub const TCA_EGRESS_BLOCK: _bindgen_ty_172 = 14; pub const TCA_EGRESS_BLOCK: _bindgen_ty_170 = 14;
pub const TCA_DUMP_FLAGS: _bindgen_ty_172 = 15; pub const __TCA_MAX: _bindgen_ty_170 = 15;
pub const __TCA_MAX: _bindgen_ty_172 = 16; pub type _bindgen_ty_170 = ::core::ffi::c_uint;
pub type _bindgen_ty_172 = ::core::ffi::c_uint;
pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216; pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216;
pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217; pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217;
pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192; pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192;

@ -2403,24 +2403,23 @@ pub struct tcmsg {
pub tcm_parent: __u32, pub tcm_parent: __u32,
pub tcm_info: __u32, pub tcm_info: __u32,
} }
pub const TCA_UNSPEC: _bindgen_ty_172 = 0; pub const TCA_UNSPEC: _bindgen_ty_170 = 0;
pub const TCA_KIND: _bindgen_ty_172 = 1; pub const TCA_KIND: _bindgen_ty_170 = 1;
pub const TCA_OPTIONS: _bindgen_ty_172 = 2; pub const TCA_OPTIONS: _bindgen_ty_170 = 2;
pub const TCA_STATS: _bindgen_ty_172 = 3; pub const TCA_STATS: _bindgen_ty_170 = 3;
pub const TCA_XSTATS: _bindgen_ty_172 = 4; pub const TCA_XSTATS: _bindgen_ty_170 = 4;
pub const TCA_RATE: _bindgen_ty_172 = 5; pub const TCA_RATE: _bindgen_ty_170 = 5;
pub const TCA_FCNT: _bindgen_ty_172 = 6; pub const TCA_FCNT: _bindgen_ty_170 = 6;
pub const TCA_STATS2: _bindgen_ty_172 = 7; pub const TCA_STATS2: _bindgen_ty_170 = 7;
pub const TCA_STAB: _bindgen_ty_172 = 8; pub const TCA_STAB: _bindgen_ty_170 = 8;
pub const TCA_PAD: _bindgen_ty_172 = 9; pub const TCA_PAD: _bindgen_ty_170 = 9;
pub const TCA_DUMP_INVISIBLE: _bindgen_ty_172 = 10; pub const TCA_DUMP_INVISIBLE: _bindgen_ty_170 = 10;
pub const TCA_CHAIN: _bindgen_ty_172 = 11; pub const TCA_CHAIN: _bindgen_ty_170 = 11;
pub const TCA_HW_OFFLOAD: _bindgen_ty_172 = 12; pub const TCA_HW_OFFLOAD: _bindgen_ty_170 = 12;
pub const TCA_INGRESS_BLOCK: _bindgen_ty_172 = 13; pub const TCA_INGRESS_BLOCK: _bindgen_ty_170 = 13;
pub const TCA_EGRESS_BLOCK: _bindgen_ty_172 = 14; pub const TCA_EGRESS_BLOCK: _bindgen_ty_170 = 14;
pub const TCA_DUMP_FLAGS: _bindgen_ty_172 = 15; pub const __TCA_MAX: _bindgen_ty_170 = 15;
pub const __TCA_MAX: _bindgen_ty_172 = 16; pub type _bindgen_ty_170 = ::core::ffi::c_uint;
pub type _bindgen_ty_172 = ::core::ffi::c_uint;
pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216; pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216;
pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217; pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217;
pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192; pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192;

File diff suppressed because it is too large Load Diff

@ -2403,24 +2403,23 @@ pub struct tcmsg {
pub tcm_parent: __u32, pub tcm_parent: __u32,
pub tcm_info: __u32, pub tcm_info: __u32,
} }
pub const TCA_UNSPEC: _bindgen_ty_172 = 0; pub const TCA_UNSPEC: _bindgen_ty_170 = 0;
pub const TCA_KIND: _bindgen_ty_172 = 1; pub const TCA_KIND: _bindgen_ty_170 = 1;
pub const TCA_OPTIONS: _bindgen_ty_172 = 2; pub const TCA_OPTIONS: _bindgen_ty_170 = 2;
pub const TCA_STATS: _bindgen_ty_172 = 3; pub const TCA_STATS: _bindgen_ty_170 = 3;
pub const TCA_XSTATS: _bindgen_ty_172 = 4; pub const TCA_XSTATS: _bindgen_ty_170 = 4;
pub const TCA_RATE: _bindgen_ty_172 = 5; pub const TCA_RATE: _bindgen_ty_170 = 5;
pub const TCA_FCNT: _bindgen_ty_172 = 6; pub const TCA_FCNT: _bindgen_ty_170 = 6;
pub const TCA_STATS2: _bindgen_ty_172 = 7; pub const TCA_STATS2: _bindgen_ty_170 = 7;
pub const TCA_STAB: _bindgen_ty_172 = 8; pub const TCA_STAB: _bindgen_ty_170 = 8;
pub const TCA_PAD: _bindgen_ty_172 = 9; pub const TCA_PAD: _bindgen_ty_170 = 9;
pub const TCA_DUMP_INVISIBLE: _bindgen_ty_172 = 10; pub const TCA_DUMP_INVISIBLE: _bindgen_ty_170 = 10;
pub const TCA_CHAIN: _bindgen_ty_172 = 11; pub const TCA_CHAIN: _bindgen_ty_170 = 11;
pub const TCA_HW_OFFLOAD: _bindgen_ty_172 = 12; pub const TCA_HW_OFFLOAD: _bindgen_ty_170 = 12;
pub const TCA_INGRESS_BLOCK: _bindgen_ty_172 = 13; pub const TCA_INGRESS_BLOCK: _bindgen_ty_170 = 13;
pub const TCA_EGRESS_BLOCK: _bindgen_ty_172 = 14; pub const TCA_EGRESS_BLOCK: _bindgen_ty_170 = 14;
pub const TCA_DUMP_FLAGS: _bindgen_ty_172 = 15; pub const __TCA_MAX: _bindgen_ty_170 = 15;
pub const __TCA_MAX: _bindgen_ty_172 = 16; pub type _bindgen_ty_170 = ::core::ffi::c_uint;
pub type _bindgen_ty_172 = ::core::ffi::c_uint;
pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216; pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216;
pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217; pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217;
pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192; pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192;

File diff suppressed because it is too large Load Diff

@ -2403,24 +2403,23 @@ pub struct tcmsg {
pub tcm_parent: __u32, pub tcm_parent: __u32,
pub tcm_info: __u32, pub tcm_info: __u32,
} }
pub const TCA_UNSPEC: _bindgen_ty_172 = 0; pub const TCA_UNSPEC: _bindgen_ty_170 = 0;
pub const TCA_KIND: _bindgen_ty_172 = 1; pub const TCA_KIND: _bindgen_ty_170 = 1;
pub const TCA_OPTIONS: _bindgen_ty_172 = 2; pub const TCA_OPTIONS: _bindgen_ty_170 = 2;
pub const TCA_STATS: _bindgen_ty_172 = 3; pub const TCA_STATS: _bindgen_ty_170 = 3;
pub const TCA_XSTATS: _bindgen_ty_172 = 4; pub const TCA_XSTATS: _bindgen_ty_170 = 4;
pub const TCA_RATE: _bindgen_ty_172 = 5; pub const TCA_RATE: _bindgen_ty_170 = 5;
pub const TCA_FCNT: _bindgen_ty_172 = 6; pub const TCA_FCNT: _bindgen_ty_170 = 6;
pub const TCA_STATS2: _bindgen_ty_172 = 7; pub const TCA_STATS2: _bindgen_ty_170 = 7;
pub const TCA_STAB: _bindgen_ty_172 = 8; pub const TCA_STAB: _bindgen_ty_170 = 8;
pub const TCA_PAD: _bindgen_ty_172 = 9; pub const TCA_PAD: _bindgen_ty_170 = 9;
pub const TCA_DUMP_INVISIBLE: _bindgen_ty_172 = 10; pub const TCA_DUMP_INVISIBLE: _bindgen_ty_170 = 10;
pub const TCA_CHAIN: _bindgen_ty_172 = 11; pub const TCA_CHAIN: _bindgen_ty_170 = 11;
pub const TCA_HW_OFFLOAD: _bindgen_ty_172 = 12; pub const TCA_HW_OFFLOAD: _bindgen_ty_170 = 12;
pub const TCA_INGRESS_BLOCK: _bindgen_ty_172 = 13; pub const TCA_INGRESS_BLOCK: _bindgen_ty_170 = 13;
pub const TCA_EGRESS_BLOCK: _bindgen_ty_172 = 14; pub const TCA_EGRESS_BLOCK: _bindgen_ty_170 = 14;
pub const TCA_DUMP_FLAGS: _bindgen_ty_172 = 15; pub const __TCA_MAX: _bindgen_ty_170 = 15;
pub const __TCA_MAX: _bindgen_ty_172 = 16; pub type _bindgen_ty_170 = ::core::ffi::c_uint;
pub type _bindgen_ty_172 = ::core::ffi::c_uint;
pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216; pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216;
pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217; pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217;
pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192; pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192;

@ -95,8 +95,8 @@ impl UProbe {
0 0
}; };
let fn_name = path.as_os_str(); let path = path.as_os_str();
attach(&mut self.data, self.kind, fn_name, sym_offset + offset, pid) attach(&mut self.data, self.kind, path, sym_offset + offset, pid)
} }
/// Detaches the program. /// Detaches the program.

@ -88,19 +88,31 @@ impl KernelVersion {
(u32::from(major) << 16) + (u32::from(minor) << 8) + u32::from(patch) (u32::from(major) << 16) + (u32::from(minor) << 8) + u32::from(patch)
} }
// This is ported from https://github.com/torvalds/linux/blob/3f01e9f/tools/lib/bpf/libbpf_probes.c#L21-L101. // These (get_ubuntu_kernel_version, parse_ubuntu_kernel_version, read_ubuntu_kernel_version_file)
// are ported from https://github.com/torvalds/linux/blob/3f01e9f/tools/lib/bpf/libbpf_probes.c#L21-L101.
fn get_ubuntu_kernel_version() -> Result<Option<Self>, CurrentKernelVersionError> { fn get_ubuntu_kernel_version() -> Result<Option<Self>, CurrentKernelVersionError> {
Self::read_ubuntu_kernel_version_file().and_then(|content| {
content
.and_then(|content| Self::parse_ubuntu_kernel_version(&content).transpose())
.transpose()
})
}
fn read_ubuntu_kernel_version_file() -> Result<Option<String>, CurrentKernelVersionError> {
const UBUNTU_KVER_FILE: &str = "/proc/version_signature"; const UBUNTU_KVER_FILE: &str = "/proc/version_signature";
let s = match fs::read_to_string(UBUNTU_KVER_FILE) { match fs::read_to_string(UBUNTU_KVER_FILE) {
Ok(s) => s, Ok(s) => Ok(Some(s)),
Err(e) => { Err(e) => {
if e.kind() == io::ErrorKind::NotFound { if e.kind() != io::ErrorKind::NotFound {
return Ok(None); Err(e.into())
} else {
Ok(None)
} }
return Err(e.into());
} }
}; }
}
fn parse_ubuntu_kernel_version(s: &str) -> Result<Option<Self>, CurrentKernelVersionError> {
let mut parts = s.split_terminator(char::is_whitespace); let mut parts = s.split_terminator(char::is_whitespace);
let mut next = || { let mut next = || {
parts parts
@ -130,7 +142,7 @@ impl KernelVersion {
} }
fn get_kernel_version() -> Result<Self, CurrentKernelVersionError> { fn get_kernel_version() -> Result<Self, CurrentKernelVersionError> {
if let Some(v) = Self::get_ubuntu_kernel_version()? { if let Ok(Some(v)) = Self::get_ubuntu_kernel_version() {
return Ok(v); return Ok(v);
} }
@ -154,10 +166,7 @@ impl KernelVersion {
fn parse_kernel_version_string(s: &str) -> Result<Self, CurrentKernelVersionError> { fn parse_kernel_version_string(s: &str) -> Result<Self, CurrentKernelVersionError> {
fn parse<T: FromStr<Err = ParseIntError>>(s: Option<&str>) -> Option<T> { fn parse<T: FromStr<Err = ParseIntError>>(s: Option<&str>) -> Option<T> {
match s.map(str::parse).transpose() { s.map(str::parse).transpose().unwrap_or_default()
Ok(option) => option,
Err(ParseIntError { .. }) => None,
}
} }
let error = || CurrentKernelVersionError::ParseError(s.to_string()); let error = || CurrentKernelVersionError::ParseError(s.to_string());
let mut parts = s.split(|c: char| c == '.' || !c.is_ascii_digit()); let mut parts = s.split(|c: char| c == '.' || !c.is_ascii_digit());
@ -381,6 +390,12 @@ mod tests {
#[test] #[test]
fn test_parse_kernel_version_string() { fn test_parse_kernel_version_string() {
// cat /proc/version_signature on Proxmox VE 8.1.4.
assert_matches!(KernelVersion::parse_ubuntu_kernel_version(""), Err(CurrentKernelVersionError::ParseError(s)) if s.is_empty());
// cat /proc/version_signature on Ubuntu 22.04.
assert_matches!(KernelVersion::parse_ubuntu_kernel_version( "Ubuntu 5.15.0-82.91-generic 5.15.111"), Ok(Some(kernel_version)) => {
assert_eq!(kernel_version, KernelVersion::new(5, 15, 111))
});
// WSL. // WSL.
assert_matches!(KernelVersion::parse_kernel_version_string("5.15.90.1-microsoft-standard-WSL2"), Ok(kernel_version) => { assert_matches!(KernelVersion::parse_kernel_version_string("5.15.90.1-microsoft-standard-WSL2"), Ok(kernel_version) => {
assert_eq!(kernel_version, KernelVersion::new(5, 15, 90)) assert_eq!(kernel_version, KernelVersion::new(5, 15, 90))

@ -280,10 +280,6 @@ pub const SO_TIMESTAMPING_NEW: u32 = 65;
pub const SO_RCVTIMEO_NEW: u32 = 66; pub const SO_RCVTIMEO_NEW: u32 = 66;
pub const SO_SNDTIMEO_NEW: u32 = 67; pub const SO_SNDTIMEO_NEW: u32 = 67;
pub const SO_DETACH_REUSEPORT_BPF: u32 = 68; pub const SO_DETACH_REUSEPORT_BPF: u32 = 68;
pub const SO_PREFER_BUSY_POLL: u32 = 69;
pub const SO_BUSY_POLL_BUDGET: u32 = 70;
pub const SO_NETNS_COOKIE: u32 = 71;
pub const SO_BUF_LOCK: u32 = 72;
pub const SO_TIMESTAMP: u32 = 29; pub const SO_TIMESTAMP: u32 = 29;
pub const SO_TIMESTAMPNS: u32 = 35; pub const SO_TIMESTAMPNS: u32 = 35;
pub const SO_TIMESTAMPING: u32 = 37; pub const SO_TIMESTAMPING: u32 = 37;

@ -280,10 +280,6 @@ pub const SO_TIMESTAMPING_NEW: u32 = 65;
pub const SO_RCVTIMEO_NEW: u32 = 66; pub const SO_RCVTIMEO_NEW: u32 = 66;
pub const SO_SNDTIMEO_NEW: u32 = 67; pub const SO_SNDTIMEO_NEW: u32 = 67;
pub const SO_DETACH_REUSEPORT_BPF: u32 = 68; pub const SO_DETACH_REUSEPORT_BPF: u32 = 68;
pub const SO_PREFER_BUSY_POLL: u32 = 69;
pub const SO_BUSY_POLL_BUDGET: u32 = 70;
pub const SO_NETNS_COOKIE: u32 = 71;
pub const SO_BUF_LOCK: u32 = 72;
pub type __u8 = ::aya_ebpf_cty::c_uchar; pub type __u8 = ::aya_ebpf_cty::c_uchar;
pub type __s16 = ::aya_ebpf_cty::c_short; pub type __s16 = ::aya_ebpf_cty::c_short;
pub type __u16 = ::aya_ebpf_cty::c_ushort; pub type __u16 = ::aya_ebpf_cty::c_ushort;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -280,10 +280,6 @@ pub const SO_TIMESTAMPING_NEW: u32 = 65;
pub const SO_RCVTIMEO_NEW: u32 = 66; pub const SO_RCVTIMEO_NEW: u32 = 66;
pub const SO_SNDTIMEO_NEW: u32 = 67; pub const SO_SNDTIMEO_NEW: u32 = 67;
pub const SO_DETACH_REUSEPORT_BPF: u32 = 68; pub const SO_DETACH_REUSEPORT_BPF: u32 = 68;
pub const SO_PREFER_BUSY_POLL: u32 = 69;
pub const SO_BUSY_POLL_BUDGET: u32 = 70;
pub const SO_NETNS_COOKIE: u32 = 71;
pub const SO_BUF_LOCK: u32 = 72;
pub const SO_TIMESTAMP: u32 = 29; pub const SO_TIMESTAMP: u32 = 29;
pub const SO_TIMESTAMPNS: u32 = 35; pub const SO_TIMESTAMPNS: u32 = 35;
pub const SO_TIMESTAMPING: u32 = 37; pub const SO_TIMESTAMPING: u32 = 37;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -280,10 +280,6 @@ pub const SO_TIMESTAMPING_NEW: u32 = 65;
pub const SO_RCVTIMEO_NEW: u32 = 66; pub const SO_RCVTIMEO_NEW: u32 = 66;
pub const SO_SNDTIMEO_NEW: u32 = 67; pub const SO_SNDTIMEO_NEW: u32 = 67;
pub const SO_DETACH_REUSEPORT_BPF: u32 = 68; pub const SO_DETACH_REUSEPORT_BPF: u32 = 68;
pub const SO_PREFER_BUSY_POLL: u32 = 69;
pub const SO_BUSY_POLL_BUDGET: u32 = 70;
pub const SO_NETNS_COOKIE: u32 = 71;
pub const SO_BUF_LOCK: u32 = 72;
pub const SO_TIMESTAMP: u32 = 29; pub const SO_TIMESTAMP: u32 = 29;
pub const SO_TIMESTAMPNS: u32 = 35; pub const SO_TIMESTAMPNS: u32 = 35;
pub const SO_TIMESTAMPING: u32 = 37; pub const SO_TIMESTAMPING: u32 = 37;

@ -73,11 +73,35 @@ pub unsafe extern "C" fn memset(s: *mut u8, c: c_int, n: usize) {
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *mut u8, n: usize) { pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *mut u8, n: usize) {
copy_forward(dest, src, n);
}
#[no_mangle]
pub unsafe extern "C" fn memmove(dest: *mut u8, src: *mut u8, n: usize) {
let delta = (dest as usize).wrapping_sub(src as usize);
if delta >= n {
// We can copy forwards because either dest is far enough ahead of src,
// or src is ahead of dest (and delta overflowed).
copy_forward(dest, src, n);
} else {
copy_backward(dest, src, n);
}
}
#[inline(always)]
unsafe fn copy_forward(dest: *mut u8, src: *mut u8, n: usize) {
for i in 0..n { for i in 0..n {
*dest.add(i) = *src.add(i); *dest.add(i) = *src.add(i);
} }
} }
#[inline(always)]
unsafe fn copy_backward(dest: *mut u8, src: *mut u8, n: usize) {
for i in (0..n).rev() {
*dest.add(i) = *src.add(i);
}
}
/// Check if a value is within a range, using conditional forms compatible with /// Check if a value is within a range, using conditional forms compatible with
/// the verifier. /// the verifier.
#[inline(always)] #[inline(always)]

@ -11,6 +11,7 @@ edition.workspace = true
[dependencies] [dependencies]
aya-ebpf = { path = "../../ebpf/aya-ebpf" } aya-ebpf = { path = "../../ebpf/aya-ebpf" }
aya-log-ebpf = { path = "../../ebpf/aya-log-ebpf" } aya-log-ebpf = { path = "../../ebpf/aya-log-ebpf" }
network-types = "0.0.6"
[build-dependencies] [build-dependencies]
which = { workspace = true } which = { workspace = true }
@ -63,3 +64,7 @@ path = "src/ring_buf.rs"
[[bin]] [[bin]]
name = "ignore_map" name = "ignore_map"
path = "src/ignore_map.rs" path = "src/ignore_map.rs"
[[bin]]
name = "memmove_test"
path = "src/memmove_test.rs"

@ -0,0 +1,61 @@
#![no_std]
#![no_main]
use core::mem;
use aya_ebpf::{
bindings::{xdp_action, BPF_F_NO_PREALLOC},
macros::{map, xdp},
maps::HashMap,
programs::XdpContext,
};
use network_types::{
eth::{EthHdr, EtherType},
ip::Ipv6Hdr,
};
#[inline(always)]
fn ptr_at<T>(ctx: &XdpContext, offset: usize) -> Result<*const T, ()> {
let start = ctx.data();
let end = ctx.data_end();
let len = mem::size_of::<T>();
if start + offset + len > end {
return Err(());
}
Ok((start + offset) as *const T)
}
struct Value {
pub orig_ip: [u8; 16],
}
#[map]
static RULES: HashMap<u8, Value> = HashMap::<u8, Value>::with_max_entries(1, BPF_F_NO_PREALLOC);
#[xdp]
pub fn do_dnat(ctx: XdpContext) -> u32 {
try_do_dnat(ctx).unwrap_or(xdp_action::XDP_DROP)
}
fn try_do_dnat(ctx: XdpContext) -> Result<u32, ()> {
let index = 0;
if let Some(nat) = unsafe { RULES.get(&index) } {
let hproto: *const EtherType = ptr_at(&ctx, mem::offset_of!(EthHdr, ether_type))?;
match unsafe { *hproto } {
EtherType::Ipv6 => {
let ip_hdr: *const Ipv6Hdr = ptr_at(&ctx, EthHdr::LEN)?;
unsafe { (*ip_hdr.cast_mut()).dst_addr.in6_u.u6_addr8 = nat.orig_ip };
}
_ => return Ok(xdp_action::XDP_PASS),
}
}
Ok(xdp_action::XDP_PASS)
}
#[cfg(not(test))]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}

@ -23,6 +23,7 @@ pub const REDIRECT: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/re
pub const XDP_SEC: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/xdp_sec")); pub const XDP_SEC: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/xdp_sec"));
pub const RING_BUF: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/ring_buf")); pub const RING_BUF: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/ring_buf"));
pub const IGNORE_MAP: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/ignore_map")); pub const IGNORE_MAP: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/ignore_map"));
pub const MEMMOVE_TEST: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/memmove_test"));
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;

@ -282,6 +282,15 @@ fn unload_kprobe() {
assert_unloaded("test_kprobe"); assert_unloaded("test_kprobe");
} }
#[test]
fn memmove() {
let mut bpf = Ebpf::load(crate::MEMMOVE_TEST).unwrap();
let prog: &mut Xdp = bpf.program_mut("do_dnat").unwrap().try_into().unwrap();
prog.load().unwrap();
assert_loaded("do_dnat");
}
#[test] #[test]
fn basic_tracepoint() { fn basic_tracepoint() {
let mut bpf = Ebpf::load(crate::TEST).unwrap(); let mut bpf = Ebpf::load(crate::TEST).unwrap();

File diff suppressed because it is too large Load Diff

@ -57,6 +57,10 @@ impl<T> core::borrow::Borrow<T> for aya_ebpf::helpers::PrintkArg where T: core::
pub fn aya_ebpf::helpers::PrintkArg::borrow(&self) -> &T pub fn aya_ebpf::helpers::PrintkArg::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya_ebpf::helpers::PrintkArg where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya_ebpf::helpers::PrintkArg where T: core::marker::Sized
pub fn aya_ebpf::helpers::PrintkArg::borrow_mut(&mut self) -> &mut T pub fn aya_ebpf::helpers::PrintkArg::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya_ebpf::helpers::PrintkArg where T: core::clone::Clone
pub unsafe fn aya_ebpf::helpers::PrintkArg::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya_ebpf::helpers::PrintkArg where T: core::marker::Copy
pub unsafe fn aya_ebpf::helpers::PrintkArg::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya_ebpf::helpers::PrintkArg impl<T> core::convert::From<T> for aya_ebpf::helpers::PrintkArg
pub fn aya_ebpf::helpers::PrintkArg::from(t: T) -> T pub fn aya_ebpf::helpers::PrintkArg::from(t: T) -> T
pub fn aya_ebpf::helpers::bpf_get_current_comm() -> core::result::Result<[u8; 16], aya_ebpf_cty::od::c_long> pub fn aya_ebpf::helpers::bpf_get_current_comm() -> core::result::Result<[u8; 16], aya_ebpf_cty::od::c_long>
@ -2682,7 +2686,7 @@ impl<T> core::borrow::BorrowMut<T> for aya_ebpf::PtRegs where T: core::marker::S
pub fn aya_ebpf::PtRegs::borrow_mut(&mut self) -> &mut T pub fn aya_ebpf::PtRegs::borrow_mut(&mut self) -> &mut T
impl<T> core::convert::From<T> for aya_ebpf::PtRegs impl<T> core::convert::From<T> for aya_ebpf::PtRegs
pub fn aya_ebpf::PtRegs::from(t: T) -> T pub fn aya_ebpf::PtRegs::from(t: T) -> T
pub const aya_ebpf::TASK_COMM_LEN: usize = 16usize pub const aya_ebpf::TASK_COMM_LEN: usize
pub trait aya_ebpf::EbpfContext pub trait aya_ebpf::EbpfContext
pub fn aya_ebpf::EbpfContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::EbpfContext::as_ptr(&self) -> *mut core::ffi::c_void
pub fn aya_ebpf::EbpfContext::command(&self) -> core::result::Result<[u8; 16], aya_ebpf_cty::od::c_long> pub fn aya_ebpf::EbpfContext::command(&self) -> core::result::Result<[u8; 16], aya_ebpf_cty::od::c_long>
@ -2732,4 +2736,5 @@ impl aya_ebpf::EbpfContext for aya_ebpf::programs::xdp::XdpContext
pub fn aya_ebpf::programs::xdp::XdpContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::xdp::XdpContext::as_ptr(&self) -> *mut core::ffi::c_void
pub fn aya_ebpf::check_bounds_signed(value: i64, lower: i64, upper: i64) -> bool pub fn aya_ebpf::check_bounds_signed(value: i64, lower: i64, upper: i64) -> bool
#[no_mangle] pub unsafe c fn aya_ebpf::memcpy(dest: *mut u8, src: *mut u8, n: usize) #[no_mangle] pub unsafe c fn aya_ebpf::memcpy(dest: *mut u8, src: *mut u8, n: usize)
#[no_mangle] pub unsafe c fn aya_ebpf::memmove(dest: *mut u8, src: *mut u8, n: usize)
#[no_mangle] pub unsafe c fn aya_ebpf::memset(s: *mut u8, c: aya_ebpf_cty::ad::c_int, n: usize) #[no_mangle] pub unsafe c fn aya_ebpf::memset(s: *mut u8, c: aya_ebpf_cty::ad::c_int, n: usize)

@ -45,6 +45,10 @@ impl<T> core::borrow::Borrow<T> for aya_log_common::Argument where T: core::mark
pub fn aya_log_common::Argument::borrow(&self) -> &T pub fn aya_log_common::Argument::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya_log_common::Argument where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya_log_common::Argument where T: core::marker::Sized
pub fn aya_log_common::Argument::borrow_mut(&mut self) -> &mut T pub fn aya_log_common::Argument::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya_log_common::Argument where T: core::clone::Clone
pub unsafe fn aya_log_common::Argument::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya_log_common::Argument where T: core::marker::Copy
pub unsafe fn aya_log_common::Argument::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya_log_common::Argument impl<T> core::convert::From<T> for aya_log_common::Argument
pub fn aya_log_common::Argument::from(t: T) -> T pub fn aya_log_common::Argument::from(t: T) -> T
#[repr(u8)] pub enum aya_log_common::DisplayHint #[repr(u8)] pub enum aya_log_common::DisplayHint
@ -87,6 +91,10 @@ impl<T> core::borrow::Borrow<T> for aya_log_common::DisplayHint where T: core::m
pub fn aya_log_common::DisplayHint::borrow(&self) -> &T pub fn aya_log_common::DisplayHint::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya_log_common::DisplayHint where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya_log_common::DisplayHint where T: core::marker::Sized
pub fn aya_log_common::DisplayHint::borrow_mut(&mut self) -> &mut T pub fn aya_log_common::DisplayHint::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya_log_common::DisplayHint where T: core::clone::Clone
pub unsafe fn aya_log_common::DisplayHint::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya_log_common::DisplayHint where T: core::marker::Copy
pub unsafe fn aya_log_common::DisplayHint::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya_log_common::DisplayHint impl<T> core::convert::From<T> for aya_log_common::DisplayHint
pub fn aya_log_common::DisplayHint::from(t: T) -> T pub fn aya_log_common::DisplayHint::from(t: T) -> T
#[repr(u8)] pub enum aya_log_common::Level #[repr(u8)] pub enum aya_log_common::Level
@ -128,6 +136,10 @@ impl<T> core::borrow::Borrow<T> for aya_log_common::Level where T: core::marker:
pub fn aya_log_common::Level::borrow(&self) -> &T pub fn aya_log_common::Level::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya_log_common::Level where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya_log_common::Level where T: core::marker::Sized
pub fn aya_log_common::Level::borrow_mut(&mut self) -> &mut T pub fn aya_log_common::Level::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya_log_common::Level where T: core::clone::Clone
pub unsafe fn aya_log_common::Level::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya_log_common::Level where T: core::marker::Copy
pub unsafe fn aya_log_common::Level::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya_log_common::Level impl<T> core::convert::From<T> for aya_log_common::Level
pub fn aya_log_common::Level::from(t: T) -> T pub fn aya_log_common::Level::from(t: T) -> T
#[repr(u8)] pub enum aya_log_common::RecordField #[repr(u8)] pub enum aya_log_common::RecordField
@ -164,10 +176,14 @@ impl<T> core::borrow::Borrow<T> for aya_log_common::RecordField where T: core::m
pub fn aya_log_common::RecordField::borrow(&self) -> &T pub fn aya_log_common::RecordField::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya_log_common::RecordField where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya_log_common::RecordField where T: core::marker::Sized
pub fn aya_log_common::RecordField::borrow_mut(&mut self) -> &mut T pub fn aya_log_common::RecordField::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya_log_common::RecordField where T: core::clone::Clone
pub unsafe fn aya_log_common::RecordField::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya_log_common::RecordField where T: core::marker::Copy
pub unsafe fn aya_log_common::RecordField::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya_log_common::RecordField impl<T> core::convert::From<T> for aya_log_common::RecordField
pub fn aya_log_common::RecordField::from(t: T) -> T pub fn aya_log_common::RecordField::from(t: T) -> T
pub const aya_log_common::LOG_BUF_CAPACITY: usize = 8_192usize pub const aya_log_common::LOG_BUF_CAPACITY: usize
pub const aya_log_common::LOG_FIELDS: usize = 6usize pub const aya_log_common::LOG_FIELDS: usize
pub trait aya_log_common::DefaultFormatter pub trait aya_log_common::DefaultFormatter
impl aya_log_common::DefaultFormatter for &str impl aya_log_common::DefaultFormatter for &str
impl aya_log_common::DefaultFormatter for bool impl aya_log_common::DefaultFormatter for bool

@ -34,6 +34,8 @@ impl<T> core::borrow::Borrow<T> for aya_log_parser::Fragment where T: core::mark
pub fn aya_log_parser::Fragment::borrow(&self) -> &T pub fn aya_log_parser::Fragment::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya_log_parser::Fragment where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya_log_parser::Fragment where T: core::marker::Sized
pub fn aya_log_parser::Fragment::borrow_mut(&mut self) -> &mut T pub fn aya_log_parser::Fragment::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya_log_parser::Fragment where T: core::clone::Clone
pub unsafe fn aya_log_parser::Fragment::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya_log_parser::Fragment impl<T> core::convert::From<T> for aya_log_parser::Fragment
pub fn aya_log_parser::Fragment::from(t: T) -> T pub fn aya_log_parser::Fragment::from(t: T) -> T
pub struct aya_log_parser::Parameter pub struct aya_log_parser::Parameter
@ -70,6 +72,8 @@ impl<T> core::borrow::Borrow<T> for aya_log_parser::Parameter where T: core::mar
pub fn aya_log_parser::Parameter::borrow(&self) -> &T pub fn aya_log_parser::Parameter::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya_log_parser::Parameter where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya_log_parser::Parameter where T: core::marker::Sized
pub fn aya_log_parser::Parameter::borrow_mut(&mut self) -> &mut T pub fn aya_log_parser::Parameter::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya_log_parser::Parameter where T: core::clone::Clone
pub unsafe fn aya_log_parser::Parameter::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya_log_parser::Parameter impl<T> core::convert::From<T> for aya_log_parser::Parameter
pub fn aya_log_parser::Parameter::from(t: T) -> T pub fn aya_log_parser::Parameter::from(t: T) -> T
pub fn aya_log_parser::parse(format_string: &str) -> core::result::Result<alloc::vec::Vec<aya_log_parser::Fragment>, alloc::string::String> pub fn aya_log_parser::parse(format_string: &str) -> core::result::Result<alloc::vec::Vec<aya_log_parser::Fragment>, alloc::string::String>

File diff suppressed because it is too large Load Diff

@ -300,6 +300,10 @@ impl<T> core::borrow::Borrow<T> for aya::maps::lpm_trie::Key<K> where T: core::m
pub fn aya::maps::lpm_trie::Key<K>::borrow(&self) -> &T pub fn aya::maps::lpm_trie::Key<K>::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::maps::lpm_trie::Key<K> where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::maps::lpm_trie::Key<K> where T: core::marker::Sized
pub fn aya::maps::lpm_trie::Key<K>::borrow_mut(&mut self) -> &mut T pub fn aya::maps::lpm_trie::Key<K>::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::maps::lpm_trie::Key<K> where T: core::clone::Clone
pub unsafe fn aya::maps::lpm_trie::Key<K>::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::maps::lpm_trie::Key<K> where T: core::marker::Copy
pub unsafe fn aya::maps::lpm_trie::Key<K>::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::maps::lpm_trie::Key<K> impl<T> core::convert::From<T> for aya::maps::lpm_trie::Key<K>
pub fn aya::maps::lpm_trie::Key<K>::from(t: T) -> T pub fn aya::maps::lpm_trie::Key<K>::from(t: T) -> T
pub struct aya::maps::lpm_trie::LpmTrie<T, K, V> pub struct aya::maps::lpm_trie::LpmTrie<T, K, V>
@ -2588,6 +2592,10 @@ impl<T> core::borrow::Borrow<T> for aya::programs::cgroup_skb::CgroupSkbAttachTy
pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::borrow(&self) -> &T pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::cgroup_skb::CgroupSkbAttachType where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::cgroup_skb::CgroupSkbAttachType where T: core::marker::Sized
pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::borrow_mut(&mut self) -> &mut T pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::cgroup_skb::CgroupSkbAttachType where T: core::clone::Clone
pub unsafe fn aya::programs::cgroup_skb::CgroupSkbAttachType::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::programs::cgroup_skb::CgroupSkbAttachType where T: core::marker::Copy
pub unsafe fn aya::programs::cgroup_skb::CgroupSkbAttachType::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::cgroup_skb::CgroupSkbAttachType impl<T> core::convert::From<T> for aya::programs::cgroup_skb::CgroupSkbAttachType
pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::from(t: T) -> T pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::from(t: T) -> T
pub struct aya::programs::cgroup_skb::CgroupSkb pub struct aya::programs::cgroup_skb::CgroupSkb
@ -4446,6 +4454,8 @@ impl<T> core::borrow::Borrow<T> for aya::programs::perf_event::PerfEventScope wh
pub fn aya::programs::perf_event::PerfEventScope::borrow(&self) -> &T pub fn aya::programs::perf_event::PerfEventScope::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::PerfEventScope where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::PerfEventScope where T: core::marker::Sized
pub fn aya::programs::perf_event::PerfEventScope::borrow_mut(&mut self) -> &mut T pub fn aya::programs::perf_event::PerfEventScope::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::perf_event::PerfEventScope where T: core::clone::Clone
pub unsafe fn aya::programs::perf_event::PerfEventScope::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::perf_event::PerfEventScope impl<T> core::convert::From<T> for aya::programs::perf_event::PerfEventScope
pub fn aya::programs::perf_event::PerfEventScope::from(t: T) -> T pub fn aya::programs::perf_event::PerfEventScope::from(t: T) -> T
#[repr(u32)] pub enum aya::programs::perf_event::PerfTypeId #[repr(u32)] pub enum aya::programs::perf_event::PerfTypeId
@ -4483,6 +4493,8 @@ impl<T> core::borrow::Borrow<T> for aya::programs::perf_event::PerfTypeId where
pub fn aya::programs::perf_event::PerfTypeId::borrow(&self) -> &T pub fn aya::programs::perf_event::PerfTypeId::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::PerfTypeId where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::PerfTypeId where T: core::marker::Sized
pub fn aya::programs::perf_event::PerfTypeId::borrow_mut(&mut self) -> &mut T pub fn aya::programs::perf_event::PerfTypeId::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::perf_event::PerfTypeId where T: core::clone::Clone
pub unsafe fn aya::programs::perf_event::PerfTypeId::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::perf_event::PerfTypeId impl<T> core::convert::From<T> for aya::programs::perf_event::PerfTypeId
pub fn aya::programs::perf_event::PerfTypeId::from(t: T) -> T pub fn aya::programs::perf_event::PerfTypeId::from(t: T) -> T
pub enum aya::programs::perf_event::SamplePolicy pub enum aya::programs::perf_event::SamplePolicy
@ -4516,6 +4528,8 @@ impl<T> core::borrow::Borrow<T> for aya::programs::perf_event::SamplePolicy wher
pub fn aya::programs::perf_event::SamplePolicy::borrow(&self) -> &T pub fn aya::programs::perf_event::SamplePolicy::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::SamplePolicy where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::SamplePolicy where T: core::marker::Sized
pub fn aya::programs::perf_event::SamplePolicy::borrow_mut(&mut self) -> &mut T pub fn aya::programs::perf_event::SamplePolicy::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::perf_event::SamplePolicy where T: core::clone::Clone
pub unsafe fn aya::programs::perf_event::SamplePolicy::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::perf_event::SamplePolicy impl<T> core::convert::From<T> for aya::programs::perf_event::SamplePolicy
pub fn aya::programs::perf_event::SamplePolicy::from(t: T) -> T pub fn aya::programs::perf_event::SamplePolicy::from(t: T) -> T
pub struct aya::programs::perf_event::PerfEvent pub struct aya::programs::perf_event::PerfEvent
@ -5032,6 +5046,10 @@ impl<T> core::borrow::Borrow<T> for aya::programs::sk_skb::SkSkbKind where T: co
pub fn aya::programs::sk_skb::SkSkbKind::borrow(&self) -> &T pub fn aya::programs::sk_skb::SkSkbKind::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::sk_skb::SkSkbKind where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::sk_skb::SkSkbKind where T: core::marker::Sized
pub fn aya::programs::sk_skb::SkSkbKind::borrow_mut(&mut self) -> &mut T pub fn aya::programs::sk_skb::SkSkbKind::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::sk_skb::SkSkbKind where T: core::clone::Clone
pub unsafe fn aya::programs::sk_skb::SkSkbKind::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::programs::sk_skb::SkSkbKind where T: core::marker::Copy
pub unsafe fn aya::programs::sk_skb::SkSkbKind::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::sk_skb::SkSkbKind impl<T> core::convert::From<T> for aya::programs::sk_skb::SkSkbKind
pub fn aya::programs::sk_skb::SkSkbKind::from(t: T) -> T pub fn aya::programs::sk_skb::SkSkbKind::from(t: T) -> T
pub struct aya::programs::sk_skb::SkSkb pub struct aya::programs::sk_skb::SkSkb
@ -5465,6 +5483,10 @@ impl<T> core::borrow::Borrow<T> for aya::programs::tc::TcAttachType where T: cor
pub fn aya::programs::tc::TcAttachType::borrow(&self) -> &T pub fn aya::programs::tc::TcAttachType::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::tc::TcAttachType where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::tc::TcAttachType where T: core::marker::Sized
pub fn aya::programs::tc::TcAttachType::borrow_mut(&mut self) -> &mut T pub fn aya::programs::tc::TcAttachType::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::tc::TcAttachType where T: core::clone::Clone
pub unsafe fn aya::programs::tc::TcAttachType::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::programs::tc::TcAttachType where T: core::marker::Copy
pub unsafe fn aya::programs::tc::TcAttachType::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::tc::TcAttachType impl<T> core::convert::From<T> for aya::programs::tc::TcAttachType
pub fn aya::programs::tc::TcAttachType::from(t: T) -> T pub fn aya::programs::tc::TcAttachType::from(t: T) -> T
pub enum aya::programs::tc::TcError pub enum aya::programs::tc::TcError
@ -6291,6 +6313,10 @@ impl<T> core::borrow::Borrow<T> for aya::programs::xdp::XdpFlags where T: core::
pub fn aya::programs::xdp::XdpFlags::borrow(&self) -> &T pub fn aya::programs::xdp::XdpFlags::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::xdp::XdpFlags where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::xdp::XdpFlags where T: core::marker::Sized
pub fn aya::programs::xdp::XdpFlags::borrow_mut(&mut self) -> &mut T pub fn aya::programs::xdp::XdpFlags::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::xdp::XdpFlags where T: core::clone::Clone
pub unsafe fn aya::programs::xdp::XdpFlags::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::programs::xdp::XdpFlags where T: core::marker::Copy
pub unsafe fn aya::programs::xdp::XdpFlags::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::xdp::XdpFlags impl<T> core::convert::From<T> for aya::programs::xdp::XdpFlags
pub fn aya::programs::xdp::XdpFlags::from(t: T) -> T pub fn aya::programs::xdp::XdpFlags::from(t: T) -> T
pub struct aya::programs::xdp::XdpLink(_) pub struct aya::programs::xdp::XdpLink(_)
@ -6397,6 +6423,10 @@ impl<T> core::borrow::Borrow<T> for aya::programs::cgroup_skb::CgroupSkbAttachTy
pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::borrow(&self) -> &T pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::cgroup_skb::CgroupSkbAttachType where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::cgroup_skb::CgroupSkbAttachType where T: core::marker::Sized
pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::borrow_mut(&mut self) -> &mut T pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::cgroup_skb::CgroupSkbAttachType where T: core::clone::Clone
pub unsafe fn aya::programs::cgroup_skb::CgroupSkbAttachType::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::programs::cgroup_skb::CgroupSkbAttachType where T: core::marker::Copy
pub unsafe fn aya::programs::cgroup_skb::CgroupSkbAttachType::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::cgroup_skb::CgroupSkbAttachType impl<T> core::convert::From<T> for aya::programs::cgroup_skb::CgroupSkbAttachType
pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::from(t: T) -> T pub fn aya::programs::cgroup_skb::CgroupSkbAttachType::from(t: T) -> T
pub enum aya::programs::ExtensionError pub enum aya::programs::ExtensionError
@ -6507,6 +6537,8 @@ impl<T> core::borrow::Borrow<T> for aya::programs::perf_event::PerfEventScope wh
pub fn aya::programs::perf_event::PerfEventScope::borrow(&self) -> &T pub fn aya::programs::perf_event::PerfEventScope::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::PerfEventScope where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::PerfEventScope where T: core::marker::Sized
pub fn aya::programs::perf_event::PerfEventScope::borrow_mut(&mut self) -> &mut T pub fn aya::programs::perf_event::PerfEventScope::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::perf_event::PerfEventScope where T: core::clone::Clone
pub unsafe fn aya::programs::perf_event::PerfEventScope::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::perf_event::PerfEventScope impl<T> core::convert::From<T> for aya::programs::perf_event::PerfEventScope
pub fn aya::programs::perf_event::PerfEventScope::from(t: T) -> T pub fn aya::programs::perf_event::PerfEventScope::from(t: T) -> T
#[repr(u32)] pub enum aya::programs::PerfTypeId #[repr(u32)] pub enum aya::programs::PerfTypeId
@ -6544,6 +6576,8 @@ impl<T> core::borrow::Borrow<T> for aya::programs::perf_event::PerfTypeId where
pub fn aya::programs::perf_event::PerfTypeId::borrow(&self) -> &T pub fn aya::programs::perf_event::PerfTypeId::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::PerfTypeId where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::PerfTypeId where T: core::marker::Sized
pub fn aya::programs::perf_event::PerfTypeId::borrow_mut(&mut self) -> &mut T pub fn aya::programs::perf_event::PerfTypeId::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::perf_event::PerfTypeId where T: core::clone::Clone
pub unsafe fn aya::programs::perf_event::PerfTypeId::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::perf_event::PerfTypeId impl<T> core::convert::From<T> for aya::programs::perf_event::PerfTypeId
pub fn aya::programs::perf_event::PerfTypeId::from(t: T) -> T pub fn aya::programs::perf_event::PerfTypeId::from(t: T) -> T
pub enum aya::programs::ProbeKind pub enum aya::programs::ProbeKind
@ -6580,6 +6614,10 @@ impl<T> core::borrow::Borrow<T> for aya::programs::ProbeKind where T: core::mark
pub fn aya::programs::ProbeKind::borrow(&self) -> &T pub fn aya::programs::ProbeKind::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::ProbeKind where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::ProbeKind where T: core::marker::Sized
pub fn aya::programs::ProbeKind::borrow_mut(&mut self) -> &mut T pub fn aya::programs::ProbeKind::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::ProbeKind where T: core::clone::Clone
pub unsafe fn aya::programs::ProbeKind::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::programs::ProbeKind where T: core::marker::Copy
pub unsafe fn aya::programs::ProbeKind::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::ProbeKind impl<T> core::convert::From<T> for aya::programs::ProbeKind
pub fn aya::programs::ProbeKind::from(t: T) -> T pub fn aya::programs::ProbeKind::from(t: T) -> T
pub enum aya::programs::Program pub enum aya::programs::Program
@ -6888,6 +6926,8 @@ impl<T> core::borrow::Borrow<T> for aya::programs::perf_event::SamplePolicy wher
pub fn aya::programs::perf_event::SamplePolicy::borrow(&self) -> &T pub fn aya::programs::perf_event::SamplePolicy::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::SamplePolicy where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::perf_event::SamplePolicy where T: core::marker::Sized
pub fn aya::programs::perf_event::SamplePolicy::borrow_mut(&mut self) -> &mut T pub fn aya::programs::perf_event::SamplePolicy::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::perf_event::SamplePolicy where T: core::clone::Clone
pub unsafe fn aya::programs::perf_event::SamplePolicy::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::perf_event::SamplePolicy impl<T> core::convert::From<T> for aya::programs::perf_event::SamplePolicy
pub fn aya::programs::perf_event::SamplePolicy::from(t: T) -> T pub fn aya::programs::perf_event::SamplePolicy::from(t: T) -> T
pub enum aya::programs::SkSkbKind pub enum aya::programs::SkSkbKind
@ -6922,6 +6962,10 @@ impl<T> core::borrow::Borrow<T> for aya::programs::sk_skb::SkSkbKind where T: co
pub fn aya::programs::sk_skb::SkSkbKind::borrow(&self) -> &T pub fn aya::programs::sk_skb::SkSkbKind::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::sk_skb::SkSkbKind where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::sk_skb::SkSkbKind where T: core::marker::Sized
pub fn aya::programs::sk_skb::SkSkbKind::borrow_mut(&mut self) -> &mut T pub fn aya::programs::sk_skb::SkSkbKind::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::sk_skb::SkSkbKind where T: core::clone::Clone
pub unsafe fn aya::programs::sk_skb::SkSkbKind::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::programs::sk_skb::SkSkbKind where T: core::marker::Copy
pub unsafe fn aya::programs::sk_skb::SkSkbKind::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::sk_skb::SkSkbKind impl<T> core::convert::From<T> for aya::programs::sk_skb::SkSkbKind
pub fn aya::programs::sk_skb::SkSkbKind::from(t: T) -> T pub fn aya::programs::sk_skb::SkSkbKind::from(t: T) -> T
pub enum aya::programs::SocketFilterError pub enum aya::programs::SocketFilterError
@ -7002,6 +7046,10 @@ impl<T> core::borrow::Borrow<T> for aya::programs::tc::TcAttachType where T: cor
pub fn aya::programs::tc::TcAttachType::borrow(&self) -> &T pub fn aya::programs::tc::TcAttachType::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::tc::TcAttachType where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::tc::TcAttachType where T: core::marker::Sized
pub fn aya::programs::tc::TcAttachType::borrow_mut(&mut self) -> &mut T pub fn aya::programs::tc::TcAttachType::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::tc::TcAttachType where T: core::clone::Clone
pub unsafe fn aya::programs::tc::TcAttachType::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::programs::tc::TcAttachType where T: core::marker::Copy
pub unsafe fn aya::programs::tc::TcAttachType::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::tc::TcAttachType impl<T> core::convert::From<T> for aya::programs::tc::TcAttachType
pub fn aya::programs::tc::TcAttachType::from(t: T) -> T pub fn aya::programs::tc::TcAttachType::from(t: T) -> T
pub enum aya::programs::TcError pub enum aya::programs::TcError
@ -8510,6 +8558,10 @@ impl<T> core::borrow::Borrow<T> for aya::programs::xdp::XdpFlags where T: core::
pub fn aya::programs::xdp::XdpFlags::borrow(&self) -> &T pub fn aya::programs::xdp::XdpFlags::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::programs::xdp::XdpFlags where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::programs::xdp::XdpFlags where T: core::marker::Sized
pub fn aya::programs::xdp::XdpFlags::borrow_mut(&mut self) -> &mut T pub fn aya::programs::xdp::XdpFlags::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::programs::xdp::XdpFlags where T: core::clone::Clone
pub unsafe fn aya::programs::xdp::XdpFlags::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::programs::xdp::XdpFlags where T: core::marker::Copy
pub unsafe fn aya::programs::xdp::XdpFlags::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::programs::xdp::XdpFlags impl<T> core::convert::From<T> for aya::programs::xdp::XdpFlags
pub fn aya::programs::xdp::XdpFlags::from(t: T) -> T pub fn aya::programs::xdp::XdpFlags::from(t: T) -> T
pub trait aya::programs::Link: core::fmt::Debug + 'static pub trait aya::programs::Link: core::fmt::Debug + 'static
@ -8670,6 +8722,10 @@ impl<T> core::borrow::Borrow<T> for aya::util::KernelVersion where T: core::mark
pub fn aya::util::KernelVersion::borrow(&self) -> &T pub fn aya::util::KernelVersion::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::util::KernelVersion where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::util::KernelVersion where T: core::marker::Sized
pub fn aya::util::KernelVersion::borrow_mut(&mut self) -> &mut T pub fn aya::util::KernelVersion::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::util::KernelVersion where T: core::clone::Clone
pub unsafe fn aya::util::KernelVersion::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::util::KernelVersion where T: core::marker::Copy
pub unsafe fn aya::util::KernelVersion::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::util::KernelVersion impl<T> core::convert::From<T> for aya::util::KernelVersion
pub fn aya::util::KernelVersion::from(t: T) -> T pub fn aya::util::KernelVersion::from(t: T) -> T
pub fn aya::util::kernel_symbols() -> core::result::Result<alloc::collections::btree::map::BTreeMap<u64, alloc::string::String>, std::io::error::Error> pub fn aya::util::kernel_symbols() -> core::result::Result<alloc::collections::btree::map::BTreeMap<u64, alloc::string::String>, std::io::error::Error>
@ -8942,6 +8998,10 @@ impl<T> core::borrow::Borrow<T> for aya::VerifierLogLevel where T: core::marker:
pub fn aya::VerifierLogLevel::borrow(&self) -> &T pub fn aya::VerifierLogLevel::borrow(&self) -> &T
impl<T> core::borrow::BorrowMut<T> for aya::VerifierLogLevel where T: core::marker::Sized impl<T> core::borrow::BorrowMut<T> for aya::VerifierLogLevel where T: core::marker::Sized
pub fn aya::VerifierLogLevel::borrow_mut(&mut self) -> &mut T pub fn aya::VerifierLogLevel::borrow_mut(&mut self) -> &mut T
impl<T> core::clone::CloneToUninit for aya::VerifierLogLevel where T: core::clone::Clone
pub unsafe fn aya::VerifierLogLevel::clone_to_uninit(&self, dst: *mut T)
impl<T> core::clone::CloneToUninit for aya::VerifierLogLevel where T: core::marker::Copy
pub unsafe fn aya::VerifierLogLevel::clone_to_uninit(&self, dst: *mut T)
impl<T> core::convert::From<T> for aya::VerifierLogLevel impl<T> core::convert::From<T> for aya::VerifierLogLevel
pub fn aya::VerifierLogLevel::from(t: T) -> T pub fn aya::VerifierLogLevel::from(t: T) -> T
pub unsafe trait aya::Pod: core::marker::Copy + 'static pub unsafe trait aya::Pod: core::marker::Copy + 'static

@ -57,6 +57,8 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyh
aarch64_sysroot, aarch64_sysroot,
armv7_sysroot, armv7_sysroot,
riscv64_sysroot, riscv64_sysroot,
powerpc64_sysroot,
s390x_sysroot,
} = opts; } = opts;
let types = [ let types = [
// BPF // BPF
@ -179,6 +181,8 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyh
Architecture::ARMv7 => "armv7-unknown-linux-gnu", Architecture::ARMv7 => "armv7-unknown-linux-gnu",
Architecture::AArch64 => "aarch64-unknown-linux-gnu", Architecture::AArch64 => "aarch64-unknown-linux-gnu",
Architecture::RISCV64 => "riscv64-unknown-linux-gnu", Architecture::RISCV64 => "riscv64-unknown-linux-gnu",
Architecture::PowerPC64 => "powerpc64le-unknown-linux-gnu",
Architecture::S390X => "s390x-unknown-linux-gnu",
}; };
bindgen = bindgen.clang_args(&["-target", target]); bindgen = bindgen.clang_args(&["-target", target]);
@ -189,6 +193,8 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyh
Architecture::ARMv7 => armv7_sysroot, Architecture::ARMv7 => armv7_sysroot,
Architecture::AArch64 => aarch64_sysroot, Architecture::AArch64 => aarch64_sysroot,
Architecture::RISCV64 => riscv64_sysroot, Architecture::RISCV64 => riscv64_sysroot,
Architecture::PowerPC64 => powerpc64_sysroot,
Architecture::S390X => s390x_sysroot,
}; };
bindgen = bindgen.clang_args(&["-I", &*sysroot.to_string_lossy()]); bindgen = bindgen.clang_args(&["-I", &*sysroot.to_string_lossy()]);

@ -1,4 +1,7 @@
use std::path::{Path, PathBuf}; use std::{
fs::create_dir_all,
path::{Path, PathBuf},
};
use anyhow::anyhow; use anyhow::anyhow;
use aya_tool::{bindgen, write_to_file_fmt}; use aya_tool::{bindgen, write_to_file_fmt};
@ -17,6 +20,8 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyhow::E
aarch64_sysroot, aarch64_sysroot,
armv7_sysroot, armv7_sysroot,
riscv64_sysroot, riscv64_sysroot,
powerpc64_sysroot,
s390x_sysroot,
} = opts; } = opts;
let dir = PathBuf::from("ebpf/aya-ebpf-bindings"); let dir = PathBuf::from("ebpf/aya-ebpf-bindings");
@ -80,6 +85,8 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyhow::E
Architecture::ARMv7 => "armv7-unknown-linux-gnu", Architecture::ARMv7 => "armv7-unknown-linux-gnu",
Architecture::AArch64 => "aarch64-unknown-linux-gnu", Architecture::AArch64 => "aarch64-unknown-linux-gnu",
Architecture::RISCV64 => "riscv64-unknown-linux-gnu", Architecture::RISCV64 => "riscv64-unknown-linux-gnu",
Architecture::PowerPC64 => "powerpc64le-unknown-linux-gnu",
Architecture::S390X => "s390x-unknown-linux-gnu",
}; };
bindgen = bindgen.clang_args(&["-target", target]); bindgen = bindgen.clang_args(&["-target", target]);
@ -90,6 +97,8 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyhow::E
Architecture::ARMv7 => armv7_sysroot, Architecture::ARMv7 => armv7_sysroot,
Architecture::AArch64 => aarch64_sysroot, Architecture::AArch64 => aarch64_sysroot,
Architecture::RISCV64 => riscv64_sysroot, Architecture::RISCV64 => riscv64_sysroot,
Architecture::PowerPC64 => powerpc64_sysroot,
Architecture::S390X => s390x_sysroot,
}; };
bindgen = bindgen.clang_args(&["-I", &*sysroot.to_string_lossy()]); bindgen = bindgen.clang_args(&["-I", &*sysroot.to_string_lossy()]);
@ -106,6 +115,10 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyhow::E
} }
let generated = dir.join("src").join(arch.to_string()); let generated = dir.join("src").join(arch.to_string());
if !generated.exists() {
create_dir_all(&generated)?;
}
// write the bindings, with the original helpers removed // write the bindings, with the original helpers removed
write_to_file_fmt( write_to_file_fmt(
generated.join("bindings.rs"), generated.join("bindings.rs"),

@ -11,6 +11,8 @@ const SUPPORTED_ARCHS: &[Architecture] = &[
Architecture::ARMv7, Architecture::ARMv7,
Architecture::AArch64, Architecture::AArch64,
Architecture::RISCV64, Architecture::RISCV64,
Architecture::PowerPC64,
Architecture::S390X,
]; ];
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
@ -19,6 +21,8 @@ pub enum Architecture {
ARMv7, ARMv7,
AArch64, AArch64,
RISCV64, RISCV64,
PowerPC64,
S390X,
} }
impl Architecture { impl Architecture {
@ -36,6 +40,8 @@ impl std::str::FromStr for Architecture {
"armv7" => Architecture::ARMv7, "armv7" => Architecture::ARMv7,
"aarch64" => Architecture::AArch64, "aarch64" => Architecture::AArch64,
"riscv64" => Architecture::RISCV64, "riscv64" => Architecture::RISCV64,
"powerpc64" => Architecture::PowerPC64,
"s390x" => Architecture::S390X,
_ => return Err("invalid architecture"), _ => return Err("invalid architecture"),
}) })
} }
@ -48,6 +54,8 @@ impl std::fmt::Display for Architecture {
Architecture::ARMv7 => "armv7", Architecture::ARMv7 => "armv7",
Architecture::AArch64 => "aarch64", Architecture::AArch64 => "aarch64",
Architecture::RISCV64 => "riscv64", Architecture::RISCV64 => "riscv64",
Architecture::PowerPC64 => "powerpc64",
Architecture::S390X => "s390x",
}) })
} }
} }
@ -67,6 +75,12 @@ pub struct SysrootOptions {
#[arg(long, default_value = "/usr/riscv64-linux-gnu/include", action)] #[arg(long, default_value = "/usr/riscv64-linux-gnu/include", action)]
riscv64_sysroot: PathBuf, riscv64_sysroot: PathBuf,
#[arg(long, default_value = "/usr/powerpc64le-linux-gnu/include", action)]
powerpc64_sysroot: PathBuf,
#[arg(long, default_value = "/usr/s390x-linux-gnu/include", action)]
s390x_sysroot: PathBuf,
} }
#[derive(Parser)] #[derive(Parser)]

Loading…
Cancel
Save