On Sat, 26 Feb 2022 14:00:48 +0800 Dongli Si <sidongli1997@xxxxxxxxx> wrote: Hi, > From: Dongli Si <sidongli1997@xxxxxxxxx> > > glibc detected invalid CPU Vendor name will cause an error: > > [ 0.450127] Run /sbin/init as init process > /lib64/libc.so.6: CPU ISA level is lower than required > [ 0.451931] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00 > [ 0.452117] CPU: 0 PID: 1 Comm: init Not tainted 5.17.0-rc1 #72 > > Signed-off-by: Dongli Si <sidongli1997@xxxxxxxxx> > --- > x86/cpuid.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/x86/cpuid.c b/x86/cpuid.c > index c3b67d9..d58a027 100644 > --- a/x86/cpuid.c > +++ b/x86/cpuid.c > @@ -2,6 +2,7 @@ > > #include "kvm/kvm.h" > #include "kvm/util.h" > +#include "kvm/cpufeature.h" > > #include <sys/ioctl.h> > #include <stdlib.h> > @@ -10,7 +11,7 @@ > > static void filter_cpuid(struct kvm_cpuid2 *kvm_cpuid) > { > - unsigned int signature[3]; > + struct cpuid_regs regs; > unsigned int i; > > /* > @@ -22,10 +23,13 @@ static void filter_cpuid(struct kvm_cpuid2 *kvm_cpuid) > switch (entry->function) { > case 0: > /* Vendor name */ > - memcpy(signature, "LKVMLKVMLKVM", 12); > - entry->ebx = signature[0]; > - entry->ecx = signature[1]; > - entry->edx = signature[2]; > + regs = (struct cpuid_regs) { > + .eax = 0x00, > + }; > + host_cpuid(®s); > + entry->ebx = regs.ebx; > + entry->ecx = regs.ecx; > + entry->edx = regs.edx; But that's redundant, isn't it? We already get the host vendor ID in the three registers in entry, and the current code is just there to overwrite this. So just removing the whole "case 0:" part should do the trick. Also please be aware that there was a reason for this fixup, as explained in commit bc0b99a2a740 ("kvm tools: Filter out CPU vendor string"). Alex, did you boot this on an AMD box, to spot if this is still an issue? Cheers, Andre > break; > case 1: > /* Set X86_FEATURE_HYPERVISOR */