aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-02-19 11:40:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-02-19 11:40:05 -0500
commit23300f657594656e7ebac3130b43460ebc4381cc (patch)
tree1cc00023ae5ee265e239506381724ffc7f6e2e69
parentff5f16820f632079d5095884adc5d71ee3249fa4 (diff)
parent52d7523d84d534c241ebac5ac89f5c0a6cb51e41 (diff)
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon: "Here are some more arm64 fixes for 4.5. This has mostly come from Yang Shi, who saw some issues under -rt that also affect mainline. The rest of it is pretty small, but still worth having. We've got an old issue outstanding with valid_user_regs which will likely wait until 4.6 (since it would really benefit from some time in -next) and another issue with kasan and idle which should be fixed next week. Apart from that, pretty quiet here (and still no sign of the THP issue reported on s390...) Summary: - Allow EFI stub to use strnlen(), which is required by recent libfdt - Avoid smp_processor_id() in preempt context during unwinding - Avoid false Kasan warnings during unwinding - Ensure early devices are picked up by the IOMMU DMA ops - Avoid rebuilding the kernel for the 'install' target - Run fixup handlers for alignment faults on userspace access" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: mm: allow the kernel to handle alignment faults on user accesses arm64: kbuild: make "make install" not depend on vmlinux arm64: dma-mapping: fix handling of devices registered before arch_initcall arm64/efi: Make strnlen() available to the EFI namespace arm/arm64: crypto: assure that ECB modes don't require an IV arm64: make irq_stack_ptr more robust arm64: debug: re-enable irqs before sending breakpoint SIGTRAP arm64: disable kasan when accessing frame->fp in unwind_frame
-rw-r--r--arch/arm/crypto/aes-ce-glue.c4
-rw-r--r--arch/arm64/Makefile2
-rw-r--r--arch/arm64/boot/Makefile4
-rw-r--r--arch/arm64/boot/install.sh14
-rw-r--r--arch/arm64/crypto/aes-glue.c4
-rw-r--r--arch/arm64/kernel/debug-monitors.c48
-rw-r--r--arch/arm64/kernel/image.h1
-rw-r--r--arch/arm64/kernel/stacktrace.c17
-rw-r--r--arch/arm64/kernel/traps.c11
-rw-r--r--arch/arm64/lib/strnlen.S2
-rw-r--r--arch/arm64/mm/dma-mapping.c4
-rw-r--r--arch/arm64/mm/fault.c9
12 files changed, 75 insertions, 45 deletions
diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c
index b445a5d56f43..89a3a3e592d6 100644
--- a/arch/arm/crypto/aes-ce-glue.c
+++ b/arch/arm/crypto/aes-ce-glue.c
@@ -364,7 +364,7 @@ static struct crypto_alg aes_algs[] = { {
364 .cra_blkcipher = { 364 .cra_blkcipher = {
365 .min_keysize = AES_MIN_KEY_SIZE, 365 .min_keysize = AES_MIN_KEY_SIZE,
366 .max_keysize = AES_MAX_KEY_SIZE, 366 .max_keysize = AES_MAX_KEY_SIZE,
367 .ivsize = AES_BLOCK_SIZE, 367 .ivsize = 0,
368 .setkey = ce_aes_setkey, 368 .setkey = ce_aes_setkey,
369 .encrypt = ecb_encrypt, 369 .encrypt = ecb_encrypt,
370 .decrypt = ecb_decrypt, 370 .decrypt = ecb_decrypt,
@@ -441,7 +441,7 @@ static struct crypto_alg aes_algs[] = { {
441 .cra_ablkcipher = { 441 .cra_ablkcipher = {
442 .min_keysize = AES_MIN_KEY_SIZE, 442 .min_keysize = AES_MIN_KEY_SIZE,
443 .max_keysize = AES_MAX_KEY_SIZE, 443 .max_keysize = AES_MAX_KEY_SIZE,
444 .ivsize = AES_BLOCK_SIZE, 444 .ivsize = 0,
445 .setkey = ablk_set_key, 445 .setkey = ablk_set_key,
446 .encrypt = ablk_encrypt, 446 .encrypt = ablk_encrypt,
447 .decrypt = ablk_decrypt, 447 .decrypt = ablk_decrypt,
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 307237cfe728..b5e3f6d42b88 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -88,7 +88,7 @@ Image: vmlinux
88Image.%: vmlinux 88Image.%: vmlinux
89 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 89 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
90 90
91zinstall install: vmlinux 91zinstall install:
92 $(Q)$(MAKE) $(build)=$(boot) $@ 92 $(Q)$(MAKE) $(build)=$(boot) $@
93 93
94%.dtb: scripts 94%.dtb: scripts
diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile
index abcbba2f01ba..305c552b5ec1 100644
--- a/arch/arm64/boot/Makefile
+++ b/arch/arm64/boot/Makefile
@@ -34,10 +34,10 @@ $(obj)/Image.lzma: $(obj)/Image FORCE
34$(obj)/Image.lzo: $(obj)/Image FORCE 34$(obj)/Image.lzo: $(obj)/Image FORCE
35 $(call if_changed,lzo) 35 $(call if_changed,lzo)
36 36
37install: $(obj)/Image 37install:
38 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 38 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
39 $(obj)/Image System.map "$(INSTALL_PATH)" 39 $(obj)/Image System.map "$(INSTALL_PATH)"
40 40
41zinstall: $(obj)/Image.gz 41zinstall:
42 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 42 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
43 $(obj)/Image.gz System.map "$(INSTALL_PATH)" 43 $(obj)/Image.gz System.map "$(INSTALL_PATH)"
diff --git a/arch/arm64/boot/install.sh b/arch/arm64/boot/install.sh
index 12ed78aa6f0c..d91e1f022573 100644
--- a/arch/arm64/boot/install.sh
+++ b/arch/arm64/boot/install.sh
@@ -20,6 +20,20 @@
20# $4 - default install path (blank if root directory) 20# $4 - default install path (blank if root directory)
21# 21#
22 22
23verify () {
24 if [ ! -f "$1" ]; then
25 echo "" 1>&2
26 echo " *** Missing file: $1" 1>&2
27 echo ' *** You need to run "make" before "make install".' 1>&2
28 echo "" 1>&2
29 exit 1
30 fi
31}
32
33# Make sure the files actually exist
34verify "$2"
35verify "$3"
36
23# User may have a custom install script 37# User may have a custom install script
24if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 38if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
25if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 39if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c
index 05d9e16c0dfd..7a3d22a46faf 100644
--- a/arch/arm64/crypto/aes-glue.c
+++ b/arch/arm64/crypto/aes-glue.c
@@ -294,7 +294,7 @@ static struct crypto_alg aes_algs[] = { {
294 .cra_blkcipher = { 294 .cra_blkcipher = {
295 .min_keysize = AES_MIN_KEY_SIZE, 295 .min_keysize = AES_MIN_KEY_SIZE,
296 .max_keysize = AES_MAX_KEY_SIZE, 296 .max_keysize = AES_MAX_KEY_SIZE,
297 .ivsize = AES_BLOCK_SIZE, 297 .ivsize = 0,
298 .setkey = aes_setkey, 298 .setkey = aes_setkey,
299 .encrypt = ecb_encrypt, 299 .encrypt = ecb_encrypt,
300 .decrypt = ecb_decrypt, 300 .decrypt = ecb_decrypt,
@@ -371,7 +371,7 @@ static struct crypto_alg aes_algs[] = { {
371 .cra_ablkcipher = { 371 .cra_ablkcipher = {
372 .min_keysize = AES_MIN_KEY_SIZE, 372 .min_keysize = AES_MIN_KEY_SIZE,
373 .max_keysize = AES_MAX_KEY_SIZE, 373 .max_keysize = AES_MAX_KEY_SIZE,
374 .ivsize = AES_BLOCK_SIZE, 374 .ivsize = 0,
375 .setkey = ablk_set_key, 375 .setkey = ablk_set_key,
376 .encrypt = ablk_encrypt, 376 .encrypt = ablk_encrypt,
377 .decrypt = ablk_decrypt, 377 .decrypt = ablk_decrypt,
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index 8aee3aeec3e6..c536c9e307b9 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -226,11 +226,28 @@ static int call_step_hook(struct pt_regs *regs, unsigned int esr)
226 return retval; 226 return retval;
227} 227}
228 228
229static void send_user_sigtrap(int si_code)
230{
231 struct pt_regs *regs = current_pt_regs();
232 siginfo_t info = {
233 .si_signo = SIGTRAP,
234 .si_errno = 0,
235 .si_code = si_code,
236 .si_addr = (void __user *)instruction_pointer(regs),
237 };
238
239 if (WARN_ON(!user_mode(regs)))
240 return;
241
242 if (interrupts_enabled(regs))
243 local_irq_enable();
244
245 force_sig_info(SIGTRAP, &info, current);
246}
247
229static int single_step_handler(unsigned long addr, unsigned int esr, 248static int single_step_handler(unsigned long addr, unsigned int esr,
230 struct pt_regs *regs) 249 struct pt_regs *regs)
231{ 250{
232 siginfo_t info;
233
234 /* 251 /*
235 * If we are stepping a pending breakpoint, call the hw_breakpoint 252 * If we are stepping a pending breakpoint, call the hw_breakpoint
236 * handler first. 253 * handler first.
@@ -239,11 +256,7 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
239 return 0; 256 return 0;
240 257
241 if (user_mode(regs)) { 258 if (user_mode(regs)) {
242 info.si_signo = SIGTRAP; 259 send_user_sigtrap(TRAP_HWBKPT);
243 info.si_errno = 0;
244 info.si_code = TRAP_HWBKPT;
245 info.si_addr = (void __user *)instruction_pointer(regs);
246 force_sig_info(SIGTRAP, &info, current);
247 260
248 /* 261 /*
249 * ptrace will disable single step unless explicitly 262 * ptrace will disable single step unless explicitly
@@ -307,17 +320,8 @@ static int call_break_hook(struct pt_regs *regs, unsigned int esr)
307static int brk_handler(unsigned long addr, unsigned int esr, 320static int brk_handler(unsigned long addr, unsigned int esr,
308 struct pt_regs *regs) 321 struct pt_regs *regs)
309{ 322{
310 siginfo_t info;
311
312 if (user_mode(regs)) { 323 if (user_mode(regs)) {
313 info = (siginfo_t) { 324 send_user_sigtrap(TRAP_BRKPT);
314 .si_signo = SIGTRAP,
315 .si_errno = 0,
316 .si_code = TRAP_BRKPT,
317 .si_addr = (void __user *)instruction_pointer(regs),
318 };
319
320 force_sig_info(SIGTRAP, &info, current);
321 } else if (call_break_hook(regs, esr) != DBG_HOOK_HANDLED) { 325 } else if (call_break_hook(regs, esr) != DBG_HOOK_HANDLED) {
322 pr_warning("Unexpected kernel BRK exception at EL1\n"); 326 pr_warning("Unexpected kernel BRK exception at EL1\n");
323 return -EFAULT; 327 return -EFAULT;
@@ -328,7 +332,6 @@ static int brk_handler(unsigned long addr, unsigned int esr,
328 332
329int aarch32_break_handler(struct pt_regs *regs) 333int aarch32_break_handler(struct pt_regs *regs)
330{ 334{
331 siginfo_t info;
332 u32 arm_instr; 335 u32 arm_instr;
333 u16 thumb_instr; 336 u16 thumb_instr;
334 bool bp = false; 337 bool bp = false;
@@ -359,14 +362,7 @@ int aarch32_break_handler(struct pt_regs *regs)
359 if (!bp) 362 if (!bp)
360 return -EFAULT; 363 return -EFAULT;
361 364
362 info = (siginfo_t) { 365 send_user_sigtrap(TRAP_BRKPT);
363 .si_signo = SIGTRAP,
364 .si_errno = 0,
365 .si_code = TRAP_BRKPT,
366 .si_addr = pc,
367 };
368
369 force_sig_info(SIGTRAP, &info, current);
370 return 0; 366 return 0;
371} 367}
372 368
diff --git a/arch/arm64/kernel/image.h b/arch/arm64/kernel/image.h
index 999633bd7294..352f7abd91c9 100644
--- a/arch/arm64/kernel/image.h
+++ b/arch/arm64/kernel/image.h
@@ -89,6 +89,7 @@ __efistub_memcpy = KALLSYMS_HIDE(__pi_memcpy);
89__efistub_memmove = KALLSYMS_HIDE(__pi_memmove); 89__efistub_memmove = KALLSYMS_HIDE(__pi_memmove);
90__efistub_memset = KALLSYMS_HIDE(__pi_memset); 90__efistub_memset = KALLSYMS_HIDE(__pi_memset);
91__efistub_strlen = KALLSYMS_HIDE(__pi_strlen); 91__efistub_strlen = KALLSYMS_HIDE(__pi_strlen);
92__efistub_strnlen = KALLSYMS_HIDE(__pi_strnlen);
92__efistub_strcmp = KALLSYMS_HIDE(__pi_strcmp); 93__efistub_strcmp = KALLSYMS_HIDE(__pi_strcmp);
93__efistub_strncmp = KALLSYMS_HIDE(__pi_strncmp); 94__efistub_strncmp = KALLSYMS_HIDE(__pi_strncmp);
94__efistub___flush_dcache_area = KALLSYMS_HIDE(__pi___flush_dcache_area); 95__efistub___flush_dcache_area = KALLSYMS_HIDE(__pi___flush_dcache_area);
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index 4fad9787ab46..d9751a4769e7 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -44,14 +44,13 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
44 unsigned long irq_stack_ptr; 44 unsigned long irq_stack_ptr;
45 45
46 /* 46 /*
47 * Use raw_smp_processor_id() to avoid false-positives from 47 * Switching between stacks is valid when tracing current and in
48 * CONFIG_DEBUG_PREEMPT. get_wchan() calls unwind_frame() on sleeping 48 * non-preemptible context.
49 * task stacks, we can be pre-empted in this case, so
50 * {raw_,}smp_processor_id() may give us the wrong value. Sleeping
51 * tasks can't ever be on an interrupt stack, so regardless of cpu,
52 * the checks will always fail.
53 */ 49 */
54 irq_stack_ptr = IRQ_STACK_PTR(raw_smp_processor_id()); 50 if (tsk == current && !preemptible())
51 irq_stack_ptr = IRQ_STACK_PTR(smp_processor_id());
52 else
53 irq_stack_ptr = 0;
55 54
56 low = frame->sp; 55 low = frame->sp;
57 /* irq stacks are not THREAD_SIZE aligned */ 56 /* irq stacks are not THREAD_SIZE aligned */
@@ -64,8 +63,8 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
64 return -EINVAL; 63 return -EINVAL;
65 64
66 frame->sp = fp + 0x10; 65 frame->sp = fp + 0x10;
67 frame->fp = *(unsigned long *)(fp); 66 frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp));
68 frame->pc = *(unsigned long *)(fp + 8); 67 frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8));
69 68
70#ifdef CONFIG_FUNCTION_GRAPH_TRACER 69#ifdef CONFIG_FUNCTION_GRAPH_TRACER
71 if (tsk && tsk->ret_stack && 70 if (tsk && tsk->ret_stack &&
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index cbedd724f48e..c5392081b49b 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -146,9 +146,18 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
146static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) 146static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
147{ 147{
148 struct stackframe frame; 148 struct stackframe frame;
149 unsigned long irq_stack_ptr = IRQ_STACK_PTR(smp_processor_id()); 149 unsigned long irq_stack_ptr;
150 int skip; 150 int skip;
151 151
152 /*
153 * Switching between stacks is valid when tracing current and in
154 * non-preemptible context.
155 */
156 if (tsk == current && !preemptible())
157 irq_stack_ptr = IRQ_STACK_PTR(smp_processor_id());
158 else
159 irq_stack_ptr = 0;
160
152 pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk); 161 pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk);
153 162
154 if (!tsk) 163 if (!tsk)
diff --git a/arch/arm64/lib/strnlen.S b/arch/arm64/lib/strnlen.S
index 2ca665711bf2..eae38da6e0bb 100644
--- a/arch/arm64/lib/strnlen.S
+++ b/arch/arm64/lib/strnlen.S
@@ -168,4 +168,4 @@ CPU_LE( lsr tmp2, tmp2, tmp4 ) /* Shift (tmp1 & 63). */
168.Lhit_limit: 168.Lhit_limit:
169 mov len, limit 169 mov len, limit
170 ret 170 ret
171ENDPROC(strnlen) 171ENDPIPROC(strnlen)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 331c4ca6205c..a6e757cbab77 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -933,6 +933,10 @@ static int __init __iommu_dma_init(void)
933 ret = register_iommu_dma_ops_notifier(&platform_bus_type); 933 ret = register_iommu_dma_ops_notifier(&platform_bus_type);
934 if (!ret) 934 if (!ret)
935 ret = register_iommu_dma_ops_notifier(&amba_bustype); 935 ret = register_iommu_dma_ops_notifier(&amba_bustype);
936
937 /* handle devices queued before this arch_initcall */
938 if (!ret)
939 __iommu_attach_notifier(NULL, BUS_NOTIFY_ADD_DEVICE, NULL);
936 return ret; 940 return ret;
937} 941}
938arch_initcall(__iommu_dma_init); 942arch_initcall(__iommu_dma_init);
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 92ddac1e8ca2..abe2a9542b3a 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -371,6 +371,13 @@ static int __kprobes do_translation_fault(unsigned long addr,
371 return 0; 371 return 0;
372} 372}
373 373
374static int do_alignment_fault(unsigned long addr, unsigned int esr,
375 struct pt_regs *regs)
376{
377 do_bad_area(addr, esr, regs);
378 return 0;
379}
380
374/* 381/*
375 * This abort handler always returns "fault". 382 * This abort handler always returns "fault".
376 */ 383 */
@@ -418,7 +425,7 @@ static struct fault_info {
418 { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" }, 425 { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
419 { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" }, 426 { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
420 { do_bad, SIGBUS, 0, "unknown 32" }, 427 { do_bad, SIGBUS, 0, "unknown 32" },
421 { do_bad, SIGBUS, BUS_ADRALN, "alignment fault" }, 428 { do_alignment_fault, SIGBUS, BUS_ADRALN, "alignment fault" },
422 { do_bad, SIGBUS, 0, "unknown 34" }, 429 { do_bad, SIGBUS, 0, "unknown 34" },
423 { do_bad, SIGBUS, 0, "unknown 35" }, 430 { do_bad, SIGBUS, 0, "unknown 35" },
424 { do_bad, SIGBUS, 0, "unknown 36" }, 431 { do_bad, SIGBUS, 0, "unknown 36" },