aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2010-02-24 13:59:23 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-15 12:06:17 -0400
commit89a724c83c09eb2d28df4dc150b6d17954f25d7b (patch)
treee33354149550aab7aaeea96ed858c45690ea52cb /include
parent21a6adcde06e129b055caa3256e65a97a2986770 (diff)
tracing: Fix ftrace_event_call alignment for use with gcc 4.5
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. Signed-off-by: Jeff Mahoney <jeffm@suse.com> LKML-Reference: <4B85770B.6010901@suse.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/syscalls.h6
-rw-r--r--include/trace/ftrace.h3
2 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 207466a49f3d..254077057cb8 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -132,7 +132,8 @@ struct perf_event_attr;
132 132
133#define SYSCALL_TRACE_ENTER_EVENT(sname) \ 133#define SYSCALL_TRACE_ENTER_EVENT(sname) \
134 static const struct syscall_metadata __syscall_meta_##sname; \ 134 static const struct syscall_metadata __syscall_meta_##sname; \
135 static struct ftrace_event_call event_enter_##sname; \ 135 static struct ftrace_event_call \
136 __attribute__((__aligned__(4))) event_enter_##sname; \
136 static struct trace_event enter_syscall_print_##sname = { \ 137 static struct trace_event enter_syscall_print_##sname = { \
137 .trace = print_syscall_enter, \ 138 .trace = print_syscall_enter, \
138 }; \ 139 }; \
@@ -154,7 +155,8 @@ struct perf_event_attr;
154 155
155#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 156#define SYSCALL_TRACE_EXIT_EVENT(sname) \
156 static const struct syscall_metadata __syscall_meta_##sname; \ 157 static const struct syscall_metadata __syscall_meta_##sname; \
157 static struct ftrace_event_call event_exit_##sname; \ 158 static struct ftrace_event_call \
159 __attribute__((__aligned__(4))) event_exit_##sname; \
158 static struct trace_event exit_syscall_print_##sname = { \ 160 static struct trace_event exit_syscall_print_##sname = { \
159 .trace = print_syscall_exit, \ 161 .trace = print_syscall_exit, \
160 }; \ 162 }; \
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index c6fe03e902ca..1ca49902094c 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -65,7 +65,8 @@
65 }; 65 };
66#undef DEFINE_EVENT 66#undef DEFINE_EVENT
67#define DEFINE_EVENT(template, name, proto, args) \ 67#define DEFINE_EVENT(template, name, proto, args) \
68 static struct ftrace_event_call event_##name 68 static struct ftrace_event_call \
69 __attribute__((__aligned__(4))) event_##name
69 70
70#undef DEFINE_EVENT_PRINT 71#undef DEFINE_EVENT_PRINT
71#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 72#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \