-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
struct inode ctime fields changed again with Kernel >= 6.11 #4391
Comments
Hello @agalauner-r7, Thank you for using Tracee and for providing such a detailed issue report. I was able to reproduce the issue in my environment as well and will take a closer look at it.
Kernel version:
|
I think we use the field check method as a proxy for version (although version is actually a proxy for field existence) exactly because we don't support global kconfig access (although maybe for no reason anymore, not sure). |
Hey @agalauner-r7, I'm sorry for the delay. I liked both approaches you proposed and agree with @NDStrahilevitz that we can use field check as proxy for version. After trying different approaches and do some research, I ended up reading this from using macro KERNEL_VERSION:
From my understanding, think its better continue using the probe feature directly. I arrived at this solution, which has some similarities to your approach, except for the kernel version detection. WDYT? |
Description
Running tracee on a kernel with version >= 6.11 fails with the below error.
Reason for this is that the
ctime
fields in theinode
struct changed again: torvalds/linux@3aa63a5Output of
tracee version
:Output of
uname -a
:Additional details
I would fix it myself and submit a PR, but there are multiple ways to do it and I am not sure what's the preferred way.
Right now you check using the CO-RE framework if a new field for kernels between 6.6 and 6.10 is present. If so, read that, otherwise cast the struct into an older mock version and use CO-RE to read the old field.
This doesn't work if we have three different versions now.
There is a way to check for the current linux kernel version by declaring an external variable:
So, naively, I ended up with code like this:
This doesn't work though, because
vmlinux.h
doesn't contain the new definition ofstruct inode
.Now there are two tways to solve this:
struct inode___newer_v611
which contains the two new fields and use it like the else case:vmlinux.h
so we have a currentstruct inode
and introduce astruct inode___older_v611
which contains the old fields and use that in the else if branch like you do now in the else branch:So what's preferred? And if it's solution number 2, how do I regenerate vmlinux.h? On my local machine using bpftool? Do you have another process for that?
I personally would prefer the second case, because it feels better to work with more "current" code and have the special cases present for older kernels.
The text was updated successfully, but these errors were encountered: