untrusted comment: verify with openbsd-72-base.pub RWQTKNnK3CZZ8IveeOx33pih0/dnCoRqBbImKbcOeZi0c72TwnBovZ8XLqH74765aAU+804I+y11stTnuhTayhBp0m4zzGLkIwg= OpenBSD 7.2 errata 033, July 24, 2023: Workaround for Zenbleed AMD cpu problem. For i386 and amd64 platforms. Apply by doing: signify -Vep /etc/signify/openbsd-72-base.pub -x 033_amdcpu.patch.sig \ -m - | (cd /usr/src && patch -p0) And then rebuild and install a new kernel: KK=`sysctl -n kern.osversion | cut -d# -f1` cd /usr/src/sys/arch/`machine`/compile/$KK make obj make config make make install Index: sys/arch/i386/i386/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/i386/i386/machdep.c,v diff -u -p -u -r1.656 machdep.c --- sys/arch/i386/i386/machdep.c 25 Aug 2022 17:25:25 -0000 1.656 +++ sys/arch/i386/i386/machdep.c 24 Jul 2023 16:52:24 -0000 @@ -1661,6 +1661,7 @@ identifycpu(struct cpu_info *ci) char *cpu_device = ci->ci_dev->dv_xname; int skipspace; extern uint32_t cpu_meltdown; + uint64_t msr, nmsr; if (cpuid_level == -1) { name = "486DX"; @@ -2009,13 +2010,17 @@ identifycpu(struct cpu_info *ci) */ if (!strcmp(cpu_vendor, "AuthenticAMD")) { if (ci->ci_family >= 0x10 && ci->ci_family != 0x11) { - uint64_t msr; - - msr = rdmsr(MSR_DE_CFG); - if ((msr & DE_CFG_SERIALIZE_LFENCE) == 0) { - msr |= DE_CFG_SERIALIZE_LFENCE; - wrmsr(MSR_DE_CFG, msr); - } + nmsr = msr = rdmsr(MSR_DE_CFG); + nmsr |= DE_CFG_SERIALIZE_LFENCE; + if (msr != nmsr) + wrmsr(MSR_DE_CFG, nmsr); + } + if (family == 0x17 && ci->ci_model >= 0x31) { + nmsr = msr = rdmsr(MSR_DE_CFG); +#define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */ + nmsr |= DE_CFG_SERIALIZE_9; + if (msr != nmsr) + wrmsr(MSR_DE_CFG, nmsr); } } Index: sys/arch/amd64/amd64/cpu.c =================================================================== RCS file: /cvs/src/sys/arch/amd64/amd64/cpu.c,v diff -u -p -u -r1.161 cpu.c --- sys/arch/amd64/amd64/cpu.c 22 Sep 2022 04:36:37 -0000 1.161 +++ sys/arch/amd64/amd64/cpu.c 24 Jul 2023 16:51:52 -0000 @@ -1118,7 +1118,7 @@ void cpu_fix_msrs(struct cpu_info *ci) { int family = ci->ci_family; - uint64_t msr; + uint64_t msr, nmsr; if (!strcmp(cpu_vendor, "GenuineIntel")) { if ((family > 6 || (family == 6 && ci->ci_model >= 0xd)) && @@ -1161,11 +1161,17 @@ cpu_fix_msrs(struct cpu_info *ci) * where LFENCE is always serializing. */ if (family >= 0x10 && family != 0x11) { - msr = rdmsr(MSR_DE_CFG); - if ((msr & DE_CFG_SERIALIZE_LFENCE) == 0) { - msr |= DE_CFG_SERIALIZE_LFENCE; - wrmsr(MSR_DE_CFG, msr); - } + nmsr = msr = rdmsr(MSR_DE_CFG); + nmsr |= DE_CFG_SERIALIZE_LFENCE; + if (msr != nmsr) + wrmsr(MSR_DE_CFG, nmsr); + } + if (family == 0x17 && ci->ci_model >= 0x31) { + nmsr = msr = rdmsr(MSR_DE_CFG); +#define DE_CFG_SERIALIZE_9 (1 << 9) /* Zenbleed chickenbit */ + nmsr |= DE_CFG_SERIALIZE_9; + if (msr != nmsr) + wrmsr(MSR_DE_CFG, nmsr); } } }