[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEbi=3fk9u9n5vcENFuSMkob81+hg2r2dd0oN2FfaqLg0eosSw@mail.gmail.com>
Date: Mon, 13 Jul 2020 18:06:42 +0800
From: Greentime Hu <green.hu@...il.com>
To: Christoph Hellwig <hch@....de>
Cc: Nick Hu <nickhu@...estech.com>, Vincent Chen <deanbo422@...il.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-riscv@...ts.infradead.org,
linux-arch <linux-arch@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 5/6] uaccess: add force_uaccess_{begin,end} helpers
Christoph Hellwig <hch@....de> 於 2020年7月10日 週五 下午9:57寫道:
>
> Add helpers to wraper the get_fs/set_fs magic for undoing any damange
> done by set_fs(KERNEL_DS). There is no real functional benefit, but this
> documents the intent of these calls better, and will allow stubbing the
> functions out easily for kernels builds that do not allow address space
> overrides in the future.
>
> Signed-off-by: Christoph Hellwig <hch@....de>
> ---
> arch/arm64/kernel/sdei.c | 2 +-
> arch/m68k/include/asm/tlbflush.h | 12 ++++++------
> arch/mips/kernel/unaligned.c | 27 +++++++++++++--------------
> arch/nds32/mm/alignment.c | 7 +++----
> arch/sh/kernel/traps_32.c | 18 ++++++++----------
> drivers/firmware/arm_sdei.c | 5 ++---
> include/linux/uaccess.h | 18 ++++++++++++++++++
> kernel/events/callchain.c | 5 ++---
> kernel/events/core.c | 5 ++---
> kernel/kthread.c | 5 ++---
> kernel/stacktrace.c | 5 ++---
> mm/maccess.c | 22 ++++++++++------------
> 12 files changed, 69 insertions(+), 62 deletions(-)
>
[...]
> diff --git a/arch/nds32/mm/alignment.c b/arch/nds32/mm/alignment.c
> index c8b9061a2ee3d5..1eb7ded6992b57 100644
> --- a/arch/nds32/mm/alignment.c
> +++ b/arch/nds32/mm/alignment.c
> @@ -512,7 +512,7 @@ int do_unaligned_access(unsigned long addr, struct pt_regs *regs)
> {
> unsigned long inst;
> int ret = -EFAULT;
> - mm_segment_t seg = get_fs();
> + mm_segment_t seg;
>
> inst = get_inst(regs->ipc);
>
> @@ -520,13 +520,12 @@ int do_unaligned_access(unsigned long addr, struct pt_regs *regs)
> "Faulting addr: 0x%08lx, pc: 0x%08lx [inst: 0x%08lx ]\n", addr,
> regs->ipc, inst);
>
> - set_fs(USER_DS);
> -
> + seg = force_uaccess_begin();
> if (inst & NDS32_16BIT_INSTRUCTION)
> ret = do_16((inst >> 16) & 0xffff, regs);
> else
> ret = do_32(inst, regs);
> - set_fs(seg);
> + force_uaccess_end(seg);
>
> return ret;
> }
Hi Christoph, Thank you.
Acked-by: Greentime Hu <green.hu@...il.com>
Powered by blists - more mailing lists