Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus

Pull MIPS fixes from Ralf Baechle:

 - Fix bitrot in __get_user_unaligned()
 - EVA userspace accessor bug fixes.
 - Fix for build issues with certain toolchains.
 - Fix build error for VDSO with particular toolchain versions.
 - Fix build error due to a variable that should have been removed by an
   earlier patch

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
  MIPS: Fix bitrot in __get_user_unaligned()
  MIPS: Fix build error due to unused variables.
  MIPS: VDSO: Fix build error
  MIPS: CPS: drop .set mips64r2 directives
  MIPS: uaccess: Take EVA into account in [__]clear_user
  MIPS: uaccess: Take EVA into account in __copy_from_user()
  MIPS: uaccess: Fix strlen_user with EVA
This commit is contained in:
Linus Torvalds 2015-12-27 18:12:21 -08:00
commit 3ae86f1a9f
8 changed files with 42 additions and 24 deletions

View File

@ -599,7 +599,7 @@ extern void __put_user_unknown(void);
* On error, the variable @x is set to zero. * On error, the variable @x is set to zero.
*/ */
#define __get_user_unaligned(x,ptr) \ #define __get_user_unaligned(x,ptr) \
__get_user__unalignednocheck((x),(ptr),sizeof(*(ptr))) __get_user_unaligned_nocheck((x),(ptr),sizeof(*(ptr)))
/* /*
* Yuck. We need two variants, one for 64bit operation and one * Yuck. We need two variants, one for 64bit operation and one
@ -620,8 +620,8 @@ extern void __get_user_unaligned_unknown(void);
do { \ do { \
switch (size) { \ switch (size) { \
case 1: __get_data_asm(val, "lb", ptr); break; \ case 1: __get_data_asm(val, "lb", ptr); break; \
case 2: __get_user_unaligned_asm(val, "ulh", ptr); break; \ case 2: __get_data_unaligned_asm(val, "ulh", ptr); break; \
case 4: __get_user_unaligned_asm(val, "ulw", ptr); break; \ case 4: __get_data_unaligned_asm(val, "ulw", ptr); break; \
case 8: __GET_USER_UNALIGNED_DW(val, ptr); break; \ case 8: __GET_USER_UNALIGNED_DW(val, ptr); break; \
default: __get_user_unaligned_unknown(); break; \ default: __get_user_unaligned_unknown(); break; \
} \ } \
@ -1122,9 +1122,15 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);
__cu_to = (to); \ __cu_to = (to); \
__cu_from = (from); \ __cu_from = (from); \
__cu_len = (n); \ __cu_len = (n); \
if (eva_kernel_access()) { \
__cu_len = __invoke_copy_from_kernel(__cu_to, \
__cu_from, \
__cu_len); \
} else { \
might_fault(); \ might_fault(); \
__cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \ __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
__cu_len); \ __cu_len); \
} \
__cu_len; \ __cu_len; \
}) })
@ -1229,6 +1235,17 @@ __clear_user(void __user *addr, __kernel_size_t size)
{ {
__kernel_size_t res; __kernel_size_t res;
if (eva_kernel_access()) {
__asm__ __volatile__(
"move\t$4, %1\n\t"
"move\t$5, $0\n\t"
"move\t$6, %2\n\t"
__MODULE_JAL(__bzero_kernel)
"move\t%0, $6"
: "=r" (res)
: "r" (addr), "r" (size)
: "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
} else {
might_fault(); might_fault();
__asm__ __volatile__( __asm__ __volatile__(
"move\t$4, %1\n\t" "move\t$4, %1\n\t"
@ -1239,6 +1256,7 @@ __clear_user(void __user *addr, __kernel_size_t size)
: "=r" (res) : "=r" (res)
: "r" (addr), "r" (size) : "r" (addr), "r" (size)
: "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"); : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
}
return res; return res;
} }
@ -1384,7 +1402,7 @@ static inline long strlen_user(const char __user *s)
might_fault(); might_fault();
__asm__ __volatile__( __asm__ __volatile__(
"move\t$4, %1\n\t" "move\t$4, %1\n\t"
__MODULE_JAL(__strlen_kernel_asm) __MODULE_JAL(__strlen_user_asm)
"move\t%0, $2" "move\t%0, $2"
: "=r" (res) : "=r" (res)
: "r" (s) : "r" (s)

View File

@ -257,7 +257,6 @@ LEAF(mips_cps_core_init)
has_mt t0, 3f has_mt t0, 3f
.set push .set push
.set mips64r2
.set mt .set mt
/* Only allow 1 TC per VPE to execute... */ /* Only allow 1 TC per VPE to execute... */
@ -376,7 +375,6 @@ LEAF(mips_cps_boot_vpes)
nop nop
.set push .set push
.set mips64r2
.set mt .set mt
1: /* Enter VPE configuration state */ 1: /* Enter VPE configuration state */

View File

@ -17,6 +17,7 @@
#include <asm/fpu.h> #include <asm/fpu.h>
#include <asm/msa.h> #include <asm/msa.h>
extern void *__bzero_kernel(void *__s, size_t __count);
extern void *__bzero(void *__s, size_t __count); extern void *__bzero(void *__s, size_t __count);
extern long __strncpy_from_kernel_nocheck_asm(char *__to, extern long __strncpy_from_kernel_nocheck_asm(char *__to,
const char *__from, long __len); const char *__from, long __len);
@ -64,6 +65,7 @@ EXPORT_SYMBOL(__copy_from_user_eva);
EXPORT_SYMBOL(__copy_in_user_eva); EXPORT_SYMBOL(__copy_in_user_eva);
EXPORT_SYMBOL(__copy_to_user_eva); EXPORT_SYMBOL(__copy_to_user_eva);
EXPORT_SYMBOL(__copy_user_inatomic_eva); EXPORT_SYMBOL(__copy_user_inatomic_eva);
EXPORT_SYMBOL(__bzero_kernel);
#endif #endif
EXPORT_SYMBOL(__bzero); EXPORT_SYMBOL(__bzero);
EXPORT_SYMBOL(__strncpy_from_kernel_nocheck_asm); EXPORT_SYMBOL(__strncpy_from_kernel_nocheck_asm);

View File

@ -283,6 +283,8 @@ LEAF(memset)
1: 1:
#ifndef CONFIG_EVA #ifndef CONFIG_EVA
FEXPORT(__bzero) FEXPORT(__bzero)
#else
FEXPORT(__bzero_kernel)
#endif #endif
__BUILD_BZERO LEGACY_MODE __BUILD_BZERO LEGACY_MODE

View File

@ -221,7 +221,6 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
static int rt288x_pci_probe(struct platform_device *pdev) static int rt288x_pci_probe(struct platform_device *pdev)
{ {
void __iomem *io_map_base; void __iomem *io_map_base;
int i;
rt2880_pci_base = ioremap_nocache(RT2880_PCI_BASE, PAGE_SIZE); rt2880_pci_base = ioremap_nocache(RT2880_PCI_BASE, PAGE_SIZE);

View File

@ -39,7 +39,6 @@ extern void msp_serial_setup(void);
void msp7120_reset(void) void msp7120_reset(void)
{ {
void *start, *end, *iptr; void *start, *end, *iptr;
register int i;
/* Diasble all interrupts */ /* Diasble all interrupts */
local_irq_disable(); local_irq_disable();

View File

@ -26,7 +26,7 @@ static inline void kb_wait(void)
/* XXX This ends up at the ARC firmware prompt ... */ /* XXX This ends up at the ARC firmware prompt ... */
void sni_machine_restart(char *command) void sni_machine_restart(char *command)
{ {
int i, j; int i;
/* This does a normal via the keyboard controller like a PC. /* This does a normal via the keyboard controller like a PC.
We can do that easier ... */ We can do that easier ... */

View File

@ -26,8 +26,8 @@ aflags-vdso := $(ccflags-vdso) \
# the comments on that file. # the comments on that file.
# #
ifndef CONFIG_CPU_MIPSR6 ifndef CONFIG_CPU_MIPSR6
ifeq ($(call ld-ifversion, -gt, 22400000, y),) ifeq ($(call ld-ifversion, -lt, 22500000, y),)
$(warning MIPS VDSO requires binutils > 2.24) $(warning MIPS VDSO requires binutils >= 2.25)
obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y)) obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y))
ccflags-vdso += -DDISABLE_MIPS_VDSO ccflags-vdso += -DDISABLE_MIPS_VDSO
endif endif