-
Notifications
You must be signed in to change notification settings - Fork 67
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
wrong report of needed kernel upgrade if kernel name is too long #293
Comments
Doubling the buffer size as suggested by @jaycci fixed the false positive in Rocky Linux 9.3 (Blue Onyx) for me. It's based on RHEL. My currently running kernel is called
|
Thanks for the analysis. I've increased the read to 512 bytes. That should work for most (all?) setups in the field while not making the code not more complex as needed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When the kernel version string is too long,
needrestart
falsely reports that the kernels needs ABI upgrade.needrestart
needs a better way to parse the kernel version string from the kernel file.How to see the problem (with my kernel):
If you look at the version string in the kernel file, you'll read:
The first line is the one grabbed by
needrestart
(see fileneedrestart/perl/lib/NeedRestart/Kernel/Linux.pm
functionnr_linux_version_x86($$)
).This function hardcodes a max length of the kernel string of "128" bytes read from the file:
needrestart/perl/lib/NeedRestart/Kernel/Linux.pm
Line 71 in 280c1ae
As you can see in my example, the version string of the kernel is 130 bytes, more than 128.
The documentation for this string (https://www.kernel.org/doc/html/v6.1/x86/boot.html, look for "kernel version") only says that the string is NUL-terminated.
The hardcoded max length of "128" should be increased, or another way to parse this string should be chosen (but I don't know the best way to do it).
The text was updated successfully, but these errors were encountered: