summaryrefslogtreecommitdiffstats
path: root/kernel/arch/x86/um
diff options
context:
space:
mode:
authorJosé Pekkarinen <jose.pekkarinen@nokia.com>2016-04-11 10:41:07 +0300
committerJosé Pekkarinen <jose.pekkarinen@nokia.com>2016-04-13 08:17:18 +0300
commite09b41010ba33a20a87472ee821fa407a5b8da36 (patch)
treed10dc367189862e7ca5c592f033dc3726e1df4e3 /kernel/arch/x86/um
parentf93b97fd65072de626c074dbe099a1fff05ce060 (diff)
These changes are the raw update to linux-4.4.6-rt14. Kernel sources
are taken from kernel.org, and rt patch from the rt wiki download page. During the rebasing, the following patch collided: Force tick interrupt and get rid of softirq magic(I70131fb85). Collisions have been removed because its logic was found on the source already. Change-Id: I7f57a4081d9deaa0d9ccfc41a6c8daccdee3b769 Signed-off-by: José Pekkarinen <jose.pekkarinen@nokia.com>
Diffstat (limited to 'kernel/arch/x86/um')
-rw-r--r--kernel/arch/x86/um/Makefile2
-rw-r--r--kernel/arch/x86/um/asm/barrier.h16
-rw-r--r--kernel/arch/x86/um/asm/checksum.h1
-rw-r--r--kernel/arch/x86/um/asm/elf.h2
-rw-r--r--kernel/arch/x86/um/asm/processor.h2
-rw-r--r--kernel/arch/x86/um/asm/segment.h8
-rw-r--r--kernel/arch/x86/um/asm/syscall.h4
-rw-r--r--kernel/arch/x86/um/ldt.c6
-rw-r--r--kernel/arch/x86/um/mem_32.c3
-rw-r--r--kernel/arch/x86/um/mem_64.c3
-rw-r--r--kernel/arch/x86/um/ptrace_32.c1
-rw-r--r--kernel/arch/x86/um/ptrace_64.c1
-rw-r--r--kernel/arch/x86/um/shared/sysdep/tls.h6
-rw-r--r--kernel/arch/x86/um/signal.c21
-rw-r--r--kernel/arch/x86/um/stub_32.S1
-rw-r--r--kernel/arch/x86/um/stub_64.S18
-rw-r--r--kernel/arch/x86/um/sys_call_table_32.c7
-rw-r--r--kernel/arch/x86/um/sys_call_table_64.c7
-rw-r--r--kernel/arch/x86/um/syscalls_64.c1
-rw-r--r--kernel/arch/x86/um/tls_32.c1
-rw-r--r--kernel/arch/x86/um/tls_64.c1
-rw-r--r--kernel/arch/x86/um/vdso/vma.c1
22 files changed, 53 insertions, 60 deletions
diff --git a/kernel/arch/x86/um/Makefile b/kernel/arch/x86/um/Makefile
index acb384d24..a8fecc226 100644
--- a/kernel/arch/x86/um/Makefile
+++ b/kernel/arch/x86/um/Makefile
@@ -26,7 +26,7 @@ else
obj-y += syscalls_64.o vdso/
-subarch-y = ../lib/csum-partial_64.o ../lib/memcpy_64.o ../lib/thunk_64.o \
+subarch-y = ../lib/csum-partial_64.o ../lib/memcpy_64.o ../entry/thunk_64.o \
../lib/rwsem.o
endif
diff --git a/kernel/arch/x86/um/asm/barrier.h b/kernel/arch/x86/um/asm/barrier.h
index 7e8a1a650..755481f14 100644
--- a/kernel/arch/x86/um/asm/barrier.h
+++ b/kernel/arch/x86/um/asm/barrier.h
@@ -39,22 +39,10 @@
#define smp_mb() barrier()
#define smp_rmb() barrier()
#define smp_wmb() barrier()
-#define set_mb(var, value) do { var = value; barrier(); } while (0)
+
+#define smp_store_mb(var, value) do { WRITE_ONCE(var, value); barrier(); } while (0)
#define read_barrier_depends() do { } while (0)
#define smp_read_barrier_depends() do { } while (0)
-/*
- * Stop RDTSC speculation. This is needed when you need to use RDTSC
- * (or get_cycles or vread that possibly accesses the TSC) in a defined
- * code region.
- *
- * (Could use an alternative three way for this if there was one.)
- */
-static inline void rdtsc_barrier(void)
-{
- alternative_2("", "mfence", X86_FEATURE_MFENCE_RDTSC,
- "lfence", X86_FEATURE_LFENCE_RDTSC);
-}
-
#endif
diff --git a/kernel/arch/x86/um/asm/checksum.h b/kernel/arch/x86/um/asm/checksum.h
index 4b181b744..ee940185e 100644
--- a/kernel/arch/x86/um/asm/checksum.h
+++ b/kernel/arch/x86/um/asm/checksum.h
@@ -3,6 +3,7 @@
#include <linux/string.h>
#include <linux/in6.h>
+#include <linux/uaccess.h>
/*
* computes the checksum of a memory block at buff, length len,
diff --git a/kernel/arch/x86/um/asm/elf.h b/kernel/arch/x86/um/asm/elf.h
index 0a656b727..548197212 100644
--- a/kernel/arch/x86/um/asm/elf.h
+++ b/kernel/arch/x86/um/asm/elf.h
@@ -200,8 +200,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef struct user_i387_struct elf_fpregset_t;
-#define task_pt_regs(t) (&(t)->thread.regs)
-
struct task_struct;
extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
diff --git a/kernel/arch/x86/um/asm/processor.h b/kernel/arch/x86/um/asm/processor.h
index 2a206d2b1..233ee09c1 100644
--- a/kernel/arch/x86/um/asm/processor.h
+++ b/kernel/arch/x86/um/asm/processor.h
@@ -28,6 +28,8 @@ static inline void rep_nop(void)
#define cpu_relax() rep_nop()
#define cpu_relax_lowlatency() cpu_relax()
+#define task_pt_regs(t) (&(t)->thread.regs)
+
#include <asm/processor-generic.h>
#endif
diff --git a/kernel/arch/x86/um/asm/segment.h b/kernel/arch/x86/um/asm/segment.h
index 45183fcd1..41dd5e1f3 100644
--- a/kernel/arch/x86/um/asm/segment.h
+++ b/kernel/arch/x86/um/asm/segment.h
@@ -7,4 +7,12 @@ extern int host_gdt_entry_tls_min;
#define GDT_ENTRY_TLS_MIN host_gdt_entry_tls_min
#define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1)
+typedef struct {
+ unsigned long seg;
+} mm_segment_t;
+
+#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
+#define KERNEL_DS MAKE_MM_SEG(~0UL)
+#define USER_DS MAKE_MM_SEG(TASK_SIZE)
+
#endif
diff --git a/kernel/arch/x86/um/asm/syscall.h b/kernel/arch/x86/um/asm/syscall.h
index 9fe77b7b5..81d6562ce 100644
--- a/kernel/arch/x86/um/asm/syscall.h
+++ b/kernel/arch/x86/um/asm/syscall.h
@@ -3,6 +3,10 @@
#include <uapi/linux/audit.h>
+typedef asmlinkage long (*sys_call_ptr_t)(unsigned long, unsigned long,
+ unsigned long, unsigned long,
+ unsigned long, unsigned long);
+
static inline int syscall_get_arch(void)
{
#ifdef CONFIG_X86_32
diff --git a/kernel/arch/x86/um/ldt.c b/kernel/arch/x86/um/ldt.c
index 5c0b711d2..836a1eb5d 100644
--- a/kernel/arch/x86/um/ldt.c
+++ b/kernel/arch/x86/um/ldt.c
@@ -6,12 +6,16 @@
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/slab.h>
+#include <linux/uaccess.h>
#include <asm/unistd.h>
#include <os.h>
#include <skas.h>
#include <sysdep/tls.h>
-extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
+static inline int modify_ldt (int func, void *ptr, unsigned long bytecount)
+{
+ return syscall(__NR_modify_ldt, func, ptr, bytecount);
+}
static long write_ldt_entry(struct mm_id *mm_idp, int func,
struct user_desc *desc, void **addr, int done)
diff --git a/kernel/arch/x86/um/mem_32.c b/kernel/arch/x86/um/mem_32.c
index f40281e5d..744afdc18 100644
--- a/kernel/arch/x86/um/mem_32.c
+++ b/kernel/arch/x86/um/mem_32.c
@@ -7,8 +7,7 @@
*/
#include <linux/mm.h>
-#include <asm/page.h>
-#include <asm/mman.h>
+#include <asm/elf.h>
static struct vm_area_struct gate_vma;
diff --git a/kernel/arch/x86/um/mem_64.c b/kernel/arch/x86/um/mem_64.c
index f8fecaddc..7642e2e2a 100644
--- a/kernel/arch/x86/um/mem_64.c
+++ b/kernel/arch/x86/um/mem_64.c
@@ -1,6 +1,5 @@
#include <linux/mm.h>
-#include <asm/page.h>
-#include <asm/mman.h>
+#include <asm/elf.h>
const char *arch_vma_name(struct vm_area_struct *vma)
{
diff --git a/kernel/arch/x86/um/ptrace_32.c b/kernel/arch/x86/um/ptrace_32.c
index ce3dd4f36..a29756f2d 100644
--- a/kernel/arch/x86/um/ptrace_32.c
+++ b/kernel/arch/x86/um/ptrace_32.c
@@ -6,6 +6,7 @@
#include <linux/mm.h>
#include <linux/sched.h>
#include <asm/uaccess.h>
+#include <asm/ptrace-abi.h>
#include <skas.h>
extern int arch_switch_tls(struct task_struct *to);
diff --git a/kernel/arch/x86/um/ptrace_64.c b/kernel/arch/x86/um/ptrace_64.c
index 3b52bf0b4..a629694ee 100644
--- a/kernel/arch/x86/um/ptrace_64.c
+++ b/kernel/arch/x86/um/ptrace_64.c
@@ -11,6 +11,7 @@
#define __FRAME_OFFSETS
#include <asm/ptrace.h>
#include <asm/uaccess.h>
+#include <asm/ptrace-abi.h>
/*
* determines which flags the user has access to.
diff --git a/kernel/arch/x86/um/shared/sysdep/tls.h b/kernel/arch/x86/um/shared/sysdep/tls.h
index 27cce00c6..a682db13d 100644
--- a/kernel/arch/x86/um/shared/sysdep/tls.h
+++ b/kernel/arch/x86/um/shared/sysdep/tls.h
@@ -1,7 +1,7 @@
#ifndef _SYSDEP_TLS_H
#define _SYSDEP_TLS_H
-# ifndef __KERNEL__
+#ifdef __UM_HOST__
/* Change name to avoid conflicts with the original one from <asm/ldt.h>, which
* may be named user_desc (but in 2.4 and in header matching its API was named
@@ -22,11 +22,11 @@ typedef struct um_dup_user_desc {
#endif
} user_desc_t;
-# else /* __KERNEL__ */
+#else /* __UM_HOST__ */
typedef struct user_desc user_desc_t;
-# endif /* __KERNEL__ */
+#endif /* __UM_HOST__ */
extern int os_set_thread_area(user_desc_t *info, int pid);
extern int os_get_thread_area(user_desc_t *info, int pid);
diff --git a/kernel/arch/x86/um/signal.c b/kernel/arch/x86/um/signal.c
index 592491d1d..14fcd01ed 100644
--- a/kernel/arch/x86/um/signal.c
+++ b/kernel/arch/x86/um/signal.c
@@ -211,7 +211,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
if (err)
return 1;
- err = convert_fxsr_from_user(&fpx, sc.fpstate);
+ err = convert_fxsr_from_user(&fpx, (void *)sc.fpstate);
if (err)
return 1;
@@ -227,7 +227,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
{
struct user_i387_struct fp;
- err = copy_from_user(&fp, sc.fpstate,
+ err = copy_from_user(&fp, (void *)sc.fpstate,
sizeof(struct user_i387_struct));
if (err)
return 1;
@@ -291,7 +291,7 @@ static int copy_sc_to_user(struct sigcontext __user *to,
#endif
#undef PUTREG
sc.oldmask = mask;
- sc.fpstate = to_fp;
+ sc.fpstate = (unsigned long)to_fp;
err = copy_to_user(to, &sc, sizeof(struct sigcontext));
if (err)
@@ -468,12 +468,10 @@ long sys_sigreturn(void)
struct sigframe __user *frame = (struct sigframe __user *)(sp - 8);
sigset_t set;
struct sigcontext __user *sc = &frame->sc;
- unsigned long __user *oldmask = &sc->oldmask;
- unsigned long __user *extramask = frame->extramask;
int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long);
- if (copy_from_user(&set.sig[0], oldmask, sizeof(set.sig[0])) ||
- copy_from_user(&set.sig[1], extramask, sig_size))
+ if (copy_from_user(&set.sig[0], &sc->oldmask, sizeof(set.sig[0])) ||
+ copy_from_user(&set.sig[1], frame->extramask, sig_size))
goto segfault;
set_current_blocked(&set);
@@ -505,6 +503,7 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
{
struct rt_sigframe __user *frame;
int err = 0, sig = ksig->sig;
+ unsigned long fp_to;
frame = (struct rt_sigframe __user *)
round_down(stack_top - sizeof(struct rt_sigframe), 16);
@@ -526,7 +525,10 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
err |= __save_altstack(&frame->uc.uc_stack, PT_REGS_SP(regs));
err |= copy_sc_to_user(&frame->uc.uc_mcontext, &frame->fpstate, regs,
set->sig[0]);
- err |= __put_user(&frame->fpstate, &frame->uc.uc_mcontext.fpstate);
+
+ fp_to = (unsigned long)&frame->fpstate;
+
+ err |= __put_user(fp_to, &frame->uc.uc_mcontext.fpstate);
if (sizeof(*set) == 16) {
err |= __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
err |= __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
@@ -541,7 +543,8 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
*/
/* x86-64 should always use SA_RESTORER. */
if (ksig->ka.sa.sa_flags & SA_RESTORER)
- err |= __put_user(ksig->ka.sa.sa_restorer, &frame->pretcode);
+ err |= __put_user((void *)ksig->ka.sa.sa_restorer,
+ &frame->pretcode);
else
/* could use a vstub here */
return err;
diff --git a/kernel/arch/x86/um/stub_32.S b/kernel/arch/x86/um/stub_32.S
index b972649d3..98816804e 100644
--- a/kernel/arch/x86/um/stub_32.S
+++ b/kernel/arch/x86/um/stub_32.S
@@ -1,6 +1,5 @@
#include <as-layout.h>
- .globl syscall_stub
.section .__syscall_stub, "ax"
.globl batch_syscall_stub
diff --git a/kernel/arch/x86/um/stub_64.S b/kernel/arch/x86/um/stub_64.S
index 7160b2017..ba914b3b8 100644
--- a/kernel/arch/x86/um/stub_64.S
+++ b/kernel/arch/x86/um/stub_64.S
@@ -1,25 +1,9 @@
#include <as-layout.h>
- .globl syscall_stub
.section .__syscall_stub, "ax"
-syscall_stub:
- syscall
- /* We don't have 64-bit constants, so this constructs the address
- * we need.
- */
- movq $(STUB_DATA >> 32), %rbx
- salq $32, %rbx
- movq $(STUB_DATA & 0xffffffff), %rcx
- or %rcx, %rbx
- movq %rax, (%rbx)
- int3
-
.globl batch_syscall_stub
batch_syscall_stub:
- mov $(STUB_DATA >> 32), %rbx
- sal $32, %rbx
- mov $(STUB_DATA & 0xffffffff), %rax
- or %rax, %rbx
+ mov $(STUB_DATA), %rbx
/* load pointer to first operation */
mov %rbx, %rsp
add $0x10, %rsp
diff --git a/kernel/arch/x86/um/sys_call_table_32.c b/kernel/arch/x86/um/sys_call_table_32.c
index bd16d6c37..439c0994b 100644
--- a/kernel/arch/x86/um/sys_call_table_32.c
+++ b/kernel/arch/x86/um/sys_call_table_32.c
@@ -7,6 +7,7 @@
#include <linux/sys.h>
#include <linux/cache.h>
#include <generated/user_constants.h>
+#include <asm/syscall.h>
#define __NO_STUBS
@@ -24,15 +25,13 @@
#define old_mmap sys_old_mmap
-#define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void sym(void) ;
+#define __SYSCALL_I386(nr, sym, compat) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ;
#include <asm/syscalls_32.h>
#undef __SYSCALL_I386
#define __SYSCALL_I386(nr, sym, compat) [ nr ] = sym,
-typedef asmlinkage void (*sys_call_ptr_t)(void);
-
-extern asmlinkage void sys_ni_syscall(void);
+extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = {
/*
diff --git a/kernel/arch/x86/um/sys_call_table_64.c b/kernel/arch/x86/um/sys_call_table_64.c
index a75d87004..b74ea6c2c 100644
--- a/kernel/arch/x86/um/sys_call_table_64.c
+++ b/kernel/arch/x86/um/sys_call_table_64.c
@@ -7,6 +7,7 @@
#include <linux/sys.h>
#include <linux/cache.h>
#include <generated/user_constants.h>
+#include <asm/syscall.h>
#define __NO_STUBS
@@ -37,15 +38,13 @@
#define __SYSCALL_COMMON(nr, sym, compat) __SYSCALL_64(nr, sym, compat)
#define __SYSCALL_X32(nr, sym, compat) /* Not supported */
-#define __SYSCALL_64(nr, sym, compat) extern asmlinkage void sym(void) ;
+#define __SYSCALL_64(nr, sym, compat) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ;
#include <asm/syscalls_64.h>
#undef __SYSCALL_64
#define __SYSCALL_64(nr, sym, compat) [ nr ] = sym,
-typedef void (*sys_call_ptr_t)(void);
-
-extern void sys_ni_syscall(void);
+extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = {
/*
diff --git a/kernel/arch/x86/um/syscalls_64.c b/kernel/arch/x86/um/syscalls_64.c
index adb08eb5c..e65522753 100644
--- a/kernel/arch/x86/um/syscalls_64.c
+++ b/kernel/arch/x86/um/syscalls_64.c
@@ -6,6 +6,7 @@
*/
#include <linux/sched.h>
+#include <linux/uaccess.h>
#include <asm/prctl.h> /* XXX This should get the constants from libc */
#include <os.h>
diff --git a/kernel/arch/x86/um/tls_32.c b/kernel/arch/x86/um/tls_32.c
index 80ffa5b99..48e38584d 100644
--- a/kernel/arch/x86/um/tls_32.c
+++ b/kernel/arch/x86/um/tls_32.c
@@ -7,6 +7,7 @@
#include <linux/sched.h>
#include <linux/syscalls.h>
#include <asm/uaccess.h>
+#include <asm/ptrace-abi.h>
#include <os.h>
#include <skas.h>
#include <sysdep/tls.h>
diff --git a/kernel/arch/x86/um/tls_64.c b/kernel/arch/x86/um/tls_64.c
index d22363cb8..3ad714373 100644
--- a/kernel/arch/x86/um/tls_64.c
+++ b/kernel/arch/x86/um/tls_64.c
@@ -1,4 +1,5 @@
#include <linux/sched.h>
+#include <asm/ptrace-abi.h>
void clear_flushed_tls(struct task_struct *task)
{
diff --git a/kernel/arch/x86/um/vdso/vma.c b/kernel/arch/x86/um/vdso/vma.c
index 916cda4cd..237c6831e 100644
--- a/kernel/arch/x86/um/vdso/vma.c
+++ b/kernel/arch/x86/um/vdso/vma.c
@@ -10,6 +10,7 @@
#include <linux/sched.h>
#include <linux/mm.h>
#include <asm/page.h>
+#include <asm/elf.h>
#include <linux/init.h>
static unsigned int __read_mostly vdso_enabled = 1;