Re: [PATCH v2] x86: disable non-instrumented version of copy_mc when KMSAN is enabled
From: Linus Torvalds
Date: Wed Mar 06 2024 - 19:10:00 EST
On Wed, 6 Mar 2024 at 14:08, Tetsuo Handa
<penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:
>
> Something like below one?
I'd rather leave the regular fallbacks (to memcpy and copy_to_user())
alone, and I'd just put the
kmsan_memmove(dst, src, len - ret);
etc in the places that currently just call the MC copy functions.
The copy_mc_to_user() logic is already set up for that, since it has
to do the __uaccess_begin/end().
Changing copy_mc_to_kernel() to look visually the same would only
improve on this horror-show, I feel.
Obviously some kmsan person needs to validate your kmsan_memmove() thing, but
> Can we assume that 0 <= ret <= len is always true?
Yes. It had better be for other reasons.
Linus