Skip to content

Commit 3ae86f1

Browse files
committed
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
2 parents db06650 + 930c0f7 commit 3ae86f1

File tree

8 files changed

+42
-24
lines changed

8 files changed

+42
-24
lines changed

arch/mips/include/asm/uaccess.h

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ extern void __put_user_unknown(void);
599599
* On error, the variable @x is set to zero.
600600
*/
601601
#define __get_user_unaligned(x,ptr) \
602-
__get_user__unalignednocheck((x),(ptr),sizeof(*(ptr)))
602+
__get_user_unaligned_nocheck((x),(ptr),sizeof(*(ptr)))
603603

604604
/*
605605
* Yuck. We need two variants, one for 64bit operation and one
@@ -620,8 +620,8 @@ extern void __get_user_unaligned_unknown(void);
620620
do { \
621621
switch (size) { \
622622
case 1: __get_data_asm(val, "lb", ptr); break; \
623-
case 2: __get_user_unaligned_asm(val, "ulh", ptr); break; \
624-
case 4: __get_user_unaligned_asm(val, "ulw", ptr); break; \
623+
case 2: __get_data_unaligned_asm(val, "ulh", ptr); break; \
624+
case 4: __get_data_unaligned_asm(val, "ulw", ptr); break; \
625625
case 8: __GET_USER_UNALIGNED_DW(val, ptr); break; \
626626
default: __get_user_unaligned_unknown(); break; \
627627
} \
@@ -1122,9 +1122,15 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);
11221122
__cu_to = (to); \
11231123
__cu_from = (from); \
11241124
__cu_len = (n); \
1125-
might_fault(); \
1126-
__cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
1127-
__cu_len); \
1125+
if (eva_kernel_access()) { \
1126+
__cu_len = __invoke_copy_from_kernel(__cu_to, \
1127+
__cu_from, \
1128+
__cu_len); \
1129+
} else { \
1130+
might_fault(); \
1131+
__cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
1132+
__cu_len); \
1133+
} \
11281134
__cu_len; \
11291135
})
11301136

@@ -1229,16 +1235,28 @@ __clear_user(void __user *addr, __kernel_size_t size)
12291235
{
12301236
__kernel_size_t res;
12311237

1232-
might_fault();
1233-
__asm__ __volatile__(
1234-
"move\t$4, %1\n\t"
1235-
"move\t$5, $0\n\t"
1236-
"move\t$6, %2\n\t"
1237-
__MODULE_JAL(__bzero)
1238-
"move\t%0, $6"
1239-
: "=r" (res)
1240-
: "r" (addr), "r" (size)
1241-
: "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
1238+
if (eva_kernel_access()) {
1239+
__asm__ __volatile__(
1240+
"move\t$4, %1\n\t"
1241+
"move\t$5, $0\n\t"
1242+
"move\t$6, %2\n\t"
1243+
__MODULE_JAL(__bzero_kernel)
1244+
"move\t%0, $6"
1245+
: "=r" (res)
1246+
: "r" (addr), "r" (size)
1247+
: "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
1248+
} else {
1249+
might_fault();
1250+
__asm__ __volatile__(
1251+
"move\t$4, %1\n\t"
1252+
"move\t$5, $0\n\t"
1253+
"move\t$6, %2\n\t"
1254+
__MODULE_JAL(__bzero)
1255+
"move\t%0, $6"
1256+
: "=r" (res)
1257+
: "r" (addr), "r" (size)
1258+
: "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
1259+
}
12421260

12431261
return res;
12441262
}
@@ -1384,7 +1402,7 @@ static inline long strlen_user(const char __user *s)
13841402
might_fault();
13851403
__asm__ __volatile__(
13861404
"move\t$4, %1\n\t"
1387-
__MODULE_JAL(__strlen_kernel_asm)
1405+
__MODULE_JAL(__strlen_user_asm)
13881406
"move\t%0, $2"
13891407
: "=r" (res)
13901408
: "r" (s)

arch/mips/kernel/cps-vec.S

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ LEAF(mips_cps_core_init)
257257
has_mt t0, 3f
258258

259259
.set push
260-
.set mips64r2
261260
.set mt
262261

263262
/* Only allow 1 TC per VPE to execute... */
@@ -376,7 +375,6 @@ LEAF(mips_cps_boot_vpes)
376375
nop
377376

378377
.set push
379-
.set mips64r2
380378
.set mt
381379

382380
1: /* Enter VPE configuration state */

arch/mips/kernel/mips_ksyms.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <asm/fpu.h>
1818
#include <asm/msa.h>
1919

20+
extern void *__bzero_kernel(void *__s, size_t __count);
2021
extern void *__bzero(void *__s, size_t __count);
2122
extern long __strncpy_from_kernel_nocheck_asm(char *__to,
2223
const char *__from, long __len);
@@ -64,6 +65,7 @@ EXPORT_SYMBOL(__copy_from_user_eva);
6465
EXPORT_SYMBOL(__copy_in_user_eva);
6566
EXPORT_SYMBOL(__copy_to_user_eva);
6667
EXPORT_SYMBOL(__copy_user_inatomic_eva);
68+
EXPORT_SYMBOL(__bzero_kernel);
6769
#endif
6870
EXPORT_SYMBOL(__bzero);
6971
EXPORT_SYMBOL(__strncpy_from_kernel_nocheck_asm);

arch/mips/lib/memset.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ LEAF(memset)
283283
1:
284284
#ifndef CONFIG_EVA
285285
FEXPORT(__bzero)
286+
#else
287+
FEXPORT(__bzero_kernel)
286288
#endif
287289
__BUILD_BZERO LEGACY_MODE
288290

arch/mips/pci/pci-rt2880.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
221221
static int rt288x_pci_probe(struct platform_device *pdev)
222222
{
223223
void __iomem *io_map_base;
224-
int i;
225224

226225
rt2880_pci_base = ioremap_nocache(RT2880_PCI_BASE, PAGE_SIZE);
227226

arch/mips/pmcs-msp71xx/msp_setup.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ extern void msp_serial_setup(void);
3939
void msp7120_reset(void)
4040
{
4141
void *start, *end, *iptr;
42-
register int i;
4342

4443
/* Diasble all interrupts */
4544
local_irq_disable();

arch/mips/sni/reset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static inline void kb_wait(void)
2626
/* XXX This ends up at the ARC firmware prompt ... */
2727
void sni_machine_restart(char *command)
2828
{
29-
int i, j;
29+
int i;
3030

3131
/* This does a normal via the keyboard controller like a PC.
3232
We can do that easier ... */

arch/mips/vdso/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ aflags-vdso := $(ccflags-vdso) \
2626
# the comments on that file.
2727
#
2828
ifndef CONFIG_CPU_MIPSR6
29-
ifeq ($(call ld-ifversion, -gt, 22400000, y),)
30-
$(warning MIPS VDSO requires binutils > 2.24)
29+
ifeq ($(call ld-ifversion, -lt, 22500000, y),)
30+
$(warning MIPS VDSO requires binutils >= 2.25)
3131
obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y))
3232
ccflags-vdso += -DDISABLE_MIPS_VDSO
3333
endif

0 commit comments

Comments
 (0)