Skip to content

Commit 132ce5d

Browse files
committed
Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM fixes from Russell King: - Łukasz Stelmach spotted a couple of issues with the decompressor. - a couple of kdump fixes found while testing kdump - replace some perl with shell code - resolve SIGFPE breakage - kprobes fixes * 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm: ARM: fix kill( ,SIGFPE) breakage ARM: 8772/1: kprobes: Prohibit kprobes on get_user functions ARM: 8771/1: kprobes: Prohibit kprobes on do_undefinstr ARM: 8770/1: kprobes: Prohibit probing on optimized_callback ARM: 8769/1: kprobes: Fix to use get_kprobe_ctlblk after irq-disabed ARM: replace unnecessary perl with sed and the shell $(( )) operator ARM: kexec: record parent context registers for non-crash CPUs ARM: kexec: fix kdump register saving on panic() ARM: 8758/1: decompressor: restore r1 and r2 just before jumping to the kernel ARM: 8753/1: decompressor: add a missing parameter to the addruart macro
2 parents 8a6bd2f + 92d44a4 commit 132ce5d

File tree

9 files changed

+64
-44
lines changed

9 files changed

+64
-44
lines changed

arch/arm/boot/compressed/Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,9 @@ ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj)
117117
asflags-y := -DZIMAGE
118118

119119
# Supply kernel BSS size to the decompressor via a linker symbol.
120-
KBSS_SZ = $(shell $(CROSS_COMPILE)nm $(obj)/../../../../vmlinux | \
121-
perl -e 'while (<>) { \
122-
$$bss_start=hex($$1) if /^([[:xdigit:]]+) B __bss_start$$/; \
123-
$$bss_end=hex($$1) if /^([[:xdigit:]]+) B __bss_stop$$/; \
124-
}; printf "%d\n", $$bss_end - $$bss_start;')
120+
KBSS_SZ = $(shell echo $$(($$($(CROSS_COMPILE)nm $(obj)/../../../../vmlinux | \
121+
sed -n -e 's/^\([^ ]*\) [AB] __bss_start$$/-0x\1/p' \
122+
-e 's/^\([^ ]*\) [AB] __bss_stop$$/+0x\1/p') )) )
125123
LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ)
126124
# Supply ZRELADDR to the decompressor via a linker symbol.
127125
ifneq ($(CONFIG_AUTO_ZRELADDR),y)

arch/arm/boot/compressed/head.S

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@
2929
#if defined(CONFIG_DEBUG_ICEDCC)
3030

3131
#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7)
32-
.macro loadsp, rb, tmp
32+
.macro loadsp, rb, tmp1, tmp2
3333
.endm
3434
.macro writeb, ch, rb
3535
mcr p14, 0, \ch, c0, c5, 0
3636
.endm
3737
#elif defined(CONFIG_CPU_XSCALE)
38-
.macro loadsp, rb, tmp
38+
.macro loadsp, rb, tmp1, tmp2
3939
.endm
4040
.macro writeb, ch, rb
4141
mcr p14, 0, \ch, c8, c0, 0
4242
.endm
4343
#else
44-
.macro loadsp, rb, tmp
44+
.macro loadsp, rb, tmp1, tmp2
4545
.endm
4646
.macro writeb, ch, rb
4747
mcr p14, 0, \ch, c1, c0, 0
@@ -57,7 +57,7 @@
5757
.endm
5858

5959
#if defined(CONFIG_ARCH_SA1100)
60-
.macro loadsp, rb, tmp
60+
.macro loadsp, rb, tmp1, tmp2
6161
mov \rb, #0x80000000 @ physical base address
6262
#ifdef CONFIG_DEBUG_LL_SER3
6363
add \rb, \rb, #0x00050000 @ Ser3
@@ -66,8 +66,8 @@
6666
#endif
6767
.endm
6868
#else
69-
.macro loadsp, rb, tmp
70-
addruart \rb, \tmp
69+
.macro loadsp, rb, tmp1, tmp2
70+
addruart \rb, \tmp1, \tmp2
7171
.endm
7272
#endif
7373
#endif
@@ -561,8 +561,6 @@ not_relocated: mov r0, #0
561561
bl decompress_kernel
562562
bl cache_clean_flush
563563
bl cache_off
564-
mov r1, r7 @ restore architecture number
565-
mov r2, r8 @ restore atags pointer
566564

567565
#ifdef CONFIG_ARM_VIRT_EXT
568566
mrs r0, spsr @ Get saved CPU boot mode
@@ -1297,7 +1295,7 @@ phex: adr r3, phexbuf
12971295
b 1b
12981296

12991297
@ puts corrupts {r0, r1, r2, r3}
1300-
puts: loadsp r3, r1
1298+
puts: loadsp r3, r2, r1
13011299
1: ldrb r2, [r0], #1
13021300
teq r2, #0
13031301
moveq pc, lr
@@ -1314,8 +1312,8 @@ puts: loadsp r3, r1
13141312
@ putc corrupts {r0, r1, r2, r3}
13151313
putc:
13161314
mov r2, r0
1315+
loadsp r3, r1, r0
13171316
mov r0, #0
1318-
loadsp r3, r1
13191317
b 2b
13201318

13211319
@ memdump corrupts {r0, r1, r2, r3, r10, r11, r12, lr}
@@ -1365,6 +1363,8 @@ __hyp_reentry_vectors:
13651363

13661364
__enter_kernel:
13671365
mov r0, #0 @ must be 0
1366+
mov r1, r7 @ restore architecture number
1367+
mov r2, r8 @ restore atags pointer
13681368
ARM( mov pc, r4 ) @ call kernel
13691369
M_CLASS( add r4, r4, #1 ) @ enter in Thumb mode for M class
13701370
THUMB( bx r4 ) @ entry point is always ARM for A/R classes

arch/arm/include/asm/assembler.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,4 +536,14 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
536536
#endif
537537
.endm
538538

539+
#ifdef CONFIG_KPROBES
540+
#define _ASM_NOKPROBE(entry) \
541+
.pushsection "_kprobe_blacklist", "aw" ; \
542+
.balign 4 ; \
543+
.long entry; \
544+
.popsection
545+
#else
546+
#define _ASM_NOKPROBE(entry)
547+
#endif
548+
539549
#endif /* __ASM_ASSEMBLER_H__ */

arch/arm/include/uapi/asm/siginfo.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

arch/arm/kernel/machine_kexec.c

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void machine_crash_nonpanic_core(void *unused)
8383
{
8484
struct pt_regs regs;
8585

86-
crash_setup_regs(&regs, NULL);
86+
crash_setup_regs(&regs, get_irq_regs());
8787
printk(KERN_DEBUG "CPU %u will stop doing anything useful since another CPU has crashed\n",
8888
smp_processor_id());
8989
crash_save_cpu(&regs, smp_processor_id());
@@ -95,6 +95,27 @@ void machine_crash_nonpanic_core(void *unused)
9595
cpu_relax();
9696
}
9797

98+
void crash_smp_send_stop(void)
99+
{
100+
static int cpus_stopped;
101+
unsigned long msecs;
102+
103+
if (cpus_stopped)
104+
return;
105+
106+
atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
107+
smp_call_function(machine_crash_nonpanic_core, NULL, false);
108+
msecs = 1000; /* Wait at most a second for the other cpus to stop */
109+
while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {
110+
mdelay(1);
111+
msecs--;
112+
}
113+
if (atomic_read(&waiting_for_crash_ipi) > 0)
114+
pr_warn("Non-crashing CPUs did not react to IPI\n");
115+
116+
cpus_stopped = 1;
117+
}
118+
98119
static void machine_kexec_mask_interrupts(void)
99120
{
100121
unsigned int i;
@@ -120,19 +141,8 @@ static void machine_kexec_mask_interrupts(void)
120141

121142
void machine_crash_shutdown(struct pt_regs *regs)
122143
{
123-
unsigned long msecs;
124-
125144
local_irq_disable();
126-
127-
atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
128-
smp_call_function(machine_crash_nonpanic_core, NULL, false);
129-
msecs = 1000; /* Wait at most a second for the other cpus to stop */
130-
while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {
131-
mdelay(1);
132-
msecs--;
133-
}
134-
if (atomic_read(&waiting_for_crash_ipi) > 0)
135-
pr_warn("Non-crashing CPUs did not react to IPI\n");
145+
crash_smp_send_stop();
136146

137147
crash_save_cpu(regs, smp_processor_id());
138148
machine_kexec_mask_interrupts();

arch/arm/kernel/traps.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/uaccess.h>
2020
#include <linux/hardirq.h>
2121
#include <linux/kdebug.h>
22+
#include <linux/kprobes.h>
2223
#include <linux/module.h>
2324
#include <linux/kexec.h>
2425
#include <linux/bug.h>
@@ -417,7 +418,8 @@ void unregister_undef_hook(struct undef_hook *hook)
417418
raw_spin_unlock_irqrestore(&undef_lock, flags);
418419
}
419420

420-
static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
421+
static nokprobe_inline
422+
int call_undef_hook(struct pt_regs *regs, unsigned int instr)
421423
{
422424
struct undef_hook *hook;
423425
unsigned long flags;
@@ -490,6 +492,7 @@ asmlinkage void do_undefinstr(struct pt_regs *regs)
490492

491493
arm_notify_die("Oops - undefined instruction", regs, &info, 0, 6);
492494
}
495+
NOKPROBE_SYMBOL(do_undefinstr)
493496

494497
/*
495498
* Handle FIQ similarly to NMI on x86 systems.

arch/arm/lib/getuser.S

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ ENTRY(__get_user_1)
3838
mov r0, #0
3939
ret lr
4040
ENDPROC(__get_user_1)
41+
_ASM_NOKPROBE(__get_user_1)
4142

4243
ENTRY(__get_user_2)
4344
check_uaccess r0, 2, r1, r2, __get_user_bad
@@ -58,13 +59,15 @@ rb .req r0
5859
mov r0, #0
5960
ret lr
6061
ENDPROC(__get_user_2)
62+
_ASM_NOKPROBE(__get_user_2)
6163

6264
ENTRY(__get_user_4)
6365
check_uaccess r0, 4, r1, r2, __get_user_bad
6466
4: TUSER(ldr) r2, [r0]
6567
mov r0, #0
6668
ret lr
6769
ENDPROC(__get_user_4)
70+
_ASM_NOKPROBE(__get_user_4)
6871

6972
ENTRY(__get_user_8)
7073
check_uaccess r0, 8, r1, r2, __get_user_bad8
@@ -78,6 +81,7 @@ ENTRY(__get_user_8)
7881
mov r0, #0
7982
ret lr
8083
ENDPROC(__get_user_8)
84+
_ASM_NOKPROBE(__get_user_8)
8185

8286
#ifdef __ARMEB__
8387
ENTRY(__get_user_32t_8)
@@ -91,13 +95,15 @@ ENTRY(__get_user_32t_8)
9195
mov r0, #0
9296
ret lr
9397
ENDPROC(__get_user_32t_8)
98+
_ASM_NOKPROBE(__get_user_32t_8)
9499

95100
ENTRY(__get_user_64t_1)
96101
check_uaccess r0, 1, r1, r2, __get_user_bad8
97102
8: TUSER(ldrb) r3, [r0]
98103
mov r0, #0
99104
ret lr
100105
ENDPROC(__get_user_64t_1)
106+
_ASM_NOKPROBE(__get_user_64t_1)
101107

102108
ENTRY(__get_user_64t_2)
103109
check_uaccess r0, 2, r1, r2, __get_user_bad8
@@ -114,13 +120,15 @@ rb .req r0
114120
mov r0, #0
115121
ret lr
116122
ENDPROC(__get_user_64t_2)
123+
_ASM_NOKPROBE(__get_user_64t_2)
117124

118125
ENTRY(__get_user_64t_4)
119126
check_uaccess r0, 4, r1, r2, __get_user_bad8
120127
11: TUSER(ldr) r3, [r0]
121128
mov r0, #0
122129
ret lr
123130
ENDPROC(__get_user_64t_4)
131+
_ASM_NOKPROBE(__get_user_64t_4)
124132
#endif
125133

126134
__get_user_bad8:
@@ -131,6 +139,8 @@ __get_user_bad:
131139
ret lr
132140
ENDPROC(__get_user_bad)
133141
ENDPROC(__get_user_bad8)
142+
_ASM_NOKPROBE(__get_user_bad)
143+
_ASM_NOKPROBE(__get_user_bad8)
134144

135145
.pushsection __ex_table, "a"
136146
.long 1b, __get_user_bad

arch/arm/probes/kprobes/opt-arm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,14 @@ optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
165165
{
166166
unsigned long flags;
167167
struct kprobe *p = &op->kp;
168-
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
168+
struct kprobe_ctlblk *kcb;
169169

170170
/* Save skipped registers */
171171
regs->ARM_pc = (unsigned long)op->kp.addr;
172172
regs->ARM_ORIG_r0 = ~0UL;
173173

174174
local_irq_save(flags);
175+
kcb = get_kprobe_ctlblk();
175176

176177
if (kprobe_running()) {
177178
kprobes_inc_nmissed_count(&op->kp);
@@ -191,6 +192,7 @@ optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
191192

192193
local_irq_restore(flags);
193194
}
195+
NOKPROBE_SYMBOL(optimized_callback)
194196

195197
int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *orig)
196198
{

arch/arm/vfp/vfpmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static void vfp_raise_exceptions(u32 exceptions, u32 inst, u32 fpscr, struct pt_
257257

258258
if (exceptions == VFP_EXCEPTION_ERROR) {
259259
vfp_panic("unhandled bounce", inst);
260-
vfp_raise_sigfpe(FPE_FIXME, regs);
260+
vfp_raise_sigfpe(FPE_FLTINV, regs);
261261
return;
262262
}
263263

0 commit comments

Comments
 (0)