Skip to content
Snippets Groups Projects
Commit 5e6e9852 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro
Browse files

uaccess: add infrastructure for kernel builds with set_fs()


Add a CONFIG_SET_FS option that is selected by architecturess that
implement set_fs, which is all of them initially.  If the option is not
set stubs for routines related to overriding the address space are
provided so that architectures can start to opt out of providing set_fs.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 36e2c742
No related branches found
No related tags found
No related merge requests found
...@@ -71,6 +71,7 @@ config SUPERH ...@@ -71,6 +71,7 @@ config SUPERH
select PERF_EVENTS select PERF_EVENTS
select PERF_USE_VMALLOC select PERF_USE_VMALLOC
select RTC_LIB select RTC_LIB
select SET_FS
select SPARSE_IRQ select SPARSE_IRQ
help help
The SuperH is a RISC processor targeted for use in embedded systems The SuperH is a RISC processor targeted for use in embedded systems
......
...@@ -49,6 +49,7 @@ config SPARC ...@@ -49,6 +49,7 @@ config SPARC
select LOCKDEP_SMALL if LOCKDEP select LOCKDEP_SMALL if LOCKDEP
select NEED_DMA_MAP_STATE select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH select NEED_SG_DMA_LENGTH
select SET_FS
config SPARC32 config SPARC32
def_bool !64BIT def_bool !64BIT
......
...@@ -19,6 +19,7 @@ config UML ...@@ -19,6 +19,7 @@ config UML
select GENERIC_CPU_DEVICES select GENERIC_CPU_DEVICES
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select HAVE_GCC_PLUGINS select HAVE_GCC_PLUGINS
select SET_FS
select TTY # Needed for line.c select TTY # Needed for line.c
config MMU config MMU
......
...@@ -237,6 +237,7 @@ config X86 ...@@ -237,6 +237,7 @@ config X86
select HAVE_ARCH_KCSAN if X86_64 select HAVE_ARCH_KCSAN if X86_64
select X86_FEATURE_NAMES if PROC_FS select X86_FEATURE_NAMES if PROC_FS
select PROC_PID_ARCH_STATUS if PROC_FS select PROC_PID_ARCH_STATUS if PROC_FS
select SET_FS
imply IMA_SECURE_AND_OR_TRUSTED_BOOT if EFI imply IMA_SECURE_AND_OR_TRUSTED_BOOT if EFI
config INSTRUCTION_DECODER config INSTRUCTION_DECODER
......
...@@ -41,6 +41,7 @@ config XTENSA ...@@ -41,6 +41,7 @@ config XTENSA
select IRQ_DOMAIN select IRQ_DOMAIN
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
select PERF_USE_VMALLOC select PERF_USE_VMALLOC
select SET_FS
select VIRT_TO_BUS select VIRT_TO_BUS
help help
Xtensa processors are 32-bit RISC machines designed by Tensilica Xtensa processors are 32-bit RISC machines designed by Tensilica
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#ifdef CONFIG_SET_FS
/* /*
* Force the uaccess routines to be wired up for actual userspace access, * Force the uaccess routines to be wired up for actual userspace access,
* overriding any possible set_fs(KERNEL_DS) still lingering around. Undone * overriding any possible set_fs(KERNEL_DS) still lingering around. Undone
...@@ -25,6 +26,23 @@ static inline void force_uaccess_end(mm_segment_t oldfs) ...@@ -25,6 +26,23 @@ static inline void force_uaccess_end(mm_segment_t oldfs)
{ {
set_fs(oldfs); set_fs(oldfs);
} }
#else /* CONFIG_SET_FS */
typedef struct {
/* empty dummy */
} mm_segment_t;
#define uaccess_kernel() (false)
#define user_addr_max() (TASK_SIZE_MAX)
static inline mm_segment_t force_uaccess_begin(void)
{
return (mm_segment_t) { };
}
static inline void force_uaccess_end(mm_segment_t oldfs)
{
}
#endif /* CONFIG_SET_FS */
/* /*
* Architectures should provide two primitives (raw_copy_{to,from}_user()) * Architectures should provide two primitives (raw_copy_{to,from}_user())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment