Skip to content

Commit 57e6bbc

Browse files
committed
Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
Pull ARM fixes from Russell King: "A number of fixes for the merge window, fixing a number of cases missed when testing the uaccess code, particularly cases which only show up with certain compiler versions" * 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm: ARM: 8431/1: fix alignement of __bug_table section entries arm/xen: Enable user access to the kernel before issuing a privcmd call ARM: domains: add memory dependencies to get_domain/set_domain ARM: domains: thread_info.h no longer needs asm/domains.h ARM: uaccess: fix undefined instruction on ARMv7M/noMMU ARM: uaccess: remove unneeded uaccess_save_and_disable macro ARM: swpan: fix nwfpe for uaccess changes ARM: 8429/1: disable GCC SRA optimization
2 parents 6ff33f3 + c2172ce commit 57e6bbc

8 files changed

Lines changed: 32 additions & 9 deletions

File tree

‎arch/arm/Makefile‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ AS += -EL
5454
LD += -EL
5555
endif
5656

57+
#
58+
# The Scalar Replacement of Aggregates (SRA) optimization pass in GCC 4.9 and
59+
# later may result in code being generated that handles signed short and signed
60+
# char struct members incorrectly. So disable it.
61+
# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932)
62+
#
63+
KBUILD_CFLAGS += $(call cc-option,-fno-ipa-sra)
64+
5765
# This selects which instruction set is used.
5866
# Note that GCC does not numerically define an architecture version
5967
# macro, but instead defines a whole series of macros which makes

‎arch/arm/include/asm/assembler.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,6 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
491491
#endif
492492
.endm
493493

494-
.macro uaccess_save_and_disable, tmp
495-
uaccess_save \tmp
496-
uaccess_disable \tmp
497-
.endm
498-
499494
.irp c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
500495
.macro ret\c, reg
501496
#if __LINUX_ARM_ARCH__ < 6

‎arch/arm/include/asm/bug.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ do { \
4040
"2:\t.asciz " #__file "\n" \
4141
".popsection\n" \
4242
".pushsection __bug_table,\"a\"\n" \
43+
".align 2\n" \
4344
"3:\t.word 1b, 2b\n" \
4445
"\t.hword " #__line ", 0\n" \
4546
".popsection"); \

‎arch/arm/include/asm/domain.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#ifndef __ASSEMBLY__
1414
#include <asm/barrier.h>
15+
#include <asm/thread_info.h>
1516
#endif
1617

1718
/*
@@ -89,7 +90,8 @@ static inline unsigned int get_domain(void)
8990

9091
asm(
9192
"mrc p15, 0, %0, c3, c0 @ get domain"
92-
: "=r" (domain));
93+
: "=r" (domain)
94+
: "m" (current_thread_info()->cpu_domain));
9395

9496
return domain;
9597
}
@@ -98,7 +100,7 @@ static inline void set_domain(unsigned val)
98100
{
99101
asm volatile(
100102
"mcr p15, 0, %0, c3, c0 @ set domain"
101-
: : "r" (val));
103+
: : "r" (val) : "memory");
102104
isb();
103105
}
104106

‎arch/arm/include/asm/thread_info.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
struct task_struct;
2626

2727
#include <asm/types.h>
28-
#include <asm/domain.h>
2928

3029
typedef unsigned long mm_segment_t;
3130

‎arch/arm/kernel/process.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,15 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
226226

227227
memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save));
228228

229+
#ifdef CONFIG_CPU_USE_DOMAINS
229230
/*
230231
* Copy the initial value of the domain access control register
231232
* from the current thread: thread->addr_limit will have been
232233
* copied from the current thread via setup_thread_stack() in
233234
* kernel/fork.c
234235
*/
235236
thread->cpu_domain = get_domain();
237+
#endif
236238

237239
if (likely(!(p->flags & PF_KTHREAD))) {
238240
*childregs = *current_pt_regs();

‎arch/arm/nwfpe/entry.S‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ emulate:
9595
reteq r4 @ no, return failure
9696

9797
next:
98+
uaccess_enable r3
9899
.Lx1: ldrt r6, [r5], #4 @ get the next instruction and
99100
@ increment PC
100-
101+
uaccess_disable r3
101102
and r2, r6, #0x0F000000 @ test for FP insns
102103
teq r2, #0x0C000000
103104
teqne r2, #0x0D000000

‎arch/arm/xen/hypercall.S‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,23 @@ ENTRY(privcmd_call)
9898
mov r1, r2
9999
mov r2, r3
100100
ldr r3, [sp, #8]
101+
/*
102+
* Privcmd calls are issued by the userspace. We need to allow the
103+
* kernel to access the userspace memory before issuing the hypercall.
104+
*/
105+
uaccess_enable r4
106+
107+
/* r4 is loaded now as we use it as scratch register before */
101108
ldr r4, [sp, #4]
102109
__HVC(XEN_IMM)
110+
111+
/*
112+
* Disable userspace access from kernel. This is fine to do it
113+
* unconditionally as no set_fs(KERNEL_DS)/set_fs(get_ds()) is
114+
* called before.
115+
*/
116+
uaccess_disable r4
117+
103118
ldm sp!, {r4}
104119
ret lr
105120
ENDPROC(privcmd_call);

0 commit comments

Comments
 (0)