Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+32 -9
+8
arch/arm/Makefile
··· 54 54 LD += -EL 55 55 endif 56 56 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 + 57 65 # This selects which instruction set is used. 58 66 # Note that GCC does not numerically define an architecture version 59 67 # macro, but instead defines a whole series of macros which makes
-5
arch/arm/include/asm/assembler.h
··· 491 491 #endif 492 492 .endm 493 493 494 - .macro uaccess_save_and_disable, tmp 495 - uaccess_save \tmp 496 - uaccess_disable \tmp 497 - .endm 498 - 499 494 .irp c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo 500 495 .macro ret\c, reg 501 496 #if __LINUX_ARM_ARCH__ < 6
+1
arch/arm/include/asm/bug.h
··· 40 40 "2:\t.asciz " #__file "\n" \ 41 41 ".popsection\n" \ 42 42 ".pushsection __bug_table,\"a\"\n" \ 43 + ".align 2\n" \ 43 44 "3:\t.word 1b, 2b\n" \ 44 45 "\t.hword " #__line ", 0\n" \ 45 46 ".popsection"); \
+4 -2
arch/arm/include/asm/domain.h
··· 12 12 13 13 #ifndef __ASSEMBLY__ 14 14 #include <asm/barrier.h> 15 + #include <asm/thread_info.h> 15 16 #endif 16 17 17 18 /* ··· 90 89 91 90 asm( 92 91 "mrc p15, 0, %0, c3, c0 @ get domain" 93 - : "=r" (domain)); 92 + : "=r" (domain) 93 + : "m" (current_thread_info()->cpu_domain)); 94 94 95 95 return domain; 96 96 } ··· 100 98 { 101 99 asm volatile( 102 100 "mcr p15, 0, %0, c3, c0 @ set domain" 103 - : : "r" (val)); 101 + : : "r" (val) : "memory"); 104 102 isb(); 105 103 } 106 104
-1
arch/arm/include/asm/thread_info.h
··· 25 25 struct task_struct; 26 26 27 27 #include <asm/types.h> 28 - #include <asm/domain.h> 29 28 30 29 typedef unsigned long mm_segment_t; 31 30
+2
arch/arm/kernel/process.c
··· 226 226 227 227 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save)); 228 228 229 + #ifdef CONFIG_CPU_USE_DOMAINS 229 230 /* 230 231 * Copy the initial value of the domain access control register 231 232 * from the current thread: thread->addr_limit will have been ··· 234 233 * kernel/fork.c 235 234 */ 236 235 thread->cpu_domain = get_domain(); 236 + #endif 237 237 238 238 if (likely(!(p->flags & PF_KTHREAD))) { 239 239 *childregs = *current_pt_regs();
+2 -1
arch/arm/nwfpe/entry.S
··· 95 95 reteq r4 @ no, return failure 96 96 97 97 next: 98 + uaccess_enable r3 98 99 .Lx1: ldrt r6, [r5], #4 @ get the next instruction and 99 100 @ increment PC 100 - 101 + uaccess_disable r3 101 102 and r2, r6, #0x0F000000 @ test for FP insns 102 103 teq r2, #0x0C000000 103 104 teqne r2, #0x0D000000
+15
arch/arm/xen/hypercall.S
··· 98 98 mov r1, r2 99 99 mov r2, r3 100 100 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 */ 101 108 ldr r4, [sp, #4] 102 109 __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 + 103 118 ldm sp!, {r4} 104 119 ret lr 105 120 ENDPROC(privcmd_call);