oracle-samples/drgn-tools

cpuinfo: test failure for AMD CPU

brenns10 opened this issue · 1 comments

Running heavyvm tests on an AMD server in OCI, I got the following failure for OL7, UEK4:

=================================== FAILURES ===================================
_________________________________ test_cpuinfo _________________________________

prog = <_drgn.Program object at 0xe48688>

    def test_cpuinfo(prog):
        cpuinfo.print_cpu_info(prog)

        if not (ProgramFlags.IS_LIVE & prog.flags) or not (
            prog["init_uts_ns"].name.machine.string_().decode("utf-8") == "x86_64"
        ):
            return

        file = open("/proc/cpuinfo", "r")
        lines = file.readlines()
        cpu_data_from_proc = dict()
        for line in lines:
            try:
                title, value = line.split(":")
                title, value = title.strip(), value.strip()
                cpu_data_from_proc[title] = value
            except Exception:
                continue

        cpu_data_from_corelens = cpuinfo.x86_get_cpu_info(prog)

        assert (
            cpu_data_from_corelens["CPU VENDOR"] == cpu_data_from_proc["vendor_id"]
        )
>       assert (
            cpu_data_from_corelens["MODEL NAME"]
            == cpu_data_from_proc["model name"]
        )
E       AssertionError: assert 'AMD EPYC 7J1...             ' == 'AMD EPYC 7J1...ore Processor'
E         - AMD EPYC 7J13 64-Core Processor
E         + AMD EPYC 7J13 64-Core Processor
E         ?                                ++++++++++++++++

tests/test_cpuinfo.py:32: AssertionError
----------------------------- Captured stdout call -----------------------------
CPU VENDOR: AuthenticAMD
MODEL NAME: AMD EPYC 7J13 64-Core Processor
CPU FAMILY: 25
CPUS      : 2
CPUS NUMA0: 0-1
MICROCODE : 0x1000065
CSTATES   : 9
CPU FLAGS : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl extd_a
picid eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm s
se4a misalignsse 3dnowprefetch osvw perfctr_core arat invpcid_single virt_ssbd ibrs stibp ia32_arch_caps ibpb ssbd npt nrip_save vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 e
rms invpcid rdseed adx smap clflushopt clwb xsaveopt xsavec xgetbv1
BUG FLAGS : fxsave_leak sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass swapgs

VULNERABILITIES:
Meltdown         : Not Affected
Spectre_V1       : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
Spectre_V2       : Mitigation: Full AMD retpoline, IBRS_FW, IBPB
L1TF             : Not Affected
MDS              : Not Affected
tsx_async_abort  : Not Affected
itlb_multihit    : Not Affected
SRDBS            : Not Affected
mmio_stale_data  : Not Affected
mmio_unknown     : Not Affected
Retbleed         : Not Affected
spec_store_bypass: Mitigation: Speculative Store Bypass disabled via prctl and seccomp
GDS              : Not Affected
SRSO             : Not Affected
fxsave_leak      : Vulnerable
sysret_ss_attrs  : Vulnerable
swapgs           : Vulnerable

It looks like the CPU model information is padded with spaces at the end. We should probably use .strip() to avoid this.

Closed in #6