ls -l /proc/cpuinfo
It says (basically it is a pseudo-filesystem with read-only permission, so I don't think so it is possible without making any changes at the Linux kernel/driver level): -r--r--r-- 1 root root 0 Oct 28 09:38 /proc/cpuinfo ls -l /proc/cpuinfo
It says (basically it is a pseudo-filesystem with read-only permission, so I don't think so it is possible without making any changes at the Linux kernel/driver level): -r--r--r-- 1 root root 0 Oct 28 09:38 /proc/cpuinfoThe thing is, it has to get the information from somewhere -- and depending on the age/type of the hardware (physical or virtualized), masking this is either easy or nearly impossible
I remember changing this information (DMI?) was more common back in the like Pentium 3 era, for example.
I appreciate it everyone, save your fingers :)
I've seen this done for physical chips before too, but I can't recall anything - hence vagueness
Other systems do better by not depending on that.
You could even just modify the kernel to report arbitrary strings in /proc/cpuinfo.
So they use the CPUID instruction instead. The CPUID instruction can be trapped to throw a SIGSEGV instead of returning real values on x86 with arch_prctl(ARCH_SET_CPUID, 0). So an injected SIGSEGV handler could then spoof it.
But even then, you could also trap the CPUID instruction in the kernel, and spoof it from there, which would be even harder to detect from user space.
In the end, the benchmark program always needs to trust the kernel. Is it really worth trying to detect spoofing?