Skip to content

Commit

Permalink
[uCode] Fix broken update detection to use the revision number (githu…
Browse files Browse the repository at this point in the history
…b issue #108).
  • Loading branch information
liske committed Mar 29, 2018
1 parent 3281733 commit c318ca7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ needrestart (3.0) unstable; urgency=medium
- [uCode] Fix uninitialized value in batch mode.
(Debian Bug#891923 by Bob Proulx <bob@proulx.com>)
(github issue #105 by Evgenii Terechkov @evgkrsk)
- [uCode] Fix broken update detection to use the revision number.
(github issue #108)

-- Thomas Liske <thomas@fiasko-nw.net>

Expand Down
4 changes: 2 additions & 2 deletions ex/debconf/needrestart.templates
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ _Description: Outdated processor microcode
Template: needrestart/ui-ucode_announce
Type: note
_Description: Processor microcode update
The currently running processor microcode signature is ${CURRENT} which is not
the expected microcode signature ${AVAIL}.
The currently running processor microcode revision is ${CURRENT} which is not
the expected microcode revision ${AVAIL}.
.
Restarting the system to load the new processor microcode will not be handled
automatically, so you should consider rebooting.
Expand Down
2 changes: 1 addition & 1 deletion perl/lib/NeedRestart/UI/stdio.pm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ sub announce_ucode {
my %vars = @_;

print "\n";
$self->wprint(\*STDOUT, '', '', __x("Pending processor microcode upgrade!\n\nDiagnostics:\n The currently running processor microcode signature is {CURRENT} which is not the expected microcode signature {AVAIL}.\n\nRestarting the system to load the new processor microcode will not be handled automatically, so you should consider rebooting. [Return]\n",
$self->wprint(\*STDOUT, '', '', __x("Pending processor microcode upgrade!\n\nDiagnostics:\n The currently running processor microcode revision is {CURRENT} which is not the expected microcode revision {AVAIL}.\n\nRestarting the system to load the new processor microcode will not be handled automatically, so you should consider rebooting. [Return]\n",
current => $vars{CURRENT},
avail => $vars{AVAIL},
));
Expand Down
28 changes: 19 additions & 9 deletions perl/lib/NeedRestart/uCode/Intel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,27 @@ sub nr_ucode_check_real {
my $ui = shift;
my %vars;

my $fh = nr_fork_pipe($debug, NRM_INTEL_HELPER, $debug);
while(<$fh>) {
if (/^iucode_tool:.+signature (0x[\da-f]+)/) {
$vars{CURRENT} = $1;
print STDERR "$LOGPREF current signature: $1\n" if($debug);
next;
# get current microcode revision
if(open(my $fh, '<', '/proc/cpuinfo')) {
while (<$fh>) {
if (/^microcode\s+:\s+(0x[\da-f]+)/i) {
$vars{CURRENT} = sprintf("0x%x", hex($1));
last;
}
}
close($fh);
}
else {
print STDERR "$LOGPREF unable to open /proc/cpuinfo: $!\n" if($debug);

if (/\s+\d+\/\d+: sig (0x[\da-f]+),/) {
$vars{AVAIL} = $1;
print STDERR "$LOGPREF available signature: $1\n" if($debug);
return (NRM_UNKNOWN, %vars);
}

my $fh = nr_fork_pipe($debug, NRM_INTEL_HELPER, $debug);
while(<$fh>) {
if (/\s+\d+\/\d+: sig.+, rev (0x[\da-f]+),/) {
$vars{AVAIL} = sprintf("0x%x", hex($1));
print STDERR "$LOGPREF available revision: $1\n" if($debug);
next;
}
}
Expand Down

0 comments on commit c318ca7

Please sign in to comment.