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

fix 'uninitialized value $ucode_vars{"AVAIL"}' from AMD ucode #226

Merged
merged 4 commits into from
May 14, 2022

Conversation

mmitch
Copy link
Contributor

@mmitch mmitch commented Nov 11, 2021

This should fix the warning uninitialized value $ucode_vars{"AVAIL"} when no microcode is available for an AMD CPU (issue #191).
I have fixed this by adopting the logic for Intel CPUs.

This means that the case we know the microcode inside the CPU but we don't have any firmware files to see if it is current or not now maps to NRM_UNKNOWN (like the Intel code did in that case) instead of NRM_CURRENT (which was exactly the source of the bug: if we are current we need to know an AVAIL version, but we didn't).

Unfortunately, I have no system to really test this on: all my current CPUs (Intel as well as AMD) have no microcode at all available for them.

The unintialized value occured when

- no microcode candidate for the current AMD cpu was found
 - the batch output mode (-b) was used

Fix this by using the same logic as for Intel cpus:

  When no microcode candidate is found, return NRM_UNKNOWN.
  Previously, NRM_CURRENT was returned in that case.
@liske liske added this to the v3.6 milestone May 14, 2022
@liske liske added the bug label May 14, 2022
@liske liske merged commit 149e546 into liske:master May 14, 2022
@liske
Copy link
Owner

liske commented May 14, 2022

Thanks!

@anarcat
Copy link
Contributor

anarcat commented Nov 15, 2023

It seems like this introduced a regression that all our AMD systems are now marked "UNKNOWN" here: #249

@mmitch could you review #285 to see if it makes sense? thanks!

update: i'm actually rooting for #288 now, see #249 (comment) for more context.

@mmitch
Copy link
Contributor Author

mmitch commented Nov 19, 2023

I have Debian 12 Bookworm with a Ryzen 5700G and no firmware updates available.
I've tried both #285 and #288 - on my systems, there is no difference, both work exactly the same:

  • default needrestart 3.6-4 from Debian gives me Use of uninitialized value $processor in concatenation (.) or string at /usr/share/perl5/NeedRestart/uCode.pm line 61. when I don't have the cpuid kernel module loaded AND I use the needrestart -v. Apart from that, I get the message Failed to check for processor microcode upgrades.
  • both Fix AMD Microcode Check #285 and fix AMD ucode checking in non-debug mode #288 fix the uninitialized value error. They also both report Failed to check for processor microcode upgrades as expected

I have read the discussion in #249 regarding UNKNOWN and the Nagios output mode and would be in favor of the "UNKNOWN should not map to a Nagios error" argumentation given.

My home-grown monitoring system uses needrestart -b (batch mode) and as long as UNKNOWN still results in return code 0 from the needrestart call (like it currently is with vanilla, #285 and #288), I'm happy.

Same goes for the apt integration in Debian: As long as the return code is unaffected, needrestart can print the warning about UNKNOWN without any side effects.

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

Successfully merging this pull request may close these issues.

3 participants