Re: [PATCH 3/6] x86/sev-es: Use __put_user()/__get_user
From: 'Joerg Roedel' <joro@8bytes.org>
Date: 2021-05-12 08:37:44
Also in:
kvm, linux-coco, lkml, stable
From: 'Joerg Roedel' <joro@8bytes.org>
Date: 2021-05-12 08:37:44
Also in:
kvm, linux-coco, lkml, stable
On Wed, May 12, 2021 at 08:04:33AM +0000, David Laight wrote:
That can't be right at all. __put/get_user() are only valid on user addresses and will try to fault in a missing page - so can sleep.
Yes, in general these functions can sleep, but not in this context. They are called in atomic context and the page-fault handler will notice that and goes down the __bad_area_nosemaphore() path and only do the fixup. I also thought about adding page_fault_disable()/page_fault_enable() calls, but being in atomic context is enough according to the faulthandler_disabled() implementation. This is exactly what is needed here. All I want to know is whether a fault happened or not, the page-fault handler must not try to fix the fault in any way. If a fault happens it is later fixed up in vc_forward_exception().
At best this is abused the calls.
Yes, but that is only due to the naming of these functions. In this case they do exactly what is needed. Regards, Joerg _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization