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

bpf: Remove builtin global functions #698

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions bpf/aya-bpf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use core::ffi::c_void;

pub use aya_bpf_cty as cty;
pub use aya_bpf_macros as macros;
use cty::{c_int, c_long};
use cty::c_long;
use helpers::{bpf_get_current_comm, bpf_get_current_pid_tgid, bpf_get_current_uid_gid};

pub const TASK_COMM_LEN: usize = 16;
Expand Down Expand Up @@ -61,22 +61,6 @@ pub trait BpfContext {
}
}

#[no_mangle]
pub unsafe extern "C" fn memset(s: *mut u8, c: c_int, n: usize) {
#[allow(clippy::cast_sign_loss)]
let b = c as u8;
for i in 0..n {
*s.add(i) = b;
}
}

#[no_mangle]
pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *mut u8, n: usize) {
for i in 0..n {
*dest.add(i) = *src.add(i);
}
}

/// Check if a value is within a range, using conditional forms compatible with
/// the verifier.
#[inline(always)]
Expand Down
3 changes: 2 additions & 1 deletion test/integration-ebpf/src/bpf_probe_read.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
#![no_builtins]
#![no_main]
#![no_std]

use aya_bpf::{
helpers::{bpf_probe_read_kernel_str_bytes, bpf_probe_read_user_str_bytes},
Expand Down
3 changes: 2 additions & 1 deletion test/integration-ebpf/src/log.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
#![no_builtins]
#![no_main]
#![no_std]

use aya_bpf::{macros::uprobe, programs::ProbeContext};
use aya_log_ebpf::{debug, error, info, trace, warn};
Expand Down
3 changes: 2 additions & 1 deletion test/integration-ebpf/src/map_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
#![no_builtins]
#![no_main]
#![no_std]

use aya_bpf::{
bindings::xdp_action,
Expand Down
3 changes: 2 additions & 1 deletion test/integration-ebpf/src/name_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
#![no_builtins]
#![no_main]
#![no_std]

use aya_bpf::{bindings::xdp_action, macros::xdp, programs::XdpContext};

Expand Down
3 changes: 2 additions & 1 deletion test/integration-ebpf/src/pass.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
#![no_builtins]
#![no_main]
#![no_std]

use aya_bpf::{bindings::xdp_action, macros::xdp, programs::XdpContext};

Expand Down
3 changes: 2 additions & 1 deletion test/integration-ebpf/src/relocations.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
#![no_builtins]
#![no_main]
#![no_std]

use core::hint;

Expand Down
3 changes: 2 additions & 1 deletion test/integration-ebpf/src/test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
#![no_builtins]
#![no_main]
#![no_std]

use aya_bpf::{
bindings::xdp_action,
Expand Down
2 changes: 0 additions & 2 deletions xtask/public-api/aya-bpf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2587,5 +2587,3 @@ pub fn aya_bpf::programs::tracepoint::TracePointContext::as_ptr(&self) -> *mut c
impl aya_bpf::BpfContext for aya_bpf::programs::xdp::XdpContext
pub fn aya_bpf::programs::xdp::XdpContext::as_ptr(&self) -> *mut core::ffi::c_void
pub fn aya_bpf::check_bounds_signed(value: i64, lower: i64, upper: i64) -> bool
#[no_mangle] pub unsafe c fn aya_bpf::memcpy(dest: *mut u8, src: *mut u8, n: usize)
#[no_mangle] pub unsafe c fn aya_bpf::memset(s: *mut u8, c: aya_bpf_cty::ad::c_int, n: usize)
Loading