Questions tagged [ebpf]

eBPF (from “extended Berkeley Packet Filter”) is a subsystem introduced in Linux and allowing to load user programs into the kernel, to verify them for safety, possibly to JIT (Just-In-Time) compile them, and to attach them to hook points, where they run on certain events. eBPF's performance and flexibility make it suitable for a wide range of use cases, the most prominent being network packet processing, system monitoring, and security enforcement.

eBPF (from “extended Berkeley Packet Filter”) is a subsystem allowing to load user programs into the kernel, to verify them for safety, possibly to JIT (Just-In-Time) compile them, and to attach them to hook points, where they run on certain events. eBPF's performance and flexibility make it suitable for a wide range of use cases, the most prominent being network packet processing, system monitoring, and security enforcement. Introduced in Linux, eBPF gained support to varying degrees on other systems, including Windows or FreeBSD.

See also https://ebpf.io/ for a more detailed introduction and for additional resources. More assistance can also be found at the following locations:

When submitting questions related to a specific eBPF piece of code, please consider including a full stand-alone reproducer, it helps a lot for debugging the issues.

Related tags include bpf, bcc-bpf, or xdp-bpf.

641 questions
-1
votes
0 answers

Issue while using bpf_map_update_elem() function for flow statistics

I am trying to record TCP flows - if new, create an entry into a hash map with the 5-tuple as the key and then push out a new flow event (identified by SYN flag). The problem I encounter is with the function bpf_map_update_elem(). When I use this…
-1
votes
1 answer

adding code to bpf _kernel.c file for uprobe SEC routines (libbpf +c)

I am trying function count for given executable and pattern. trying to explore latest introduced API bpf_program__attach_uprobe_multi, couldn't find example for the same. below code failing with invalid argument. added prints in libbpf code, looks…
nullptr
  • 5
  • 3
-1
votes
0 answers

Calculate the Millions of Instructions of a job in cloud?

My work is to calculate the expected time to complete a job in cloud environment. I found a research [1] intructed the equation to calculate the expected time to complete the job as . Even though I have the MIPS (Million Instructions Per Second) but…
biak
  • 11
  • 6
-1
votes
1 answer

are bpf_probe_read's atomic?

Are bpf_probe_read functions etc, atomic ? And do they inc ref counts of the data structure they're are reading, because if the operation is not atomic while the read is going through the kernel deallocates that data structure can it not cause a…
-1
votes
1 answer

Is BPF_LOOP for Linkedlist iteration, viable?, if not what other way I can do it

I am trying to iterate a linked list in BPF, can I use bpf_loop for this?, if so how? Tried using bpf_loops, but it required a fixed number to bound the loops, what way I can do that?
-1
votes
1 answer

How does the second argument use a variable when using bpf_probe_read_kernel_str() in ebpf?

` size_t pos = 0; const u32 MAX_BACKTRACE_DEPTH = 20; for (u32 cnt = MAX_BACKTRACE_DEPTH; cnt != 0; --cnt) { if (err || curr_dentry == NULL) { break; } int name_len = BPF_CORE_READ(curr_dentry,…
-1
votes
1 answer

can't get bpfptr_r uattr parameter when tracing __sys_bpf

my environment: ubuntu 20.04 kernel version: 5.15.0-46-generic x86_64 below is my code: import sys import signal from bcc import BPF import os # define BPF program bpf_text = """ #include #include #include…
luke zou
  • 21
  • 4
-1
votes
1 answer

K8s Service Mesh (with Sidecar Proxy): Pod Security On Untrusted Node

Wondering if traffic between a pod's sidecar proxy and the pod's application(s) can be intercepted as it traverses the localhost network stack (perhaps using a eBPF module)? Can a tenant guarantee the security of its traffic if it does not…
gdew
  • 31
  • 1
  • 3
-1
votes
1 answer

How ti get the size of eBPF map?

I'm new to eBPF, I want to insert elements to a BPF_ARRAY, so is there any way to do like C++ push_back() size() function?
Nicholas
  • 127
  • 1
  • 11
-1
votes
1 answer

What is the proper way to pass traffic using GRE tunnel (or any vNIC) using eBPF?

I have a GRE link set up on a VM using the following commands: ip tunnel add tap0 mode gre local remote and the counterpart on a different VM (in the same subnet) is exactly the same except foo<->bar I have created and an eBPF tc program…
Nimrodshn
  • 859
  • 3
  • 13
  • 29
-1
votes
1 answer

clang bpf: attribute always_inline does not working

I wrote a BPF object file which included a section and a static inlined function, which defined as below: static inline __attribute__((always_inline)) bpf_call_func(...); __section("entry") bpf_func(...); // called bpf_call_func It worked well and…
-1
votes
1 answer

I have a function call in one program and this function is depreciated.Is there any newer version that I can use in my code | perf_buffer__new in ebpf

I have this function which is depreciated. First how one can find the new alternative to functions that are depreciated. the function exist in libbpf library and perf_buffer__new is the exact name. so basically as the name suggest its used to create…
user786
  • 3,902
  • 4
  • 40
  • 72
-1
votes
1 answer

Trying to create map with char array field invalid field error

I like to know how to create ebpf map with char array value I tried like this struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); __uint(key_size, sizeof(int)); __uint(value_size, sizeof(char)*10); __uint(max_entries, 2); } my_map…
user786
  • 3,902
  • 4
  • 40
  • 72
-1
votes
1 answer

compiling extended berkley packet filters program in ubuntu clang and llvm installed with libbpf also installed bt helper func not found& formar error

So I have llvm, kernel headers(5.14.1), clang, and also libbpf along with that I copied bpf_helpers.h in ebpf program directory from linux source. This is a simple program that I like to get it loaded and run when execve system get called from any…
user786
  • 3,902
  • 4
  • 40
  • 72
-1
votes
1 answer

bpf verifier log is truncated, how to get the full log?

As the following, bpf verifier log is truncated at the last. How could I get the full log ? 368=mmmmmmmm fp-376=mmmmmmmm fp-432=mmmmmmmm fp-440=inv fp-448=inv fp-456=map_value fp-464=inv 389: (73) *(u8 *)(r3 +322) = r1 390: (71) r1 = *(u8 *)(r2…
hi_glenn
  • 67
  • 1
  • 5
1 2 3
42
43