> > is_copy_from_user() decodes the instruction that took the trap. It looks for > > MOV, MOVZ and MOVS instructions to find the source address, and then > > checks whether that's user (< TASK_SIZE_MAX) or kernel. > > You mean there's absolutely nothing else like, say, some epbf or some other > hackery we tend to do in the kernel (or we will do in the future) which won't > create the exact same two conditions: > > - one of the three insns > - user mem read > > and it would cause a recovery action. > > Perhaps it still might be the proper thing to do even then but it does sound > fishy and unclean to me. > > Nothing beats the explicit markup we had until recently... Every "user mem read" needs to have an extable[] recovery entry attached to the IP of the instruction (to handle the much more common #PF for page-not-present). All those places already have to deal with the possibility that the #PF can't be recovered. The #MC handling is really just a small extension. As for "explicit markup" I don't think it would be better to decorate every get_user() and copy_from_user() with some "this one can recover from #MC" Note also that "what we had recently" was fragile, broke, and resulted in this regression. -Tony