diff options
author | Christoph Hellwig <hch@lst.de> | 2021-12-15 17:56:12 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2021-12-22 17:56:56 +0100 |
commit | 8bb227ac34c062b466a0d5fd21f060010375880b (patch) | |
tree | aec5b756553198a4b1638eb798e59905c0a2df53 /arch/um/include | |
parent | ce72750f04d68a45ef971c3547fe2d6f9cd4756e (diff) |
um: remove set_fs
Remove address space overrides using set_fs() for User Mode Linux.
Note that just like the existing kernel access case of the uaccess
routines the new nofault kernel handlers do not actually have any
exception handling. This is probably broken, but not change to the
status quo.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/include')
-rw-r--r-- | arch/um/include/asm/thread_info.h | 4 | ||||
-rw-r--r-- | arch/um/include/asm/uaccess.h | 21 |
2 files changed, 19 insertions, 6 deletions
diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h index 3b1cb8b3b186..1395cbd7e340 100644 --- a/arch/um/include/asm/thread_info.h +++ b/arch/um/include/asm/thread_info.h @@ -22,9 +22,6 @@ struct thread_info { __u32 cpu; /* current CPU */ int preempt_count; /* 0 => preemptable, <0 => BUG */ - mm_segment_t addr_limit; /* thread address space: - 0-0xBFFFFFFF for user - 0-0xFFFFFFFF for kernel */ struct thread_info *real_thread; /* Points to non-IRQ stack */ unsigned long aux_fp_regs[FP_SIZE]; /* auxiliary fp_regs to save/restore them out-of-band */ @@ -36,7 +33,6 @@ struct thread_info { .flags = 0, \ .cpu = 0, \ .preempt_count = INIT_PREEMPT_COUNT, \ - .addr_limit = KERNEL_DS, \ .real_thread = NULL, \ } diff --git a/arch/um/include/asm/uaccess.h b/arch/um/include/asm/uaccess.h index 191ef36dd543..17d18cfd82a5 100644 --- a/arch/um/include/asm/uaccess.h +++ b/arch/um/include/asm/uaccess.h @@ -8,6 +8,7 @@ #define __UM_UACCESS_H #include <asm/elf.h> +#include <asm/unaligned.h> #define __under_task_size(addr, size) \ (((unsigned long) (addr) < TASK_SIZE) && \ @@ -39,8 +40,24 @@ static inline int __access_ok(unsigned long addr, unsigned long size) { return __addr_range_nowrap(addr, size) && (__under_task_size(addr, size) || - __access_ok_vsyscall(addr, size) || - uaccess_kernel()); + __access_ok_vsyscall(addr, size)); } +/* no pagefaults for kernel addresses in um */ +#define HAVE_GET_KERNEL_NOFAULT 1 + +#define __get_kernel_nofault(dst, src, type, err_label) \ +do { \ + *((type *)dst) = get_unaligned((type *)(src)); \ + if (0) /* make sure the label looks used to the compiler */ \ + goto err_label; \ +} while (0) + +#define __put_kernel_nofault(dst, src, type, err_label) \ +do { \ + put_unaligned(*((type *)src), (type *)(dst)); \ + if (0) /* make sure the label looks used to the compiler */ \ + goto err_label; \ +} while (0) + #endif |