History

Merge tag 'trace-v4.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

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

Linus Torvalds committed 10 years ago

Commit bf0f5002 parents 4b2e016 7522c034 files · +19 −9Browse files

Unified · Split

4 files
  1. Makefile +0 −1
  2. kernel/trace/Makefile +4 −0
  3. kernel/trace/trace_events_hist.c +7 −7
  4. scripts/recordmcount.c +8 −1
Makefile+0−1
@@ -621,7 +621,6 @@ include arch/$(SRCARCH)/Makefile · 620 unmodified lines
621621
622622 KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
623623 KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
624−KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
625624
626625 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
627626 KBUILD_CFLAGS += -Os
kernel/trace/Makefile+4−0
@@ -1,4 +1,8 @@
11
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+
26 # Do not instrument the tracer itself:
37
48 ifdef CONFIG_FUNCTION_TRACER
kernel/trace/trace_events_hist.c+7−7
@@ -1441,6 +1441,9 @@ static int hist_register_trigger(char *glob, struct event_trigger_ops *ops, · 1440 unmodified lines
14411441 goto out;
14421442 }
14431443
1444+ if (hist_data->attrs->pause)
1445+ data->paused = true;
1446+
14441447 if (named_data) {
14451448 destroy_hist_data(data->private_data);
14461449 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
14481451 data->ops = &event_hist_trigger_named_ops;
14491452 }
14501453
1451− if (hist_data->attrs->pause)
1452− data->paused = true;
1453−
14541454 if (data->ops->init) {
14551455 ret = data->ops->init(data->ops, data);
14561456 if (ret < 0)
@@ -1500,9 +1500,9 @@ static void hist_unregister_trigger(char *glob, struct event_trigger_ops *ops, · 43 unmodified lines
15001500
15011501 static void hist_unreg_all(struct trace_event_file *file)
15021502 {
1503− struct event_trigger_data *test;
1503+ struct event_trigger_data *test, *n;
15041504
1505− list_for_each_entry_rcu(test, &file->triggers, list) {
1505+ list_for_each_entry_safe(test, n, &file->triggers, list) {
15061506 if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) {
15071507 list_del_rcu(&test->list);
15081508 trace_event_trigger_enable_disable(file, 0);
@@ -1699,9 +1699,9 @@ hist_enable_get_trigger_ops(char *cmd, char *param) · 190 unmodified lines
16991699
17001700 static void hist_enable_unreg_all(struct trace_event_file *file)
17011701 {
1702− struct event_trigger_data *test;
1702+ struct event_trigger_data *test, *n;
17031703
1704− list_for_each_entry_rcu(test, &file->triggers, list) {
1704+ list_for_each_entry_safe(test, n, &file->triggers, list) {
17051705 if (test->cmd_ops->trigger_type == ETT_HIST_ENABLE) {
17061706 list_del_rcu(&test->list);
17071707 update_cond_flag(file);
scripts/recordmcount.c+8−1
@@ -33,10 +33,17 @@ · 32 unmodified lines
3333 #include <string.h>
3434 #include <unistd.h>
3535
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+ */
3640 #ifndef EM_METAG
37−/* Remove this when these make it to the standard system elf.h. */
3841 #define EM_METAG 174
42+#endif
43+#ifndef R_METAG_ADDR32
3944 #define R_METAG_ADDR32 2
45+#endif
46+#ifndef R_METAG_NONE
4047 #define R_METAG_NONE 3
4148 #endif
4249