Re: [PATCH v9 4/5] x86/cpuid: fix unbootable VMs by really inlining memcmp() in hypervisor_cpuid_base()
From: David Laight
Date: Tue Sep 15 2026 - 04:56:10 EST
On Mon, 14 Sep 2026 22:11:55 -0700
Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Mon, Sep 14, 2026 at 08:22:08AM -0300, Mauricio Faria de Oliveira wrote:
> > In the review of the original patchset (fixed by this series) it is
> > mentioned that a compiler might turn it into a memcmp() [1] -- and thus
> > revert back to the same issue.
> >
> > [1] https://lore.kernel.org/all/877ccz12ab.ffs@tglx/
>
> Hmm, never heard that before but that doesn't mean anything. Probably should
> mention it in one of the commit messages so that we know for the future...
>
It definitely has a habit of converting copy loops to memcpy().
Annoying when they are short.
But usually easily avoidable by sprinkling 'volatile' or barrier() in the
right places.
David