procfs icon indicating copy to clipboard operation
procfs copied to clipboard

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

Open tamird opened this issue 2 years ago • 3 comments

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 avatar Jul 11 '23 02:07 tamird

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

tamird avatar Jul 11 '23 02:07 tamird

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

eminence avatar Jul 11 '23 04:07 eminence

There's also this fun detail: https://github.com/torvalds/linux/commit/a256aac5b7000bdf1232ed2bbd674582c0ab27ec

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

tamird avatar Jul 11 '23 13:07 tamird