mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge branch 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull initial set_fs() removal from Al Viro:
"Christoph's set_fs base series + fixups"
* 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
fs: Allow a NULL pos pointer to __kernel_read
fs: Allow a NULL pos pointer to __kernel_write
powerpc: remove address space overrides using set_fs()
powerpc: use non-set_fs based maccess routines
x86: remove address space overrides using set_fs()
x86: make TASK_SIZE_MAX usable from assembly code
x86: move PAGE_OFFSET, TASK_SIZE & friends to page_{32,64}_types.h
lkdtm: remove set_fs-based tests
test_bitmap: remove user bitmap tests
uaccess: add infrastructure for kernel builds with set_fs()
fs: don't allow splice read/write without explicit ops
fs: don't allow kernel reads and writes without iter ops
sysctl: Convert to iter interfaces
proc: add a read_iter method to proc proc_ops
proc: cleanup the compat vs no compat file ops
proc: remove a level of indentation in proc_get_inode
This commit is contained in:
@@ -24,6 +24,9 @@ config KEXEC_ELF
|
||||
config HAVE_IMA_KEXEC
|
||||
bool
|
||||
|
||||
config SET_FS
|
||||
bool
|
||||
|
||||
config HOTPLUG_SMT
|
||||
bool
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ config ALPHA
|
||||
select OLD_SIGSUSPEND
|
||||
select CPU_NO_EFFICIENT_FFS if !ALPHA_EV67
|
||||
select MMU_GATHER_NO_RANGE
|
||||
select SET_FS
|
||||
help
|
||||
The Alpha is a 64-bit general-purpose processor designed and
|
||||
marketed by the Digital Equipment Corporation of blessed memory,
|
||||
|
||||
@@ -48,6 +48,7 @@ config ARC
|
||||
select PCI_SYSCALL if PCI
|
||||
select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING
|
||||
select HAVE_ARCH_JUMP_LABEL if ISA_ARCV2 && !CPU_ENDIAN_BE32
|
||||
select SET_FS
|
||||
|
||||
config ARCH_HAS_CACHE_LINE_SIZE
|
||||
def_bool y
|
||||
|
||||
@@ -120,6 +120,7 @@ config ARM
|
||||
select PCI_SYSCALL if PCI
|
||||
select PERF_USE_VMALLOC
|
||||
select RTC_LIB
|
||||
select SET_FS
|
||||
select SYS_SUPPORTS_APM_EMULATION
|
||||
# Above selects are sorted alphabetically; please add new ones
|
||||
# according to that. Thanks.
|
||||
|
||||
@@ -194,6 +194,7 @@ config ARM64
|
||||
select PCI_SYSCALL if PCI
|
||||
select POWER_RESET
|
||||
select POWER_SUPPLY
|
||||
select SET_FS
|
||||
select SPARSE_IRQ
|
||||
select SWIOTLB
|
||||
select SYSCTL_EXCEPTION_TRACE
|
||||
|
||||
@@ -22,6 +22,7 @@ config C6X
|
||||
select GENERIC_CLOCKEVENTS
|
||||
select MODULES_USE_ELF_RELA
|
||||
select MMU_GATHER_NO_RANGE if MMU
|
||||
select SET_FS
|
||||
|
||||
config MMU
|
||||
def_bool n
|
||||
|
||||
@@ -78,6 +78,7 @@ config CSKY
|
||||
select PCI_DOMAINS_GENERIC if PCI
|
||||
select PCI_SYSCALL if PCI
|
||||
select PCI_MSI if PCI
|
||||
select SET_FS
|
||||
|
||||
config LOCKDEP_SUPPORT
|
||||
def_bool y
|
||||
|
||||
@@ -25,6 +25,7 @@ config H8300
|
||||
select HAVE_ARCH_KGDB
|
||||
select HAVE_ARCH_HASH
|
||||
select CPU_NO_EFFICIENT_FFS
|
||||
select SET_FS
|
||||
select UACCESS_MEMCPY
|
||||
|
||||
config CPU_BIG_ENDIAN
|
||||
|
||||
@@ -31,6 +31,7 @@ config HEXAGON
|
||||
select GENERIC_CLOCKEVENTS_BROADCAST
|
||||
select MODULES_USE_ELF_RELA
|
||||
select GENERIC_CPU_DEVICES
|
||||
select SET_FS
|
||||
help
|
||||
Qualcomm Hexagon is a processor architecture designed for high
|
||||
performance and low power across a wide variety of applications.
|
||||
|
||||
@@ -56,6 +56,7 @@ config IA64
|
||||
select NEED_SG_DMA_LENGTH
|
||||
select NUMA if !FLATMEM
|
||||
select PCI_MSI_ARCH_FALLBACKS if PCI_MSI
|
||||
select SET_FS
|
||||
default y
|
||||
help
|
||||
The Itanium Processor Family is Intel's 64-bit successor to
|
||||
|
||||
@@ -31,6 +31,7 @@ config M68K
|
||||
select NO_DMA if !MMU && !COLDFIRE
|
||||
select OLD_SIGACTION
|
||||
select OLD_SIGSUSPEND3
|
||||
select SET_FS
|
||||
select UACCESS_MEMCPY if !MMU
|
||||
select VIRT_TO_BUS
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ config MICROBLAZE
|
||||
select CPU_NO_EFFICIENT_FFS
|
||||
select MMU_GATHER_NO_RANGE if MMU
|
||||
select SPARSE_IRQ
|
||||
select SET_FS
|
||||
|
||||
# Endianness selection
|
||||
choice
|
||||
|
||||
@@ -88,6 +88,7 @@ config MIPS
|
||||
select PERF_USE_VMALLOC
|
||||
select PCI_MSI_ARCH_FALLBACKS if PCI_MSI
|
||||
select RTC_LIB
|
||||
select SET_FS
|
||||
select SYSCTL_EXCEPTION_TRACE
|
||||
select VIRT_TO_BUS
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ config NDS32
|
||||
select HAVE_FUNCTION_GRAPH_TRACER
|
||||
select HAVE_FTRACE_MCOUNT_RECORD
|
||||
select HAVE_DYNAMIC_FTRACE
|
||||
select SET_FS
|
||||
help
|
||||
Andes(nds32) Linux support.
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ config NIOS2
|
||||
select USB_ARCH_HAS_HCD if USB_SUPPORT
|
||||
select CPU_NO_EFFICIENT_FFS
|
||||
select MMU_GATHER_NO_RANGE if MMU
|
||||
select SET_FS
|
||||
|
||||
config GENERIC_CSUM
|
||||
def_bool y
|
||||
|
||||
@@ -39,6 +39,7 @@ config OPENRISC
|
||||
select ARCH_WANT_FRAME_POINTERS
|
||||
select GENERIC_IRQ_MULTI_HANDLER
|
||||
select MMU_GATHER_NO_RANGE if MMU
|
||||
select SET_FS
|
||||
|
||||
config CPU_BIG_ENDIAN
|
||||
def_bool y
|
||||
|
||||
@@ -63,6 +63,7 @@ config PARISC
|
||||
select HAVE_FTRACE_MCOUNT_RECORD if HAVE_DYNAMIC_FTRACE
|
||||
select HAVE_KPROBES_ON_FTRACE
|
||||
select HAVE_DYNAMIC_FTRACE_WITH_REGS
|
||||
select SET_FS
|
||||
|
||||
help
|
||||
The PA-RISC microprocessor is designed by Hewlett-Packard and used
|
||||
|
||||
@@ -83,10 +83,6 @@ struct task_struct;
|
||||
void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp);
|
||||
void release_thread(struct task_struct *);
|
||||
|
||||
typedef struct {
|
||||
unsigned long seg;
|
||||
} mm_segment_t;
|
||||
|
||||
#define TS_FPR(i) fp_state.fpr[i][TS_FPROFFSET]
|
||||
#define TS_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET]
|
||||
|
||||
@@ -148,7 +144,6 @@ struct thread_struct {
|
||||
unsigned long ksp_vsid;
|
||||
#endif
|
||||
struct pt_regs *regs; /* Pointer to saved register state */
|
||||
mm_segment_t addr_limit; /* for get_fs() validation */
|
||||
#ifdef CONFIG_BOOKE
|
||||
/* BookE base exception scratch space; align on cacheline */
|
||||
unsigned long normsave[8] ____cacheline_aligned;
|
||||
@@ -296,7 +291,6 @@ struct thread_struct {
|
||||
#define INIT_THREAD { \
|
||||
.ksp = INIT_SP, \
|
||||
.ksp_limit = INIT_SP_LIMIT, \
|
||||
.addr_limit = KERNEL_DS, \
|
||||
.pgdir = swapper_pg_dir, \
|
||||
.fpexc_mode = MSR_FE0 | MSR_FE1, \
|
||||
SPEFSCR_INIT \
|
||||
@@ -304,7 +298,6 @@ struct thread_struct {
|
||||
#else
|
||||
#define INIT_THREAD { \
|
||||
.ksp = INIT_SP, \
|
||||
.addr_limit = KERNEL_DS, \
|
||||
.fpexc_mode = 0, \
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -90,7 +90,6 @@ void arch_setup_new_exec(void);
|
||||
#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
|
||||
#define TIF_SIGPENDING 1 /* signal pending */
|
||||
#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
|
||||
#define TIF_FSCHECK 3 /* Check FS is USER_DS on return */
|
||||
#define TIF_SYSCALL_EMU 4 /* syscall emulation active */
|
||||
#define TIF_RESTORE_TM 5 /* need to restore TM FP/VEC/VSX */
|
||||
#define TIF_PATCH_PENDING 6 /* pending live patching update */
|
||||
@@ -130,7 +129,6 @@ void arch_setup_new_exec(void);
|
||||
#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
|
||||
#define _TIF_EMULATE_STACK_STORE (1<<TIF_EMULATE_STACK_STORE)
|
||||
#define _TIF_NOHZ (1<<TIF_NOHZ)
|
||||
#define _TIF_FSCHECK (1<<TIF_FSCHECK)
|
||||
#define _TIF_SYSCALL_EMU (1<<TIF_SYSCALL_EMU)
|
||||
#define _TIF_SYSCALL_DOTRACE (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
|
||||
_TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT | \
|
||||
@@ -138,8 +136,7 @@ void arch_setup_new_exec(void);
|
||||
|
||||
#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
|
||||
_TIF_NOTIFY_RESUME | _TIF_UPROBE | \
|
||||
_TIF_RESTORE_TM | _TIF_PATCH_PENDING | \
|
||||
_TIF_FSCHECK)
|
||||
_TIF_RESTORE_TM | _TIF_PATCH_PENDING)
|
||||
#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR)
|
||||
|
||||
/* Bits in local_flags */
|
||||
|
||||
@@ -8,62 +8,21 @@
|
||||
#include <asm/extable.h>
|
||||
#include <asm/kup.h>
|
||||
|
||||
/*
|
||||
* The fs value determines whether argument validity checking should be
|
||||
* performed or not. If get_fs() == USER_DS, checking is performed, with
|
||||
* get_fs() == KERNEL_DS, checking is bypassed.
|
||||
*
|
||||
* For historical reasons, these macros are grossly misnamed.
|
||||
*
|
||||
* The fs/ds values are now the highest legal address in the "segment".
|
||||
* This simplifies the checking in the routines below.
|
||||
*/
|
||||
|
||||
#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
|
||||
|
||||
#define KERNEL_DS MAKE_MM_SEG(~0UL)
|
||||
#ifdef __powerpc64__
|
||||
/* We use TASK_SIZE_USER64 as TASK_SIZE is not constant */
|
||||
#define USER_DS MAKE_MM_SEG(TASK_SIZE_USER64 - 1)
|
||||
#define TASK_SIZE_MAX TASK_SIZE_USER64
|
||||
#else
|
||||
#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
|
||||
#define TASK_SIZE_MAX TASK_SIZE
|
||||
#endif
|
||||
|
||||
#define get_fs() (current->thread.addr_limit)
|
||||
|
||||
static inline void set_fs(mm_segment_t fs)
|
||||
static inline bool __access_ok(unsigned long addr, unsigned long size)
|
||||
{
|
||||
current->thread.addr_limit = fs;
|
||||
/* On user-mode return check addr_limit (fs) is correct */
|
||||
set_thread_flag(TIF_FSCHECK);
|
||||
return addr < TASK_SIZE_MAX && size <= TASK_SIZE_MAX - addr;
|
||||
}
|
||||
|
||||
#define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg)
|
||||
#define user_addr_max() (get_fs().seg)
|
||||
|
||||
#ifdef __powerpc64__
|
||||
/*
|
||||
* This check is sufficient because there is a large enough
|
||||
* gap between user addresses and the kernel addresses
|
||||
*/
|
||||
#define __access_ok(addr, size, segment) \
|
||||
(((addr) <= (segment).seg) && ((size) <= (segment).seg))
|
||||
|
||||
#else
|
||||
|
||||
static inline int __access_ok(unsigned long addr, unsigned long size,
|
||||
mm_segment_t seg)
|
||||
{
|
||||
if (addr > seg.seg)
|
||||
return 0;
|
||||
return (size == 0 || size - 1 <= seg.seg - addr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define access_ok(addr, size) \
|
||||
(__chk_user_ptr(addr), \
|
||||
__access_ok((__force unsigned long)(addr), (size), get_fs()))
|
||||
__access_ok((unsigned long)(addr), (size)))
|
||||
|
||||
/*
|
||||
* These are the main single-value transfer routines. They automatically
|
||||
@@ -604,4 +563,20 @@ do { \
|
||||
__put_user_goto(*(u8*)(_src + _i), (u8 __user *)(_dst + _i), e);\
|
||||
} while (0)
|
||||
|
||||
#define HAVE_GET_KERNEL_NOFAULT
|
||||
|
||||
#define __get_kernel_nofault(dst, src, type, err_label) \
|
||||
do { \
|
||||
int __kr_err; \
|
||||
\
|
||||
__get_user_size_allowed(*((type *)(dst)), (__force type __user *)(src),\
|
||||
sizeof(type), __kr_err); \
|
||||
if (unlikely(__kr_err)) \
|
||||
goto err_label; \
|
||||
} while (0)
|
||||
|
||||
#define __put_kernel_nofault(dst, src, type, err_label) \
|
||||
__put_user_size_goto(*((type *)(src)), \
|
||||
(__force type __user *)(dst), sizeof(type), err_label)
|
||||
|
||||
#endif /* _ARCH_POWERPC_UACCESS_H */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user