diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2009-03-12 13:03:16 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-03-12 17:33:03 -0400 |
commit | 446c92b2901bedb3725d29b4e73def8aba623ffc (patch) | |
tree | 5669761e042f8321214ca5a975fec536fa5f0efd | |
parent | 9311c593f24f28de2a339da602644f0f7ae0fc60 (diff) |
[ARM] 5421/1: ftrace: fix crash due to tracing of __naked functions
This is a fix for the following crash observed in 2.6.29-rc3:
http://lkml.org/lkml/2009/1/29/150
On ARM it doesn't make sense to trace a naked function because then
mcount is called without stack and frame pointer being set up and there
is no chance to restore the lr register to the value before mcount was
called.
Reported-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Tested-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Cc: Abhishek Sagar <sagar.abhishek@gmail.com>
Cc: Steven Rostedt <rostedt@home.goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/kernel/fiq.c | 4 | ||||
-rw-r--r-- | arch/arm/mm/copypage-feroceon.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/copypage-v3.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/copypage-v4mc.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/copypage-v4wb.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/copypage-v4wt.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/copypage-xsc3.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/copypage-xscale.c | 2 | ||||
-rw-r--r-- | include/linux/compiler-gcc.h | 10 |
9 files changed, 18 insertions, 10 deletions
diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c index 36f81d967979..6ff7919613d7 100644 --- a/arch/arm/kernel/fiq.c +++ b/arch/arm/kernel/fiq.c | |||
@@ -88,7 +88,7 @@ void set_fiq_handler(void *start, unsigned int length) | |||
88 | * disable irqs for the duration. Note - these functions are almost | 88 | * disable irqs for the duration. Note - these functions are almost |
89 | * entirely coded in assembly. | 89 | * entirely coded in assembly. |
90 | */ | 90 | */ |
91 | void __attribute__((naked)) set_fiq_regs(struct pt_regs *regs) | 91 | void __naked set_fiq_regs(struct pt_regs *regs) |
92 | { | 92 | { |
93 | register unsigned long tmp; | 93 | register unsigned long tmp; |
94 | asm volatile ( | 94 | asm volatile ( |
@@ -106,7 +106,7 @@ void __attribute__((naked)) set_fiq_regs(struct pt_regs *regs) | |||
106 | : "r" (®s->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)); | 106 | : "r" (®s->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)); |
107 | } | 107 | } |
108 | 108 | ||
109 | void __attribute__((naked)) get_fiq_regs(struct pt_regs *regs) | 109 | void __naked get_fiq_regs(struct pt_regs *regs) |
110 | { | 110 | { |
111 | register unsigned long tmp; | 111 | register unsigned long tmp; |
112 | asm volatile ( | 112 | asm volatile ( |
diff --git a/arch/arm/mm/copypage-feroceon.c b/arch/arm/mm/copypage-feroceon.c index c3ba6a94da0c..70997d5bee2d 100644 --- a/arch/arm/mm/copypage-feroceon.c +++ b/arch/arm/mm/copypage-feroceon.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/highmem.h> | 14 | #include <linux/highmem.h> |
15 | 15 | ||
16 | static void __attribute__((naked)) | 16 | static void __naked |
17 | feroceon_copy_user_page(void *kto, const void *kfrom) | 17 | feroceon_copy_user_page(void *kto, const void *kfrom) |
18 | { | 18 | { |
19 | asm("\ | 19 | asm("\ |
diff --git a/arch/arm/mm/copypage-v3.c b/arch/arm/mm/copypage-v3.c index 70ed96c8af8e..de9c06854ad7 100644 --- a/arch/arm/mm/copypage-v3.c +++ b/arch/arm/mm/copypage-v3.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * | 15 | * |
16 | * FIXME: do we need to handle cache stuff... | 16 | * FIXME: do we need to handle cache stuff... |
17 | */ | 17 | */ |
18 | static void __attribute__((naked)) | 18 | static void __naked |
19 | v3_copy_user_page(void *kto, const void *kfrom) | 19 | v3_copy_user_page(void *kto, const void *kfrom) |
20 | { | 20 | { |
21 | asm("\n\ | 21 | asm("\n\ |
diff --git a/arch/arm/mm/copypage-v4mc.c b/arch/arm/mm/copypage-v4mc.c index 1601698b9800..7370a7142b04 100644 --- a/arch/arm/mm/copypage-v4mc.c +++ b/arch/arm/mm/copypage-v4mc.c | |||
@@ -44,7 +44,7 @@ static DEFINE_SPINLOCK(minicache_lock); | |||
44 | * instruction. If your processor does not supply this, you have to write your | 44 | * instruction. If your processor does not supply this, you have to write your |
45 | * own copy_user_highpage that does the right thing. | 45 | * own copy_user_highpage that does the right thing. |
46 | */ | 46 | */ |
47 | static void __attribute__((naked)) | 47 | static void __naked |
48 | mc_copy_user_page(void *from, void *to) | 48 | mc_copy_user_page(void *from, void *to) |
49 | { | 49 | { |
50 | asm volatile( | 50 | asm volatile( |
diff --git a/arch/arm/mm/copypage-v4wb.c b/arch/arm/mm/copypage-v4wb.c index 3ec93dab7656..9ab098414227 100644 --- a/arch/arm/mm/copypage-v4wb.c +++ b/arch/arm/mm/copypage-v4wb.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * instruction. If your processor does not supply this, you have to write your | 22 | * instruction. If your processor does not supply this, you have to write your |
23 | * own copy_user_highpage that does the right thing. | 23 | * own copy_user_highpage that does the right thing. |
24 | */ | 24 | */ |
25 | static void __attribute__((naked)) | 25 | static void __naked |
26 | v4wb_copy_user_page(void *kto, const void *kfrom) | 26 | v4wb_copy_user_page(void *kto, const void *kfrom) |
27 | { | 27 | { |
28 | asm("\ | 28 | asm("\ |
diff --git a/arch/arm/mm/copypage-v4wt.c b/arch/arm/mm/copypage-v4wt.c index 0f1188efae45..300efafd6643 100644 --- a/arch/arm/mm/copypage-v4wt.c +++ b/arch/arm/mm/copypage-v4wt.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * dirty data in the cache. However, we do have to ensure that | 20 | * dirty data in the cache. However, we do have to ensure that |
21 | * subsequent reads are up to date. | 21 | * subsequent reads are up to date. |
22 | */ | 22 | */ |
23 | static void __attribute__((naked)) | 23 | static void __naked |
24 | v4wt_copy_user_page(void *kto, const void *kfrom) | 24 | v4wt_copy_user_page(void *kto, const void *kfrom) |
25 | { | 25 | { |
26 | asm("\ | 26 | asm("\ |
diff --git a/arch/arm/mm/copypage-xsc3.c b/arch/arm/mm/copypage-xsc3.c index 39a994542cad..bc4525f5ab23 100644 --- a/arch/arm/mm/copypage-xsc3.c +++ b/arch/arm/mm/copypage-xsc3.c | |||
@@ -29,7 +29,7 @@ | |||
29 | * if we eventually end up using our copied page. | 29 | * if we eventually end up using our copied page. |
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | static void __attribute__((naked)) | 32 | static void __naked |
33 | xsc3_mc_copy_user_page(void *kto, const void *kfrom) | 33 | xsc3_mc_copy_user_page(void *kto, const void *kfrom) |
34 | { | 34 | { |
35 | asm("\ | 35 | asm("\ |
diff --git a/arch/arm/mm/copypage-xscale.c b/arch/arm/mm/copypage-xscale.c index d18f2397ee2d..76824d3e966a 100644 --- a/arch/arm/mm/copypage-xscale.c +++ b/arch/arm/mm/copypage-xscale.c | |||
@@ -42,7 +42,7 @@ static DEFINE_SPINLOCK(minicache_lock); | |||
42 | * Dcache aliasing issue. The writes will be forwarded to the write buffer, | 42 | * Dcache aliasing issue. The writes will be forwarded to the write buffer, |
43 | * and merged as appropriate. | 43 | * and merged as appropriate. |
44 | */ | 44 | */ |
45 | static void __attribute__((naked)) | 45 | static void __naked |
46 | mc_copy_user_page(void *from, void *to) | 46 | mc_copy_user_page(void *from, void *to) |
47 | { | 47 | { |
48 | /* | 48 | /* |
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 1514d534deeb..a3ed7cb8ca34 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -52,7 +52,15 @@ | |||
52 | #define __deprecated __attribute__((deprecated)) | 52 | #define __deprecated __attribute__((deprecated)) |
53 | #define __packed __attribute__((packed)) | 53 | #define __packed __attribute__((packed)) |
54 | #define __weak __attribute__((weak)) | 54 | #define __weak __attribute__((weak)) |
55 | #define __naked __attribute__((naked)) | 55 | |
56 | /* | ||
57 | * it doesn't make sense on ARM (currently the only user of __naked) to trace | ||
58 | * naked functions because then mcount is called without stack and frame pointer | ||
59 | * being set up and there is no chance to restore the lr register to the value | ||
60 | * before mcount was called. | ||
61 | */ | ||
62 | #define __naked __attribute__((naked)) notrace | ||
63 | |||
56 | #define __noreturn __attribute__((noreturn)) | 64 | #define __noreturn __attribute__((noreturn)) |
57 | 65 | ||
58 | /* | 66 | /* |