aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/syscalls.h
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2010-02-24 13:59:23 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-25 09:38:11 -0500
commit86c38a31aa7f2dd6e74a262710bf8ebf7455acc5 (patch)
tree167d2c46917233373e597cc5f82d3f9132170e65 /include/linux/syscalls.h
parent0c54dd341fb701928b8e5dca91ced1870c55b05b (diff)
tracing: Fix ftrace_event_call alignment for use with gcc 4.5
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>
Diffstat (limited to 'include/linux/syscalls.h')
-rw-r--r--include/linux/syscalls.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 7b219696ad24..91bd7d78a07d 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 }; \
@@ -153,7 +154,8 @@ struct perf_event_attr;
153 154
154#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 155#define SYSCALL_TRACE_EXIT_EVENT(sname) \
155 static const struct syscall_metadata __syscall_meta_##sname; \ 156 static const struct syscall_metadata __syscall_meta_##sname; \
156 static struct ftrace_event_call event_exit_##sname; \ 157 static struct ftrace_event_call \
158 __attribute__((__aligned__(4))) event_exit_##sname; \
157 static struct trace_event exit_syscall_print_##sname = { \ 159 static struct trace_event exit_syscall_print_##sname = { \
158 .trace = print_syscall_exit, \ 160 .trace = print_syscall_exit, \
159 }; \ 161 }; \