396 Star 1.4K Fork 1.3K

GVPopenEuler / kernel

 / 详情

需要在openEuler内核的version.h添加类似RHEL_RELEASE_VERSION的字段

Backlog
Bug
Opened this issue  
2022-02-07 15:52

您好,这里在编译第三方驱动发现一个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内核版本的宏来帮助开发者适配这些第三方驱动,或者有更好的方案?

Comments (1)

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

谢志鹏 created缺陷
openeuler-ci-bot added
 
sig/Kernel
label
谢志鹏 set assignee to Xie XiuQi
谢志鹏 removed
 
sig/Kernel
label
谢志鹏 added
 
sig/Kernel
label
sanglipeng added
 
kind/bug
label
zhangchangzhong changed milestone from 20.03-SP3-Kernel-Defect to not set
zhangchangzhong set branch to openEuler-1.0-LTS
Expand operation logs

Sign in to comment

Status
Assignees
Projects
Milestones
Pull Requests
Successfully merging a pull request will close this issue.
Branches
Planed to start   -   Planed to end
-
Top level
Priority
Duration (hours)
参与者(2)
5329419 openeuler ci bot 1632792936
C
1
https://gitee.com/openeuler/kernel.git
git@gitee.com:openeuler/kernel.git
openeuler
kernel
kernel

Search