Skip to content

Commit e8d444d

Browse files
Christoph Hellwigpalmer-dabbelt
authored andcommitted
riscv: remove address space overrides using set_fs()
Stop providing the possibility to override the address space using set_fs() now that there is no need for that any more. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
1 parent d464118 commit e8d444d

4 files changed

Lines changed: 1 addition & 34 deletions

File tree

arch/riscv/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ config RISCV
8787
select SPARSE_IRQ
8888
select SYSCTL_EXCEPTION_TRACE
8989
select THREAD_INFO_IN_TASK
90-
select SET_FS
9190
select UACCESS_MEMCPY if !MMU
9291

9392
config ARCH_MMAP_RND_BITS_MIN

arch/riscv/include/asm/thread_info.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
#include <asm/processor.h>
2525
#include <asm/csr.h>
2626

27-
typedef struct {
28-
unsigned long seg;
29-
} mm_segment_t;
30-
3127
/*
3228
* low level task data that entry.S needs immediate access to
3329
* - this struct should fit entirely inside of one cache line
@@ -39,7 +35,6 @@ typedef struct {
3935
struct thread_info {
4036
unsigned long flags; /* low level flags */
4137
int preempt_count; /* 0=>preemptible, <0=>BUG */
42-
mm_segment_t addr_limit;
4338
/*
4439
* These stack pointers are overwritten on every system call or
4540
* exception. SP is also saved to the stack it can be recovered when
@@ -59,7 +54,6 @@ struct thread_info {
5954
{ \
6055
.flags = 0, \
6156
.preempt_count = INIT_PREEMPT_COUNT, \
62-
.addr_limit = KERNEL_DS, \
6357
}
6458

6559
#endif /* !__ASSEMBLY__ */

arch/riscv/include/asm/uaccess.h

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,6 @@
2626
#define __disable_user_access() \
2727
__asm__ __volatile__ ("csrc sstatus, %0" : : "r" (SR_SUM) : "memory")
2828

29-
/*
30-
* The fs value determines whether argument validity checking should be
31-
* performed or not. If get_fs() == USER_DS, checking is performed, with
32-
* get_fs() == KERNEL_DS, checking is bypassed.
33-
*
34-
* For historical reasons, these macros are grossly misnamed.
35-
*/
36-
37-
#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
38-
39-
#define KERNEL_DS MAKE_MM_SEG(~0UL)
40-
#define USER_DS MAKE_MM_SEG(TASK_SIZE)
41-
42-
#define get_fs() (current_thread_info()->addr_limit)
43-
44-
static inline void set_fs(mm_segment_t fs)
45-
{
46-
current_thread_info()->addr_limit = fs;
47-
}
48-
49-
#define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg)
50-
#define user_addr_max() (get_fs().seg)
51-
5229
/**
5330
* access_ok: - Checks if a user space pointer is valid
5431
* @addr: User space pointer to start of block to check
@@ -76,9 +53,7 @@ static inline void set_fs(mm_segment_t fs)
7653
*/
7754
static inline int __access_ok(unsigned long addr, unsigned long size)
7855
{
79-
const mm_segment_t fs = get_fs();
80-
81-
return size <= fs.seg && addr <= fs.seg - size;
56+
return size <= TASK_SIZE && addr <= TASK_SIZE - size;
8257
}
8358

8459
/*

arch/riscv/kernel/process.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ void start_thread(struct pt_regs *regs, unsigned long pc,
8484
}
8585
regs->epc = pc;
8686
regs->sp = sp;
87-
set_fs(USER_DS);
8887
}
8988

9089
void flush_thread(void)

0 commit comments

Comments
 (0)