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

Shuai Xue
2025-03-07T05:47:50Z

在 2025/3/7 02:15, Luck, Tony 写道:
>> diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c
>> index dac4d64dfb2a..cb021058165f 100644
>> --- a/arch/x86/kernel/cpu/mce/severity.c
>> +++ b/arch/x86/kernel/cpu/mce/severity.c
>> @@ -300,13 +300,12 @@ static noinstr int error_context(struct mce *m, struct pt_regs *regs)
>> copy_user = is_copy_from_user(regs);
>> instrumentation_end();
>>
>> - switch (fixup_type) {
>> - case EX_TYPE_UACCESS:
>> - if (!copy_user)
>> - return IN_KERNEL;
>> - m->kflags |= MCE_IN_KERNEL_COPYIN;
>> - fallthrough;
>> + if (copy_user) {
>> + m->kflags |= MCE_IN_KERNEL_COPYIN | MCE_IN_KERNEL_COPYIN;
>
> You have " MCE_IN_KERNEL_COPYIN" twice here.

Sorry for this noise, please ignore this version,
I resend a new ready version, please see:
https://lore.kernel.org/linux-mm/20250307054404.73877-1-xueshuai@linux.alibaba.com/

Thanks
Shuai