Replies: 1 comment 5 replies
-
👋 Thanks for the question. I'm curious about this myself since it seems un(der)documented as usual, but keep in mind this is purely a bpf-oriented question and not related to ebpf-go.
/* create two maps: bpf program will only do bpf_seq_write
* for these two maps. The goal is one map output almost
* fills seq_file buffer and then the other will trigger
* overflow and needs restart.
*/
/* bpf_seq_printf kernel buffer is 8 pages, so one map
* bpf_seq_write will mostly fill it, and the other map
* will partially fill and then trigger overflow and need
* bpf_seq_read restart.
*/ Note that this conflates bpf_seq_printf and bpf_seq_write. I'm not sure which has the 8-page limit; printf or write? Something to investigate through experimentation or reading more kernel code. I'd expect E2BIG to happen in user space (not EOVERFLOW) if the caller's buffer provided to read() is too small for the output the program wants to generate, and the caller needs to resize the buffer. My understanding is that:
I'm not sure if the kernel immediately returns EOVERFLOW to both callers to read() and bpf_seq_write(), or if the bpf prog needs to return the error code received from write(). Further write calls are pointless in any case; the bpf prog needs to return and a subsequent call to read() will be provided the same context. (task/map/prog/whatever) It also looks like all selftests ignore the write() retcode. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
First, many thanks 🙇🏼 (again) for this incredibly useful project that frees me from the horrors of libbpf and distro shared library hell!
I'm struggling with the eBPF Docs on
bpf_seq_write
:What actions do I need to take here? The docs make it sound as if there would be some magic retry, but I doubt that's the case. Is the idea that on
-EOVERFLOW
to immediately return 1 from the iterator eBPF prog and then hopefully things have sorted them out themselves...?When does
-EOVERFLOW
actually happen? Can it also happen when hitting some per-write limitation so that retrying would never work but be stupid?Beta Was this translation helpful? Give feedback.
All reactions