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

KernelVersion::current reads /proc/sys/kernel/osrelease, patch version is incorrect in ubuntu #279

Open
tamird opened this issue Jul 11, 2023 · 3 comments

Comments

@tamird
Copy link

tamird commented Jul 11, 2023

tamird@pc:~/src$ cat /proc/sys/kernel/osrelease
6.2.0-24-generic
tamird@pc:~/src$ cat /proc/version_signature
Ubuntu 6.2.0-24.24-generic 6.2.12

Per this article the upstream kernel version is the rightmost field (so 6.2.12 in my case) while /proc/sys/kernel/osrelease reports 6.2.0.

There are possibly some gotchas with Debian as well -- I'm not sure if there's a universal way to get this information right for all distros.

@tamird
Copy link
Author

tamird commented Jul 11, 2023

Looks like there's some code in libbpf that tries to get this right.

https://github.com/torvalds/linux/blob/3f01e9fed8454dcd89727016c3e5b2fbb8f8e50c/tools/lib/bpf/libbpf_probes.c#L21-L101

@eminence
Copy link
Owner

Good info, thanks. Adding a similar check for ubuntu's version_signature sounds like the right thing to do here.

Also our procfs tests don't actually compare KernelVersion::current() to the output of uname, which should be fixed too

@tamird
Copy link
Author

tamird commented Jul 11, 2023

There's also this fun detail: torvalds/linux@a256aac

TL;DR kernel 4.19.x where x >= 222 lies but it's not clear that all facilities report the same version.

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

No branches or pull requests

2 participants