]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
.32 patch
authorGreg Kroah-Hartman <gregkh@suse.de>
Mon, 10 May 2010 17:47:36 +0000 (10:47 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 10 May 2010 17:47:36 +0000 (10:47 -0700)
queue-2.6.32/series
queue-2.6.32/tracing-fix-ftrace_event_call-alignment-for-use-with-gcc-4.5.patch [new file with mode: 0644]

index c339bbebc5cab06513cfad2d034fb2f09184f593..fe21d18b1b82950b0c32a3b0d9f4e5fa3e762c2c 100644 (file)
@@ -78,3 +78,4 @@ xfs-add-a-shrinker-to-background-inode-reclaim.patch
 parisc-set-pci-cls-early-in-boot.patch
 qla2xxx-properly-handle-underrun-completion-statuses.patch
 bnx2-fix-lost-msi-x-problem-on-5709-nics.patch
+tracing-fix-ftrace_event_call-alignment-for-use-with-gcc-4.5.patch
diff --git a/queue-2.6.32/tracing-fix-ftrace_event_call-alignment-for-use-with-gcc-4.5.patch b/queue-2.6.32/tracing-fix-ftrace_event_call-alignment-for-use-with-gcc-4.5.patch
new file mode 100644 (file)
index 0000000..adfe3ba
--- /dev/null
@@ -0,0 +1,91 @@
+From 86c38a31aa7f2dd6e74a262710bf8ebf7455acc5 Mon Sep 17 00:00:00 2001
+From: Jeff Mahoney <jeffm@suse.com>
+Date: Wed, 24 Feb 2010 13:59:23 -0500
+Subject: tracing: Fix ftrace_event_call alignment for use with gcc 4.5
+
+From: Jeff Mahoney <jeffm@suse.com>
+
+commit 86c38a31aa7f2dd6e74a262710bf8ebf7455acc5 upstream.
+
+GCC 4.5 introduces behavior that forces the alignment of structures to
+ use the largest possible value. The default value is 32 bytes, so if
+ some structures are defined with a 4-byte alignment and others aren't
+ declared with an alignment constraint at all - it will align at 32-bytes.
+
+ For things like the ftrace events, this results in a non-standard array.
+ When initializing the ftrace subsystem, we traverse the _ftrace_events
+ section and call the initialization callback for each event. When the
+ structures are misaligned, we could be treating another part of the
+ structure (or the zeroed out space between them) as a function pointer.
+
+ This patch forces the alignment for all the ftrace_event_call structures
+ to 4 bytes.
+
+ Without this patch, the kernel fails to boot very early when built with
+ gcc 4.5.
+
+ It's trivial to check the alignment of the members of the array, so it
+ might be worthwhile to add something to the build system to do that
+ automatically. Unfortunately, that only covers this case. I've asked one
+ of the gcc developers about adding a warning when this condition is seen.
+
+Cc: stable@kernel.org
+Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+LKML-Reference: <4B85770B.6010901@suse.com>
+Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
+Cc: Andreas Radke <a.radke@arcor.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ include/linux/syscalls.h |    6 ++++--
+ include/trace/ftrace.h   |    3 ++-
+ kernel/trace/trace.h     |    3 ++-
+ 3 files changed, 8 insertions(+), 4 deletions(-)
+
+--- a/include/linux/syscalls.h
++++ b/include/linux/syscalls.h
+@@ -153,7 +153,8 @@ static void prof_sysexit_disable_##sname
+ #define __SC_STR_TDECL6(t, a, ...)    #t, __SC_STR_TDECL5(__VA_ARGS__)
+ #define SYSCALL_TRACE_ENTER_EVENT(sname)                              \
+-      static struct ftrace_event_call event_enter_##sname;            \
++      static struct ftrace_event_call                                 \
++      __attribute__((__aligned__(4))) event_enter_##sname;            \
+       struct trace_event enter_syscall_print_##sname = {              \
+               .trace                  = print_syscall_enter,          \
+       };                                                              \
+@@ -189,7 +190,8 @@ static void prof_sysexit_disable_##sname
+       }
+ #define SYSCALL_TRACE_EXIT_EVENT(sname)                                       \
+-      static struct ftrace_event_call event_exit_##sname;             \
++      static struct ftrace_event_call                                 \
++      __attribute__((__aligned__(4))) event_exit_##sname;             \
+       struct trace_event exit_syscall_print_##sname = {               \
+               .trace                  = print_syscall_exit,           \
+       };                                                              \
+--- a/include/trace/ftrace.h
++++ b/include/trace/ftrace.h
+@@ -43,7 +43,8 @@
+               tstruct                                         \
+               char                    __data[0];              \
+       };                                                      \
+-      static struct ftrace_event_call event_##name
++      static struct ftrace_event_call                 \
++      __attribute__((__aligned__(4))) event_##name
+ #undef __cpparg
+ #define __cpparg(arg...) arg
+--- a/kernel/trace/trace.h
++++ b/kernel/trace/trace.h
+@@ -746,7 +746,8 @@ extern const char *__stop___trace_bprint
+ #undef FTRACE_ENTRY
+ #define FTRACE_ENTRY(call, struct_name, id, tstruct, print)           \
+-      extern struct ftrace_event_call event_##call;
++      extern struct ftrace_event_call                                 \
++      __attribute__((__aligned__(4))) event_##call;
+ #undef FTRACE_ENTRY_DUP
+ #define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print)               \
+       FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print))