请问HN:如何在eBPF中处理内核结构的变化(例如iovec_iter)?

3作者: morolis3 天前原帖
我使用了来自pwru的内核vmlinux头文件(6.10版本)进行编译,但我的实际内核版本是6.6。在内核版本变更(6.10到6.6)时,iov_iter中的iov字段名称变成了一个内部匿名结构__iov,因此如果我根据6.10版本的字段名称进行提取和编译,就无法在我当前的系统中运行,反之亦然。我想请教一下,针对这种内核结构的变化,有什么更正式或官方的解决方案吗?我目前的解决方案是直接定制两个不同版本的iov匿名结构,通过bpf_core_field_exists判断两种获取iov的方式是否兼容。
查看原文
I used the kernel vmlinux header file(6.10 version) from pwru to compile, but my actual kernel version was 6.6. the iov field name in iov_iter become an internal anonymous structure __iov file on kernel changing(6.10->6.6), so the led to that if I extracted and compiled according to the field name of version 6.10, I could not run in my current system, and vice versa. I would like to ask what is a more formal or official solution to deal with this change in kernel structure? My current solution is to directly customize two different versions of iov anonymous structures to judge whether two ways to obtain iov are compatible through bpf_core_field_exists.