]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[ARM] 5421/1: ftrace: fix crash due to tracing of __naked functions
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 12 Mar 2009 17:03:16 +0000 (18:03 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 12 Mar 2009 21:33:03 +0000 (21:33 +0000)
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>
arch/arm/kernel/fiq.c
arch/arm/mm/copypage-feroceon.c
arch/arm/mm/copypage-v3.c
arch/arm/mm/copypage-v4mc.c
arch/arm/mm/copypage-v4wb.c
arch/arm/mm/copypage-v4wt.c
arch/arm/mm/copypage-xsc3.c
arch/arm/mm/copypage-xscale.c
include/linux/compiler-gcc.h

index 36f81d967979c0ce62b78912e7d6e3874d9fc06d..6ff7919613d7de1225ec1ca23c1003511194e048 100644 (file)
@@ -88,7 +88,7 @@ void set_fiq_handler(void *start, unsigned int length)
  * disable irqs for the duration.  Note - these functions are almost
  * entirely coded in assembly.
  */
-void __attribute__((naked)) set_fiq_regs(struct pt_regs *regs)
+void __naked set_fiq_regs(struct pt_regs *regs)
 {
        register unsigned long tmp;
        asm volatile (
@@ -106,7 +106,7 @@ void __attribute__((naked)) set_fiq_regs(struct pt_regs *regs)
        : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE));
 }
 
-void __attribute__((naked)) get_fiq_regs(struct pt_regs *regs)
+void __naked get_fiq_regs(struct pt_regs *regs)
 {
        register unsigned long tmp;
        asm volatile (
index c3ba6a94da0cc458ec9b38b24aafaf9a4ba87d0b..70997d5bee2d76d1d617a5ce5453437e51e4c009 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/init.h>
 #include <linux/highmem.h>
 
-static void __attribute__((naked))
+static void __naked
 feroceon_copy_user_page(void *kto, const void *kfrom)
 {
        asm("\
index 70ed96c8af8e6db46fc06ed1f3e835126bbdd20a..de9c06854ad724547b36937fcc57fa2f1905f1e0 100644 (file)
@@ -15,7 +15,7 @@
  *
  * FIXME: do we need to handle cache stuff...
  */
-static void __attribute__((naked))
+static void __naked
 v3_copy_user_page(void *kto, const void *kfrom)
 {
        asm("\n\
index 1601698b9800fa04cac49e5982d530dbb4284931..7370a7142b0424eba7f356151048db8cff66a38f 100644 (file)
@@ -44,7 +44,7 @@ static DEFINE_SPINLOCK(minicache_lock);
  * instruction.  If your processor does not supply this, you have to write your
  * own copy_user_highpage that does the right thing.
  */
-static void __attribute__((naked))
+static void __naked
 mc_copy_user_page(void *from, void *to)
 {
        asm volatile(
index 3ec93dab7656dc34ff3c2135e60de5659d9aa572..9ab098414227e928007212f6159d8fcba88fc763 100644 (file)
@@ -22,7 +22,7 @@
  * instruction.  If your processor does not supply this, you have to write your
  * own copy_user_highpage that does the right thing.
  */
-static void __attribute__((naked))
+static void __naked
 v4wb_copy_user_page(void *kto, const void *kfrom)
 {
        asm("\
index 0f1188efae455e22b3f95af3e760399171a8f3e6..300efafd66431ae02b042df0e065efca88424bf3 100644 (file)
@@ -20,7 +20,7 @@
  * dirty data in the cache.  However, we do have to ensure that
  * subsequent reads are up to date.
  */
-static void __attribute__((naked))
+static void __naked
 v4wt_copy_user_page(void *kto, const void *kfrom)
 {
        asm("\
index 39a994542cadff71c6d829c38b009f343b9bfb18..bc4525f5ab2326d266c828dac8c21f81a7655854 100644 (file)
@@ -29,7 +29,7 @@
  * if we eventually end up using our copied page.
  *
  */
-static void __attribute__((naked))
+static void __naked
 xsc3_mc_copy_user_page(void *kto, const void *kfrom)
 {
        asm("\
index d18f2397ee2dd7b0903514317466251990a78d7f..76824d3e966a5a1b34105775aeb96b8acb086f4d 100644 (file)
@@ -42,7 +42,7 @@ static DEFINE_SPINLOCK(minicache_lock);
  * Dcache aliasing issue.  The writes will be forwarded to the write buffer,
  * and merged as appropriate.
  */
-static void __attribute__((naked))
+static void __naked
 mc_copy_user_page(void *from, void *to)
 {
        /*
index 1514d534deebb7f52361d1ef27382ac791ba955f..a3ed7cb8ca346e7fba7170022c46928480b896a6 100644 (file)
 #define __deprecated                   __attribute__((deprecated))
 #define __packed                       __attribute__((packed))
 #define __weak                         __attribute__((weak))
-#define __naked                                __attribute__((naked))
+
+/*
+ * it doesn't make sense on ARM (currently the only user of __naked) to trace
+ * naked functions 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.
+ */
+#define __naked                                __attribute__((naked)) notrace
+
 #define __noreturn                     __attribute__((noreturn))
 
 /*