Re: [PATCH v5 07/13] KVM: Just resync arch fields when slots_arch_lock gets reacquired

From: Maciej S. Szmigiero
Date: Wed Oct 20 2021 - 14:59:01 EST


On 20.10.2021 20:57, Sean Christopherson wrote:
On Wed, Oct 20, 2021, Maciej S. Szmigiero wrote:
On 20.10.2021 01:55, Sean Christopherson wrote:
On Mon, Sep 20, 2021, Maciej S. Szmigiero wrote:
This should probably be a memcpy(), I don't know what all shenanigans the compiler
can throw at us if it gets to copy a struct by value.

Normally, copy-assignment of a struct is a safe operation (this is purely
an internal kernel struct, so there are no worries about padding leakage
to the userspace), but can replace this with a memcpy().

I was more worried about the compiler using SIMD instructions. I assume the kernel
build process has lots of guards in place to prevent such shenanigans, but on the
other hand I _know_ mempcy() is safe :-)


So we will play safe and use mempcy() then :)

Thanks,
Maciej