Re: [PATCH RFC] Fixes to Linus' 'remove set_fs patch'

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

 



On Mon, Jul 5, 2021 at 4:20 PM Michael Schmitz <schmitzmic@xxxxxxxxx> wrote:

Linus' patch didn't compile out of the box. I'm a little
worried that I had to patch mm/maccess.c,

Yeah, that's not the right way to do it.

See the other thread where Christoph rightly points out that the
problem is that m68k needs __{get,put}_kernel_nofault() and then just
enable CONFIG_HAVE_GET_KERNEL_NOFAULT.

__{get,put}_kernel_nofault() is basically the similar to
__get_user/__put_user, except for

 (a) it uses kernel addresses (so in m68k parlance, "move" rather than "moves")

 (b) it uses the "goto err_label" approach instead of being an
expression that returns an error value

That (b) is what allows the use of "asm goto" to implement the
exception case much more efficiently (but you can avoid having to
convert to that model by just doing something like

        if (unlikely(__gu_err)) goto err_label;

inside the macro instead - even architectures that use the "asm goto"
do that for old compilers that don't support "asm goto" with output
values.

It shouldn't be too hard to implement on m68k - you'd likely want to
make the helper macros in <asm/uaccess.h> take that "MOVES" thing as a
new argument, so that you can generate code for the "move" vs "moves"
cases using the same helper macros, just with different arguments.

            Linus



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux