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
1 answer

Is there a String size limit when sending strings back to BPF code and back to userspace?

I am sending this sentence through my BPF code through a BPF Char Array here: jmommyijsadifjasdijfa, hello, world And when I print out my output, I only seem to get this output jmommyij I seem to be hitting some kind of String size limit. Is…
-1
votes
1 answer

Failure to trace some syscalls with eBPF

I am using bcc to trace several syscalls, why is it that I can trace syscalls like write, close, fchown using a simple attach_kprobe but can't trace syscalls like stat, fstat? I assume that are other syscalls that I can't trace but haven't found…
Nuno Lopes
  • 57
  • 1
  • 7
-1
votes
1 answer

Intercept all outgoing/incoming traffic on Linux using eBPF

I am looking for help with capturing all incoming/outgoing traffic on a host using eBPF across all containers. Need to identify from/to which container is the traffic coming. The filter should run on in a privileged docker container. Don't need to…
rubenhak
  • 830
  • 2
  • 10
  • 28
-1
votes
1 answer

How to watch for new network connections TTL

I need to watch for new connections accept() TTL and collect them for further investigation. tcpdump can show TTL for packets, but can't show only accept() connections. I've tried iovisor/bcc and tcpaccept is doing well, but doesn't show…
it4ddict
  • 29
  • 5
-1
votes
2 answers

How to access a kernel variable using BPF?

For example, to access the skb variable in function ip_rcv: int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { ... } I searched the Internet but cannot find any example.
tonysok
  • 627
  • 1
  • 7
  • 13
-2
votes
1 answer

How to get socket listening port from request_sock?

I am trying to capture the syn queue len and accept queue len by setting a kprobe on tcp_v4_syn_recv_sock, the logic would get the third param of it (request_sock) and get ir_num of the sock. I have searched for it, and the ir_num seems to be the…
Paul Zhang
  • 305
  • 2
  • 7
-2
votes
1 answer

How to create a graph of packets received vs packets allowed to pass

I have an XDP program where I am dropping every other packet received on the loopback device (will use a physical device in the future). I would like to create a graph of how many packets are received by the device (or the xdp program) vs how many…
rhoward
  • 131
  • 2
  • 3
  • 10
-2
votes
1 answer

Use bcc SKB to drop TCP packet

Intention: To drop tcp/port packet using bcc tools I stumbled upon this code int drop(struct __sk_buff *skb) { const int l3_off = ETH_HLEN; // IP header offset const int l4_off = l3_off + sizeof(struct iphdr); // TCP…
zexapod
  • 45
  • 6
-2
votes
1 answer

Printing Hello World using uBPF?

I am messing around with uBPF recently and have noticed that I can't seem to implement any print functions within uBPF. I tried adding my code directly to test.c within the VM folder but and have it as a registered function but I am left with…
1 2 3
42
43