Christoph Hellwig <h...@lst.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 <h...@lst.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...@gmail.com>