@@ -14,10 +14,13 @@ size_t bythos_check_microcode(check_result_t *results, size_t max_results) {
1414 const char * cpuinfo_path = "/proc/cpuinfo" ;
1515
1616 {
17+ bythos_cpu_vendor_t vendor = bythos_cpu_vendor ();
1718 char microcode_line [256 ] = {0 };
1819 char revision [128 ] = {0 };
1920
20- if (!bythos_first_line_with_prefix (cpuinfo_path , "microcode" , microcode_line , sizeof (microcode_line ))) {
21+ if (vendor != BYTHOS_CPU_VENDOR_INTEL && vendor != BYTHOS_CPU_VENDOR_AMD ) {
22+ EMIT_SKIP_VENDOR ("CPU microcode" , "x86-only check" );
23+ } else if (!bythos_first_line_with_prefix (cpuinfo_path , "microcode" , microcode_line , sizeof (microcode_line ))) {
2124 EMIT ("CPU microcode" , CHECK_WARN , "revision not visible" );
2225 } else if (bythos_extract_microcode_revision (microcode_line , revision , sizeof (revision ))) {
2326 char detail [160 ];
@@ -35,7 +38,7 @@ size_t bythos_check_microcode(check_result_t *results, size_t max_results) {
3538 EMIT_SKIP ("CPU vulnerabilities" , SKIP_FEATURE_ABSENT ,
3639 "kernel vulnerabilities sysfs not exposed" );
3740 } else {
38- size_t total = 0 , vulnerable = 0 ;
41+ size_t total = 0 , vulnerable = 0 , unknown = 0 ;
3942 char first_vuln [64 ] = {0 };
4043 struct dirent * entry ;
4144 while ((entry = bythos_readdir_safe (d , NULL )) != NULL ) {
@@ -53,6 +56,8 @@ size_t bythos_check_microcode(check_result_t *results, size_t max_results) {
5356 if (first_vuln [0 ] == '\0' ) {
5457 snprintf (first_vuln , sizeof (first_vuln ), "%.60s" , entry -> d_name );
5558 }
59+ } else if (strncmp (lower , "unknown" , 7 ) == 0 ) {
60+ unknown ++ ;
5661 }
5762 }
5863 closedir (d );
@@ -64,6 +69,11 @@ size_t bythos_check_microcode(check_result_t *results, size_t max_results) {
6469 snprintf (detail , sizeof (detail ), "%zu of %zu vulnerable (e.g. %s)" ,
6570 vulnerable , total , first_vuln );
6671 EMIT ("CPU vulnerabilities" , CHECK_WARN , detail );
72+ } else if (unknown > 0 ) {
73+ char detail [BYTHOS_DETAIL_MAX ];
74+ snprintf (detail , sizeof (detail ),
75+ "%zu of %zu indeterminate (kernel reports unknown)" , unknown , total );
76+ EMIT ("CPU vulnerabilities" , CHECK_WARN , detail );
6777 } else {
6878 char detail [BYTHOS_DETAIL_MAX ];
6979 snprintf (detail , sizeof (detail ), "%zu checks; all mitigated or not affected" ,
@@ -74,7 +84,8 @@ size_t bythos_check_microcode(check_result_t *results, size_t max_results) {
7484 }
7585
7686 if (bythos_command_exists ("spectre-meltdown-checker" )) {
77- EMIT ("CPU vulnerability scan" , CHECK_OK , "available: spectre-meltdown-checker" );
87+ EMIT_SKIP ("CPU vulnerability scan" , SKIP_NOT_CONFIGURED ,
88+ "spectre-meltdown-checker available; run manually for a deep scan" );
7889 } else {
7990 EMIT_SKIP_TOOL_INSTALL ("CPU vulnerability scan" , "spectre-meltdown-checker" );
8091 }
0 commit comments