Skip to content

Commit

Permalink
uaccess: move VERIFY_{READ,WRITE} definitions to linux/uaccess.h
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Mar 6, 2017
1 parent c1ae3cf commit 5e6039d
Show file tree
Hide file tree
Showing 31 changed files with 4 additions and 89 deletions.
3 changes: 0 additions & 3 deletions arch/alpha/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
#define KERNEL_DS ((mm_segment_t) { 0UL })
#define USER_DS ((mm_segment_t) { -0x40000000000UL })

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define get_fs() (current_thread_info()->addr_limit)
#define get_ds() (KERNEL_DS)
#define set_fs(x) (current_thread_info()->addr_limit = (x))
Expand Down
3 changes: 0 additions & 3 deletions arch/arm/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
#define __put_user_unaligned __put_user
#endif

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The exception table consists of pairs of addresses: the first is the
* address of an instruction that is allowed to fault, and the second is
Expand Down
3 changes: 0 additions & 3 deletions arch/arm64/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
#include <asm/memory.h>
#include <asm/compiler.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The exception table consists of pairs of relative offsets: the first
* is the relative offset to an instruction that is allowed to fault,
Expand Down
3 changes: 0 additions & 3 deletions arch/avr32/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#include <linux/errno.h>
#include <linux/sched.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

typedef struct {
unsigned int is_user_space;
} mm_segment_t;
Expand Down
3 changes: 0 additions & 3 deletions arch/blackfin/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ static inline void set_fs(mm_segment_t fs)

#define segment_eq(a, b) ((a) == (b))

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define access_ok(type, addr, size) _access_ok((unsigned long)(addr), (size))

/*
Expand Down
3 changes: 0 additions & 3 deletions arch/cris/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
#include <asm/processor.h>
#include <asm/page.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The fs value determines whether argument validity checking should be
* performed or not. If get_fs() == USER_DS, checking is performed, with
Expand Down
3 changes: 0 additions & 3 deletions arch/frv/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@

#define __ptr(x) ((unsigned long __force *)(x))

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* check that a range of addresses falls within the current address limit
*/
Expand Down
2 changes: 0 additions & 2 deletions arch/hexagon/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
* reasonably simple and not *too* slow. After all, we've got the
* MMU for backup.
*/
#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define __access_ok(addr, size) \
((get_fs().seg == KERNEL_DS.seg) || \
Expand Down
3 changes: 0 additions & 3 deletions arch/ia64/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
#define KERNEL_DS ((mm_segment_t) { ~0UL }) /* cf. access_ok() */
#define USER_DS ((mm_segment_t) { TASK_SIZE-1 }) /* cf. access_ok() */

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define get_ds() (KERNEL_DS)
#define get_fs() (current_thread_info()->addr_limit)
#define set_fs(x) (current_thread_info()->addr_limit = (x))
Expand Down
3 changes: 0 additions & 3 deletions arch/m32r/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
#include <asm/page.h>
#include <asm/setup.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The fs value determines whether argument validity checking should be
* performed or not. If get_fs() == USER_DS, checking is performed, with
Expand Down
3 changes: 0 additions & 3 deletions arch/m68k/include/asm/uaccess_mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#include <linux/sched.h>
#include <asm/segment.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/* We let the MMU do all checking */
static inline int access_ok(int type, const void __user *addr,
unsigned long size)
Expand Down
3 changes: 0 additions & 3 deletions arch/m68k/include/asm/uaccess_no.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

#include <asm/segment.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define access_ok(type,addr,size) _access_ok((unsigned long)(addr),(size))

/*
Expand Down
3 changes: 0 additions & 3 deletions arch/metag/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
*/
#include <linux/sched.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The fs value determines whether argument validity checking should be
* performed or not. If get_fs() == USER_DS, checking is performed, with
Expand Down
3 changes: 0 additions & 3 deletions arch/microblaze/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#include <asm/pgtable.h>
#include <linux/string.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* On Microblaze the fs value is actually the top of the corresponding
* address space.
Expand Down
3 changes: 0 additions & 3 deletions arch/mips/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ extern u64 __ua_limit;
#define USER_DS ((mm_segment_t) { __UA_LIMIT })
#endif

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define get_ds() (KERNEL_DS)
#define get_fs() (current_thread_info()->addr_limit)
#define set_fs(x) (current_thread_info()->addr_limit = (x))
Expand Down
3 changes: 0 additions & 3 deletions arch/mn10300/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
#include <asm/page.h>
#include <asm/errno.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The fs value determines whether argument validity checking should be
* performed or not. If get_fs() == USER_DS, checking is performed, with
Expand Down
3 changes: 0 additions & 3 deletions arch/nios2/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

#include <asm/page.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The exception table consists of pairs of addresses: the first is the
* address of an instruction that is allowed to fault, and the second is
Expand Down
3 changes: 0 additions & 3 deletions arch/openrisc/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
#include <linux/string.h>
#include <asm/page.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The fs value determines whether argument validity checking should be
* performed or not. If get_fs() == USER_DS, checking is performed, with
Expand Down
3 changes: 0 additions & 3 deletions arch/parisc/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
#include <linux/string.h>
#include <linux/thread_info.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define KERNEL_DS ((mm_segment_t){0})
#define USER_DS ((mm_segment_t){1})

Expand Down
3 changes: 0 additions & 3 deletions arch/powerpc/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#include <asm/processor.h>
#include <asm/page.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The fs value determines whether argument validity checking should be
* performed or not. If get_fs() == USER_DS, checking is performed, with
Expand Down
3 changes: 0 additions & 3 deletions arch/s390/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
#include <asm/processor.h>
#include <asm/ctl_reg.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1


/*
* The fs value determines whether argument validity checking should be
Expand Down
3 changes: 0 additions & 3 deletions arch/score/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
#include <linux/thread_info.h>
#include <asm/extable.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define get_ds() (KERNEL_DS)
#define get_fs() (current_thread_info()->addr_limit)
#define segment_eq(a, b) ((a).seg == (b).seg)
Expand Down
3 changes: 0 additions & 3 deletions arch/sh/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#include <linux/sched.h>
#include <asm/segment.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define __addr_ok(addr) \
((unsigned long __force)(addr) < current_thread_info()->addr_limit.seg)

Expand Down
3 changes: 0 additions & 3 deletions arch/sparc/include/asm/uaccess_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
#define KERNEL_DS ((mm_segment_t) { 0 })
#define USER_DS ((mm_segment_t) { -1 })

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define get_ds() (KERNEL_DS)
#define get_fs() (current->thread.current_ds)
#define set_fs(val) ((current->thread.current_ds) = (val))
Expand Down
3 changes: 0 additions & 3 deletions arch/sparc/include/asm/uaccess_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
#define KERNEL_DS ((mm_segment_t) { ASI_P })
#define USER_DS ((mm_segment_t) { ASI_AIUS }) /* har har har */

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define get_fs() ((mm_segment_t){(current_thread_info()->current_ds)})
#define get_ds() (KERNEL_DS)

Expand Down
3 changes: 0 additions & 3 deletions arch/tile/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#include <asm/processor.h>
#include <asm/page.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The fs value determines whether argument validity checking should be
* performed or not. If get_fs() == USER_DS, checking is performed, with
Expand Down
3 changes: 0 additions & 3 deletions arch/x86/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
#include <asm/smap.h>
#include <asm/extable.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

/*
* The fs value determines whether argument validity checking should be
* performed or not. If get_fs() == USER_DS, checking is performed, with
Expand Down
3 changes: 0 additions & 3 deletions arch/xtensa/include/asm/asm-uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
#include <linux/errno.h>
#include <asm/types.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#include <asm/current.h>
#include <asm/asm-offsets.h>
#include <asm/processor.h>
Expand Down
3 changes: 0 additions & 3 deletions arch/xtensa/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
#include <linux/prefetch.h>
#include <asm/types.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#include <linux/sched.h>

/*
Expand Down
3 changes: 0 additions & 3 deletions include/asm-generic/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ static inline void set_fs(mm_segment_t fs)
#define segment_eq(a, b) ((a).seg == (b).seg)
#endif

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#define access_ok(type, addr, size) __access_ok((unsigned long)(addr),(size))

/*
Expand Down
4 changes: 4 additions & 0 deletions include/linux/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#define __LINUX_UACCESS_H__

#include <linux/sched.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1

#include <asm/uaccess.h>

static __always_inline void pagefault_disabled_inc(void)
Expand Down

0 comments on commit 5e6039d

Please sign in to comment.