linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] trace-cmd: Fixes for four minor bugs
@ 2017-10-16 16:55 Michael Sartain
  2017-10-16 16:55 ` [PATCH v2 1/4] trace-cmd: Fix incorrect malloc size arg: *item instead of item Michael Sartain
                   ` (3 more replies)
  0 siblings, 4 replies; 51+ messages in thread
From: Michael Sartain @ 2017-10-16 16:55 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Michael Sartain, linux-kernel

Thanks Steve.
 -Mike

v2: check malloc size, use UL suffix, and unsigned parameter

Michael Sartain (4):
  trace-cmd: Fix incorrect malloc size arg: *item instead of item
  trace-cmd: Fix NULL pointer being passed to memcpy
  trace-cmd: Add UL suffix to MISSING_EVENTS since ints shouldn't be
    left shifted by 31
  trace-cmd: Use unsigned values in Hsieh's trace_hash fast hash
    function

 kbuffer-parse.c    | 4 ++--
 trace-dialog.c     | 2 +-
 trace-hash-local.h | 4 ++--
 trace-output.c     | 6 +++++-
 4 files changed, 10 insertions(+), 6 deletions(-)

-- 
2.14.2

^ permalink raw reply	[flat|nested] 51+ messages in thread
* [PATCH 00/10] tools lib traceveent: Pull updates from trace-cmd library
@ 2018-01-12  0:47 Steven Rostedt
  2018-01-12  0:47 ` [PATCH 01/10] lib, traceevent: Fix bad force_token escape sequence Steven Rostedt
                   ` (10 more replies)
  0 siblings, 11 replies; 51+ messages in thread
From: Steven Rostedt @ 2018-01-12  0:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Andrew Morton, Namhyung Kim


I went through the commits that were added to event-parse in trace-cmd
and synced them up for what is in tools/lib/traceevent. These are
patches that are missing from the kernel tree.

Federico Vaga (1):
      lib traceevent: Use asprintf when possible

Jan Kiszka (1):
      lib traceevent: Print value of unknown symbolic fields

Michael Sartain (2):
      lib, traceevent: Fix bad force_token escape sequence
      lib traceevent: Add UL suffix to MISSING_EVENTS

Steven Rostedt (VMware) (5):
      lib traceevent: Show value of flags that have not been parsed
      lib traceevent: Simplify pointer print logic and fix %pF
      lib traceevent: Handle new pointer processing of bprint strings
      lib traceevent: Show contents (in hex) of data of unrecognized type records
      lib traceevent: Fix get_field_str() for dynamic strings

Taeung Song (1):
      lib traceeevent: Fix missing break in FALSE case of pevent_filter_clear_trivial()

----
 tools/lib/traceevent/event-parse.c   | 62 +++++++++++++++++++++++++++++-------
 tools/lib/traceevent/event-plugin.c  | 24 ++++++--------
 tools/lib/traceevent/kbuffer-parse.c |  4 +--
 tools/lib/traceevent/parse-filter.c  | 22 ++++++++-----
 4 files changed, 76 insertions(+), 36 deletions(-)

^ permalink raw reply	[flat|nested] 51+ messages in thread
* [PATCH][trace-cmd] Print value of unknown symbolic fields
@ 2017-09-28 20:13 Jan Kiszka
  2017-10-03 22:46 ` Steven Rostedt
  2017-10-03 23:12 ` Steven Rostedt
  0 siblings, 2 replies; 51+ messages in thread
From: Jan Kiszka @ 2017-09-28 20:13 UTC (permalink / raw)
  To: Steven Rostedt, Linux Kernel Mailing List

From: Jan Kiszka <jan.kiszka@siemens.com>

Aligns trace-cmd with the behavior of the kernel.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 event-parse.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/event-parse.c b/event-parse.c
index 606da5b..25e0874 100644
--- a/event-parse.c
+++ b/event-parse.c
@@ -3960,6 +3960,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
 				break;
 			}
 		}
+		if (!flag)
+			trace_seq_printf(s, "0x%llx", val);
 		break;
 	case PRINT_HEX:
 		if (arg->hex.field->type == PRINT_DYNAMIC_ARRAY) {
-- 
2.12.3

^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [PATCH V3 1/2] use direname instead of custom code
@ 2017-08-02 22:15 Federico Vaga
  2017-08-02 22:15 ` [PATCH V3 2/2] It makes the code clearer and less error prone Federico Vaga
                   ` (2 more replies)
  0 siblings, 3 replies; 51+ messages in thread
From: Federico Vaga @ 2017-08-02 22:15 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML, Federico Vaga

Prefer well known functions like `dirname(3)` instead of custom
implementation for the same functionality

Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it>
---
 trace-record.c | 45 ++++++++++++++++++++++++++++++---------------
 1 file changed, 30 insertions(+), 15 deletions(-)

diff --git a/trace-record.c b/trace-record.c
index 020a373..79e4fe4 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -45,6 +45,7 @@
 #include <glob.h>
 #include <errno.h>
 #include <limits.h>
+#include <libgen.h>
 
 #include "trace-local.h"
 #include "trace-msg.h"
@@ -2215,12 +2216,24 @@ static void set_max_graph_depth(struct buffer_instance *instance, char *max_grap
 		die("could not write to max_graph_depth");
 }
 
+
+/**
+ * create_event - create and event descriptor
+ * @instance: instance to use
+ * @path: path to event attribute
+ * @old_event: event descriptor to use as base
+ *
+ * NOTE: the function purpose is to create a data structure to describe
+ * an ftrace event. During the process it becomes handy to change the
+ * string `path`. So, do not rely on the content of `path` after you
+ * invoke this function.
+ */
 static struct event_list *
 create_event(struct buffer_instance *instance, char *path, struct event_list *old_event)
 {
 	struct event_list *event;
 	struct stat st;
-	char *p;
+	char *p, *path_dirname;
 	int ret;
 
 	event = malloc(sizeof(*event));
@@ -2234,14 +2247,14 @@ create_event(struct buffer_instance *instance, char *path, struct event_list *ol
 		if (!event->filter_file)
 			die("malloc filter file");
 	}
-	for (p = path + strlen(path) - 1; p > path; p--)
-		if (*p == '/')
-			break;
-	*p = '\0';
-	p = malloc(strlen(path) + strlen("/enable") + 1);
+
+	path_dirname = dirname(path);
+
+	p = malloc(strlen(path_dirname) + strlen("/enable") + 1);
 	if (!p)
 		die("Failed to allocate enable path for %s", path);
-	sprintf(p, "%s/enable", path);
+	sprintf(p, "%s/enable", path_dirname);
+
 	ret = stat(p, &st);
 	if (ret >= 0)
 		event->enable_file = p;
@@ -2249,10 +2262,11 @@ create_event(struct buffer_instance *instance, char *path, struct event_list *ol
 		free(p);
 
 	if (event->trigger) {
-		p = malloc(strlen(path) + strlen("/trigger") + 1);
+		p = malloc(strlen(path_dirname) + strlen("/trigger") + 1);
 		if (!p)
 			die("Failed to allocate trigger path for %s", path);
-		sprintf(p, "%s/trigger", path);
+		sprintf(p, "%s/trigger", path_dirname);
+
 		ret = stat(p, &st);
 		if (ret > 0)
 			die("trigger specified but not supported by this kernel");
@@ -2266,8 +2280,7 @@ static void make_sched_event(struct buffer_instance *instance,
 			     struct event_list **event, struct event_list *sched,
 			     const char *sched_path)
 {
-	char *path;
-	char *p;
+	char *path, *path_dirname, *sched_filter_file_tmp;
 
 	/* Do nothing if the event already exists */
 	if (*event)
@@ -2277,11 +2290,13 @@ static void make_sched_event(struct buffer_instance *instance,
 	if (!path)
 		die("Failed to allocate path for %s", sched_path);
 
-	sprintf(path, "%s", sched->filter_file);
+	/* we do not want to corrupt sched->filter_file when using dirname() */
+	sched_filter_file_tmp = strdup(sched->filter_file);
+	if (!sched_filter_file_tmp)
+		die("Failed to allocate path for %s", sched_path);
+	path_dirname = dirname(sched_filter_file_tmp);
 
-	/* Remove the /filter from filter file */
-	p = path + strlen(path) - strlen("filter");
-	sprintf(p, "%s/filter", sched_path);
+	sprintf(path, "%s/%s/filter", path_dirname, sched_path);
 
 	*event = create_event(instance, path, sched);
 	free(path);
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [PATCH v3 0/6] trace-cmd: escape sequence, EINTR, error checking bug fixes
@ 2017-06-15  0:27 Michael Sartain
  2017-06-15  0:27 ` [PATCH v3 1/6] Fix bad force_token escape sequence Michael Sartain
                   ` (5 more replies)
  0 siblings, 6 replies; 51+ messages in thread
From: Michael Sartain @ 2017-06-15  0:27 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Michael Sartain, linux-kernel

This patch adds fixes to trace-cmd for return value checking, EINTR handling,
function prototypes, and data offsets to initial patch escape sequence fix [1].

Thanks much.
 -Mike

v2->v3:
  Fix attachments (aka learn how to use Mutt)
v1->v2:
  Add five related bug fix patches

Michael Sartain (6):
  Fix bad force_token escape sequence
  Fix unsigned return values being error checked as negative
  Handle EINTR signal interrupts for read, write, open calls
  Fix read / write data offsets in read / write loops
  Fix function prototypes for __vwarning, __vpr_stat, and __vdie
  Fix cases where string literals were passed as string format args

 event-parse.c     |   2 +-
 event-utils.h     |   4 +-
 parse-utils.c     |   2 +
 trace-capture.c   |  12 ++--
 trace-cmd-local.h |   2 +-
 trace-dialog.c    |   4 +-
 trace-filter.c    |  10 +--
 trace-input.c     | 187 +++++++++++++++++++++++-------------------------------
 trace-local.h     |   2 +-
 trace-msg.c       |  13 ++--
 10 files changed, 104 insertions(+), 134 deletions(-)

[1] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1414382.html

-- 
2.11.0

^ permalink raw reply	[flat|nested] 51+ messages in thread

end of thread, other threads:[~2018-01-17 16:34 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-16 16:55 [PATCH v2 0/4] trace-cmd: Fixes for four minor bugs Michael Sartain
2017-10-16 16:55 ` [PATCH v2 1/4] trace-cmd: Fix incorrect malloc size arg: *item instead of item Michael Sartain
2017-10-16 16:55 ` [PATCH v2 2/4] trace-cmd: Fix NULL pointer being passed to memcpy Michael Sartain
2017-10-16 16:55 ` [PATCH v2 3/4] trace-cmd: Add UL suffix to MISSING_EVENTS since ints shouldn't be left shifted by 31 Michael Sartain
2017-10-16 16:55 ` [PATCH v2 4/4] trace-cmd: Use unsigned values in Hsieh's trace_hash fast hash function Michael Sartain
  -- strict thread matches above, loose matches on Subject: below --
2018-01-12  0:47 [PATCH 00/10] tools lib traceveent: Pull updates from trace-cmd library Steven Rostedt
2018-01-12  0:47 ` [PATCH 01/10] lib, traceevent: Fix bad force_token escape sequence Steven Rostedt
2018-01-12  0:47 ` [PATCH 02/10] lib traceevent: Show value of flags that have not been parsed Steven Rostedt
2018-01-17 16:28   ` [tip:perf/core] tools " tip-bot for Steven Rostedt (VMware)
2018-01-12  0:47 ` [PATCH 03/10] lib traceevent: Print value of unknown symbolic fields Steven Rostedt
2018-01-17 16:28   ` [tip:perf/core] tools " tip-bot for Jan Kiszka
2018-01-12  0:47 ` [PATCH 04/10] lib traceevent: Simplify pointer print logic and fix %pF Steven Rostedt
2018-01-17 16:29   ` [tip:perf/core] tools " tip-bot for Steven Rostedt (VMware)
2018-01-12  0:47 ` [PATCH 05/10] lib traceevent: Handle new pointer processing of bprint strings Steven Rostedt
2018-01-17 16:29   ` [tip:perf/core] tools " tip-bot for Steven Rostedt (VMware)
2018-01-12  0:47 ` [PATCH 06/10] lib traceevent: Show contents (in hex) of data of unrecognized type records Steven Rostedt
2018-01-17 16:30   ` [tip:perf/core] tools " tip-bot for Steven Rostedt (VMware)
2018-01-12  0:47 ` [PATCH 07/10] lib traceevent: Use asprintf when possible Steven Rostedt
2018-01-17 16:30   ` [tip:perf/core] tools " tip-bot for Federico Vaga
2018-01-12  0:47 ` [PATCH 08/10] lib traceevent: Add UL suffix to MISSING_EVENTS Steven Rostedt
2018-01-17 16:31   ` [tip:perf/core] tools " tip-bot for Michael Sartain
2018-01-12  0:47 ` [PATCH 09/10] lib traceeevent: Fix missing break in FALSE case of pevent_filter_clear_trivial() Steven Rostedt
2017-04-26 14:55   ` [PATCH] parse-events: Fix the FALSE case in pevent_filter_clear_trivial() Taeung Song
2018-01-17 16:31     ` [tip:perf/core] tools lib traceevent: Fix missing break in FALSE case of pevent_filter_clear_trivial() tip-bot for Taeung Song
2018-01-12  1:00   ` [PATCH 09/10] lib traceeevent: " Taeung Song
2018-01-12  1:14     ` Steven Rostedt
2018-01-12 16:02       ` Arnaldo Carvalho de Melo
2018-01-12  0:47 ` [PATCH 10/10] lib traceevent: Fix get_field_str() for dynamic strings Steven Rostedt
2018-01-17 16:31   ` [tip:perf/core] tools " tip-bot for Steven Rostedt (VMware)
2018-01-17  6:02 ` [PATCH 00/10] tools lib traceveent: Pull updates from trace-cmd library Namhyung Kim
2017-09-28 20:13 [PATCH][trace-cmd] Print value of unknown symbolic fields Jan Kiszka
2017-10-03 22:46 ` Steven Rostedt
2017-10-03 23:12 ` Steven Rostedt
2017-08-02 22:15 [PATCH V3 1/2] use direname instead of custom code Federico Vaga
2017-08-02 22:15 ` [PATCH V3 2/2] It makes the code clearer and less error prone Federico Vaga
2017-08-14 17:33   ` Steven Rostedt
2017-08-15  7:25     ` Federico Vaga
2017-11-08 18:50       ` Steven Rostedt
2017-08-02 23:48 ` [PATCH V3 1/2] trace-cmd record: use direname instead of custom code Steven Rostedt
2017-08-14 17:14 ` [PATCH V3 1/2] " Steven Rostedt
2017-06-15  0:27 [PATCH v3 0/6] trace-cmd: escape sequence, EINTR, error checking bug fixes Michael Sartain
2017-06-15  0:27 ` [PATCH v3 1/6] Fix bad force_token escape sequence Michael Sartain
2018-01-17 16:28   ` [tip:perf/core] tools lib traceevent: " tip-bot for Michael Sartain
2017-06-15  0:27 ` [PATCH v3 2/6] Fix unsigned return values being error checked as negative Michael Sartain
2017-06-15  0:27 ` [PATCH v3 3/6] Handle EINTR signal interrupts for read, write, open calls Michael Sartain
2017-06-21 13:26   ` Steven Rostedt
2017-06-15  0:27 ` [PATCH v3 4/6] Fix read / write data offsets in read / write loops Michael Sartain
2017-06-21 13:29   ` Steven Rostedt
2017-06-21 17:36     ` Michael Sartain
2017-06-15  0:28 ` [PATCH v3 5/6] Fix function prototypes for __vwarning, __vpr_stat, and __vdie Michael Sartain
2017-06-15  0:28 ` [PATCH v3 6/6] Fix cases where string literals were passed as string format args Michael Sartain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).