__copy_from_user_inatomic() isn't NMI safe in that it can triggerthe page fault handler which is another trap and its return pathinvokes IRET which will also close the NMI context.

Therefore use a GUP based approach to copy the stack frames over.

We tried an alternative solution as well: we used a forward portedversion of Mathieu Desnoyers's "NMI safe INT3 and Page Fault" patchthat modifies the exception return path to use an open-coded IRET withexplicit stack unrolling and TF checking.

This didnt work as it interacted with faulting user-space instructions,causing them not to restart properly, which corrupts user-spaceregisters.

Solving that would probably involve disassembling those instructionsand backtracing the RIP. But even without that, the code was deemedrather complex to the already non-trivial x86 entry assembly code,so instead we went for this GUP based method that does asoftware-walk of the pagetables.