Re: [PATCH v4 1/3] x86/mce: Use is_copy_from_user() to determine copy-from-user context

From: Borislav Petkov
Date: Fri Mar 07 2025 - 17:47:23 EST


On Fri, Mar 07, 2025 at 10:05:12PM +0000, Luck, Tony wrote:
> 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...

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette