Pull tracing fixes from Steven Rostedt: "A few updates and fixes: - move the suppressing of the __builtin_return_address >0 warning to the tracing directory only. - metag recordmcount fix for newer glibc's - two tracing histogram fixes that were reported by KASAN" * tag 'trace-v4.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Fix use-after-free in hist_register_trigger() tracing: Fix use-after-free in hist_unreg_all/hist_enable_unreg_all Makefile: Mute warning for __builtin_return_address(>0) for tracing only ftrace/recordmcount: Work around for addition of metag magic but not relocations
Unified · Split
| @@ -621,7 +621,6 @@ include arch/$(SRCARCH)/Makefile · 620 unmodified lines | ||
| 621 | 621 | |
| 622 | 622 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) |
| 623 | 623 | KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) |
| 624 | −KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) | |
| 625 | 624 | |
| 626 | 625 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
| 627 | 626 | KBUILD_CFLAGS += -Os |
| @@ -1,4 +1,8 @@ | ||
| 1 | 1 | |
| 2 | +# We are fully aware of the dangers of __builtin_return_address() | |
| 3 | +FRAME_CFLAGS := $(call cc-disable-warning,frame-address) | |
| 4 | +KBUILD_CFLAGS += $(FRAME_CFLAGS) | |
| 5 | + | |
| 2 | 6 | # Do not instrument the tracer itself: |
| 3 | 7 | |
| 4 | 8 | ifdef CONFIG_FUNCTION_TRACER |
| @@ -1441,6 +1441,9 @@ static int hist_register_trigger(char *glob, struct event_trigger_ops *ops, · 1440 unmodified lines | ||
| 1441 | 1441 | goto out; |
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | + if (hist_data->attrs->pause) | |
| 1445 | + data->paused = true; | |
| 1446 | + | |
| 1444 | 1447 | if (named_data) { |
| 1445 | 1448 | destroy_hist_data(data->private_data); |
| 1446 | 1449 | data->private_data = named_data->private_data; |
| @@ -1448,9 +1451,6 @@ static int hist_register_trigger(char *glob, struct event_trigger_ops *ops, · 1 unmodified line | ||
| 1448 | 1451 | data->ops = &event_hist_trigger_named_ops; |
| 1449 | 1452 | } |
| 1450 | 1453 | |
| 1451 | − if (hist_data->attrs->pause) | |
| 1452 | − data->paused = true; | |
| 1453 | − | |
| 1454 | 1454 | if (data->ops->init) { |
| 1455 | 1455 | ret = data->ops->init(data->ops, data); |
| 1456 | 1456 | if (ret < 0) |
| @@ -1500,9 +1500,9 @@ static void hist_unregister_trigger(char *glob, struct event_trigger_ops *ops, · 43 unmodified lines | ||
| 1500 | 1500 | |
| 1501 | 1501 | static void hist_unreg_all(struct trace_event_file *file) |
| 1502 | 1502 | { |
| 1503 | − struct event_trigger_data *test; | |
| 1503 | + struct event_trigger_data *test, *n; | |
| 1504 | 1504 | |
| 1505 | − list_for_each_entry_rcu(test, &file->triggers, list) { | |
| 1505 | + list_for_each_entry_safe(test, n, &file->triggers, list) { | |
| 1506 | 1506 | if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { |
| 1507 | 1507 | list_del_rcu(&test->list); |
| 1508 | 1508 | trace_event_trigger_enable_disable(file, 0); |
| @@ -1699,9 +1699,9 @@ hist_enable_get_trigger_ops(char *cmd, char *param) · 190 unmodified lines | ||
| 1699 | 1699 | |
| 1700 | 1700 | static void hist_enable_unreg_all(struct trace_event_file *file) |
| 1701 | 1701 | { |
| 1702 | − struct event_trigger_data *test; | |
| 1702 | + struct event_trigger_data *test, *n; | |
| 1703 | 1703 | |
| 1704 | − list_for_each_entry_rcu(test, &file->triggers, list) { | |
| 1704 | + list_for_each_entry_safe(test, n, &file->triggers, list) { | |
| 1705 | 1705 | if (test->cmd_ops->trigger_type == ETT_HIST_ENABLE) { |
| 1706 | 1706 | list_del_rcu(&test->list); |
| 1707 | 1707 | update_cond_flag(file); |
| @@ -33,10 +33,17 @@ · 32 unmodified lines | ||
| 33 | 33 | #include <string.h> |
| 34 | 34 | #include <unistd.h> |
| 35 | 35 | |
| 36 | +/* | |
| 37 | + * glibc synced up and added the metag number but didn't add the relocations. | |
| 38 | + * Work around this in a crude manner for now. | |
| 39 | + */ | |
| 36 | 40 | #ifndef EM_METAG |
| 37 | −/* Remove this when these make it to the standard system elf.h. */ | |
| 38 | 41 | #define EM_METAG 174 |
| 42 | +#endif | |
| 43 | +#ifndef R_METAG_ADDR32 | |
| 39 | 44 | #define R_METAG_ADDR32 2 |
| 45 | +#endif | |
| 46 | +#ifndef R_METAG_NONE | |
| 40 | 47 | #define R_METAG_NONE 3 |
| 41 | 48 | #endif |
| 42 | 49 | |