Re: [PATCH 2/9] ARM: traps: use get_kernel_nofault instead of set_fs()
From: Linus Walleij
Date: Fri Nov 06 2020 - 04:02:30 EST
On Fri, Oct 30, 2020 at 4:49 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> 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@xxxxxx>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
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@xxxxxxxxxx>
Yours,
Linus Walleij