Skip to content
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

Enhance kernel version detection by using uname #1399

Closed
wants to merge 1 commit into from

Conversation

Vyom-Yadav
Copy link

  • Refactored the detectKernelVersion function to not solely rely on vdsoVersion. Added a fallback mechanism using the KernelRelease function, which utilizes the uname system call to get the kernel release string.

I had vDSO disabled for tapping into some syscalls, so this is something good to have.

* Refactored the detectKernelVersion function to not solely rely on vdsoVersion. Added a fallback mechanism using the KernelRelease function, which utilizes the uname system call to get the kernel release string.

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>
@Vyom-Yadav Vyom-Yadav requested a review from a team as a code owner March 26, 2024 18:39
@brycekahle
Copy link
Contributor

We moved away from uname because it is notoriously hard to parse, and often doesn't contain enough information to match the value the kernel expects (for kernels < 5.0).

You can always set ProgramSpec.KernelVersion if you don't want the library to automatically set the value.

@Vyom-Yadav
Copy link
Author

We moved away from uname because it is notoriously hard to parse, and often doesn't contain enough information to match the value the kernel expects (for kernels < 5.0).

@brycekahle I added this as a fallback mechanism. Setting the flag manually v/s at least having something to get the kernel version 🤷🏼‍♂️

@brycekahle
Copy link
Contributor

I understand, but this is more code to maintain for what sounds like a very narrow use case (vDSO disabled). See the code we removed in #500 for the old parsing code.

Maybe the maintainers feel differently, but my vote is to not add more maintenance burden.

@Vyom-Yadav
Copy link
Author

I can see why the team took that decision. I was using Tetragon, and it isn't working with vDSO disabled, so I was trying to work around that somehow. I don't program using eBPF so I don't know how to set this up using some external Tetragon config, if possible.

@lmb
Copy link
Collaborator

lmb commented Mar 27, 2024

I agree with Bryce, we've been down this path and it's not very pretty.

Out of curiosity, why do you have vDSO disabled? It'll cause a pretty massive slowdown for e.g. time related syscalls.

@Vyom-Yadav
Copy link
Author

Indeed, it's not pretty, but that is just a backup option in case vdso is disabled.

It is not reducing any functionality, just enhancing it. It does not break anything.

I have vDSO disabled to tap into time syscalls. This would help in debugging unreproducible builds, so that's the reason behind it.

@lmb
Copy link
Collaborator

lmb commented Mar 27, 2024

Discussed this with @ti-mo, we're not going to bring back uname parsing. That said, I think we should allow running without the vDSO.

In fact, the current version of the library shouldn't really rely on the vDSO any more since fbff7db Can you check which version of the library you are using at the moment? My guess is that you don't have the commit above. If that isn't true, please open a bug report that includes the error you are seeing and which version of the library you are using. We might be able to work around this in some other fashion.

@lmb lmb closed this Mar 27, 2024
@Vyom-Yadav
Copy link
Author

@lmb Nope, it still doesn't work, I'm using Tetragon's latest ci images, and they have that particular commit.
time="2024-03-30T12:00:54Z" level=fatal msg="Failed to start tetragon" error="failed prog /var/lib/tetragon/bpf_exit.o kern_version 393472 loadInstance: opening collection '/var/lib/tetragon/bpf_exit.o' failed: program event_exit_disassociate_ctty: detecting kernel version: finding vDSO memory address: no vdso address found in auxv"


time="2024-03-26T13:29:51Z" level=fatal msg="Failed to start tetragon" error="failed prog /var/lib/tetragon/bpf_exit.o kern_version 394509 loadInstance: opening collection '/var/lib/tetragon/bpf_exit.o' failed: program event_exit_acct_process: detecting kernel version: finding vDSO memory address: no vdso address found in auxv"

@Vyom-Yadav
Copy link
Author

@lmb Created #1408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants