[PATCH 2/9] ARM: traps: use get_kernel_nofault instead of set_fs()

Linus Walleij linus.walleij at linaro.org
Fri Nov 6 04:02:14 EST 2020


On Fri, Oct 30, 2020 at 4:49 PM Arnd Bergmann <arnd at kernel.org> wrote:

> From: Arnd Bergmann <arnd at arndb.de>
>
> ARM uses set_fs() and __get_user() to allow the stack dumping code to
> access possibly invalid pointers carefully. These can be changed to the
> simpler get_kernel_nofault(), and allow the eventual removal of set_fs().
>
> dump_instr() will print either kernel or user space pointers,
> depending on how it was called. For dump_mem(), I assume we are only
> interested in kernel pointers, and the only time that this is called
> with user_mode(regs)==true is when the regs themselves are unreliable
> as a result of the condition that caused the trap.
>
> Reviewed-by: Christoph Hellwig <hch at lst.de>
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>

Not to mention the drastically improved readability of the code,
as ARM developers no more needs to cross-reference the
x86 FS segment register to figure out what this might be
doing.

Reviewed-by: Linus Walleij <linus.walleij at linaro.org>

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list