Search code examples
linux-kernellinux-device-driverebpfbpf

How to send data from eBPF code to Kernel module?


I know we can send data from eBPF code to userspace through BPF Maps, but is there a way to send any kind of data from eBPF code to a kernel module?

This link showed a patch that adds functions in kernel to read data from BPF_MAP_TYPE_RINGBUF map. But it seems they have no plan to merge it into main kernel. And since compiling the kernel is not an option, I'm right back where I started.


Solution

  • I think your best bet to make this work would be to implement kfuncs in your kernel module which you could call from your eBPF program. If you need to store any kind of data, implement it in the module instead of using maps.