use strict;
# enable only the following on debugging purpose
-use warnings;
-use CGI::Carp 'fatalsToBrowser';
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
$colour = "white";
$bgcolour = ${Header::colourred};
+ # Mitigated but smt is enabled
+ } elsif ($status eq "Mitigation-SMT") {
+ $status_message = $Lang::tr{'mitigated'};
+ $colour = "white";
+ $bgcolour = ${Header::colourred};
+
# Mitigated
} elsif ($status eq "Mitigation") {
$status_message = $Lang::tr{'mitigated'};
- $colour = "black";
- $bgcolour = ${Header::colourorange};
+ $colour = "white";
+ $bgcolour = ${Header::colourgreen};
+ # Unknown report from kernel
} else {
- next;
+ $status_message = $status;
+ $colour = "black";
+ $bgcolour = ${Header::colouryellow};
}
my $table_colour = ($id++ % 2) ? $color{'color22'} : $color{'color20'};
&Header::openbox('100%', 'center', $Lang::tr{'settings'});
+my $smt_status = &smt_status();
+
print <<END;
<table class="tbl" width="66%">
<tbody>
+ <tr>
+ <th colspan="2" align="center">
+ <strong>$smt_status</strong>
+ </th>
+ </tr>
+
<tr>
<td width="50%" align="left">
- <strong>$Lang::tr{'enable smt'}</strong>
+ $Lang::tr{'enable smt'}
</td>
<td width="50%" align="center">
my $status = <FILE>;
close(FILE);
- if ($status =~ /^(Mitigation): (.*)$/) {
+ if ($status =~ /^(Mitigation): (.*vulnerable.*)$/) {
+ return ("Mitigation-SMT", $2);
+ }
+
+ if ($status =~ /^(Vulnerable|Mitigation): (.*)$/) {
return ($1, $2);
}
return $status;
}
+
+sub smt_status() {
+ open(FILE, "/sys/devices/system/cpu/smt/control");
+ my $status = <FILE>;
+ close(FILE);
+
+ chomp($status);
+
+ if ($status eq "on") {
+ return $Lang::tr{'smt enabled'};
+ } elsif (($status eq "off") || ($status eq "forceoff")) {
+ return $Lang::tr{'smt disabled'};
+ } elsif ($status eq "notsupported") {
+ return $Lang::tr{'smt not supported'};
+ }
+
+ return $status;
+}