.. | .. |
---|
5 | 5 | * Copyright (C) 2013 Tom Zanussi <tom.zanussi@linux.intel.com> |
---|
6 | 6 | */ |
---|
7 | 7 | |
---|
| 8 | +#include <linux/security.h> |
---|
8 | 9 | #include <linux/module.h> |
---|
9 | 10 | #include <linux/ctype.h> |
---|
10 | 11 | #include <linux/mutex.h> |
---|
.. | .. |
---|
174 | 175 | |
---|
175 | 176 | static int event_trigger_regex_open(struct inode *inode, struct file *file) |
---|
176 | 177 | { |
---|
177 | | - int ret = 0; |
---|
| 178 | + int ret; |
---|
| 179 | + |
---|
| 180 | + ret = security_locked_down(LOCKDOWN_TRACEFS); |
---|
| 181 | + if (ret) |
---|
| 182 | + return ret; |
---|
178 | 183 | |
---|
179 | 184 | mutex_lock(&event_mutex); |
---|
180 | 185 | |
---|
.. | .. |
---|
209 | 214 | return ret; |
---|
210 | 215 | } |
---|
211 | 216 | |
---|
212 | | -static int trigger_process_regex(struct trace_event_file *file, char *buff) |
---|
| 217 | +int trigger_process_regex(struct trace_event_file *file, char *buff) |
---|
213 | 218 | { |
---|
214 | 219 | char *command, *next; |
---|
215 | 220 | struct event_command *p; |
---|
.. | .. |
---|
299 | 304 | static int |
---|
300 | 305 | event_trigger_open(struct inode *inode, struct file *filp) |
---|
301 | 306 | { |
---|
| 307 | + /* Checks for tracefs lockdown */ |
---|
302 | 308 | return event_trigger_regex_open(inode, filp); |
---|
303 | 309 | } |
---|
304 | 310 | |
---|
.. | .. |
---|
750 | 756 | goto out; |
---|
751 | 757 | |
---|
752 | 758 | /* The filter is for the 'trigger' event, not the triggered event */ |
---|
753 | | - ret = create_event_filter(file->event_call, filter_str, false, &filter); |
---|
| 759 | + ret = create_event_filter(file->tr, file->event_call, |
---|
| 760 | + filter_str, false, &filter); |
---|
754 | 761 | /* |
---|
755 | 762 | * If create_event_filter() fails, filter still needs to be freed. |
---|
756 | 763 | * Which the calling code will do with data->filter. |
---|
.. | .. |
---|
1212 | 1219 | stacktrace_trigger(struct event_trigger_data *data, void *rec, |
---|
1213 | 1220 | struct ring_buffer_event *event) |
---|
1214 | 1221 | { |
---|
1215 | | - trace_dump_stack(STACK_SKIP); |
---|
| 1222 | + struct trace_event_file *file = data->private_data; |
---|
| 1223 | + unsigned long flags; |
---|
| 1224 | + |
---|
| 1225 | + if (file) { |
---|
| 1226 | + local_save_flags(flags); |
---|
| 1227 | + __trace_stack(file->tr, flags, STACK_SKIP, preempt_count()); |
---|
| 1228 | + } else |
---|
| 1229 | + trace_dump_stack(STACK_SKIP); |
---|
1216 | 1230 | } |
---|
1217 | 1231 | |
---|
1218 | 1232 | static void |
---|