您好,这里在编译第三方驱动发现一个openEuler内核难以适配的问题:
我在编译https://github.com/falcosecurity/libs/tree/master/driver驱动时遇到了以下编译错误
/home/xzpeng/code/sysdig/build/driver/src/ppm_events.c:183:54: error: macro "access_ok" passed 3 arguments, but takes just 2
if (!ppm_access_ok(VERIFY_READ, from, bytes_to_read)) {
^
/home/xzpeng/code/sysdig/build/driver/src/ppm_events.c:104:41: error: ‘access_ok’ undeclared (first use in this function); did you mean ‘access_flags’?
#define ppm_access_ok(type, addr, size) access_ok(type, addr, size)
定位后发现是因为openEuler 4.19版本的内核回合了上游社区高版本补丁https://github.com/torvalds/linux/commit/96d4f267e40f9509e8a66e2b39e8b95655617693,导致access_ok接口发生了变更,这导致驱动中通过LINUX_VERSION_CODE和KERNEL_VERSION无法找到正确的access_ok接口。
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) || (PPM_RHEL_RELEASE_CODE > 0 && PPM_RHEL_RELEASE_CODE >= PPM_RHEL_RELEASE_VERSION(8, 1))
#define ppm_access_ok(type, addr, size) access_ok(addr, size)
#else
#define ppm_access_ok(type, addr, size) access_ok(type, addr, size)
于是我尝试修改第三方驱动代码去适配,但在适配的过程中发现openEuler内核的version.h中缺少类似redhat内核中的RHEL_RELEASE_VERSION宏,导致我无法找到一个很好的方案去适配openEuler内核,希望后续能在openEuler内核的version.h中添加用于判断openEuler内核版本的宏来帮助开发者适配这些第三方驱动,或者有更好的方案?
Hi xiezhipeng1, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: Kernel, and any of the maintainers: @YangYingliang , @pi3orama , @成坚 (CHENG Jian) , @Qiuuuuu , @zhengzengkai , @Xie XiuQi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Sign in to comment