Detect the kernel version before the arch
authorAlexander Popov <alex.popov@linux.com>
Sun, 6 Oct 2024 21:02:23 +0000 (00:02 +0300)
committerAlexander Popov <alex.popov@linux.com>
Sun, 6 Oct 2024 21:59:47 +0000 (00:59 +0300)
kernel_hardening_checker/__init__.py

index dd267129f48f5952cb04bb22ddd3bcc2abd76ccb..0af2e308adb42d24b9f7373ec0f4f6010ad05d29 100755 (executable)
@@ -293,12 +293,6 @@ def main() -> None:
             if args.sysctl:
                 print(f'[+] Sysctl output file to check: {args.sysctl}')
 
-        arch, msg = detect_arch_kconfig(args.config, supported_archs)
-        if arch is None:
-            sys.exit(f'[!] ERROR: {msg}')
-        if mode != 'json':
-            print(f'[+] Detected microarchitecture: {arch}')
-
         if args.kernel_version:
             kernel_version, msg = detect_kernel_version(args.kernel_version)
         else:
@@ -310,6 +304,12 @@ def main() -> None:
         if mode != 'json':
             print(f'[+] Detected kernel version: {kernel_version}')
 
+        arch, msg = detect_arch_kconfig(args.config, supported_archs)
+        if arch is None:
+            sys.exit(f'[!] ERROR: {msg}')
+        if mode != 'json':
+            print(f'[+] Detected microarchitecture: {arch}')
+
         compiler, msg = detect_compiler(args.config)
         if mode != 'json':
             if compiler: