Re: [PATCH v1 3/3] x86: call instrumentation hooks from copy_mc.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 19 Mar 2024 at 09:37, Alexander Potapenko <glider@xxxxxxxxxx> wrote:
>
>         if (copy_mc_fragile_enabled) {
>                 __uaccess_begin();
> +               instrument_copy_to_user(dst, src, len);
>                 ret = copy_mc_fragile((__force void *)dst, src, len);
>                 __uaccess_end();

I'd actually prefer that instrument_copy_to_user() to be *outside* the
__uaccess_begin.

In fact, I'm a bit surprised that objtool didn't complain about it in that form.

__uaccess_begin() causes the CPU to accept kernel accesses to user
mode, and I don't think instrument_copy_to_user() has any business
actually touching user mode memory.

In fact it might be better to rename the function and change the prototype to

   instrument_src(src, len);

because you really can't sanely instrument the destination of a user
copy, but "instrument_src()" might be useful in other situations than
just user copies.

Hmm?

               Linus




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux