mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	linux-kernel@vger.kernel.org, yrl.pp-manager.tt@hitachi.com
Subject: [PATCH 1/2] trace-cmd: [BUGFIX] Initialize handle->options list in tracecmd_attach_cpu_data_fd()
Date: Tue, 24 Jun 2014 02:23:43 +0000	[thread overview]
Message-ID: <20140624022343.14037.69077.stgit@yuno-kbuild.novalocal> (raw)
In-Reply-To: <20140624022340.14037.63549.stgit@yuno-kbuild.novalocal>

This patch initializes handle->options list in tracecmd_attach_cpu_data_fd().

When recorder sends trace data via network, server recording process is
killed by SIGSEGV from the patch 71484a0854f7. This is because add_options()
uses handle->options list from the patch, but tracecmd_attach_cpu_data_fd()
calling add_options() does not initialize the list in spite of allocation of
new handle. As the result, the server recording process will be killed because
handle->options is cleared to zero in tracecmd_attach_cpu_data_fd().

<How to test>
1. Execute network(listen) server
 # trace-cmd listen -p 12345

2. Execute network client
 # trace-cmd record -e sched* -N <server IP>:12345

3. Stop the record on client
 ^C

 Here, network server should output a line "CPUX data recorded at offset=XXXX",
 but current network server aborts silently.

 Moreover the client's per-cpu files are separated. (Normally those files
 are merged into one trace file.)

4. Confirm error on network server
 #  dmesg | tail -1
[18551.537113] trace-cmd[23073]: segfault at ffffffffffffffe8 ip 0000000000432fd1 sp 00007fffffa4caa0 error 5 in trace-cmd[400000+47000]

 After we would introduce this patch, the server will be fully able to output
 the client's tracing data and we will not get this error.

Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
 trace-output.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/trace-output.c b/trace-output.c
index ed81466..b033baa 100644
--- a/trace-output.c
+++ b/trace-output.c
@@ -1202,6 +1202,7 @@ int tracecmd_attach_cpu_data_fd(int fd, int cpus, char * const *cpu_data_files)
 	handle->pevent = tracecmd_get_pevent(ihandle);
 	pevent_ref(pevent);
 	handle->page_size = tracecmd_page_size(ihandle);
+	list_head_init(&handle->options);
 
 	if (tracecmd_append_cpu_data(handle, cpus, cpu_data_files) >= 0)
 		ret = 0;


  reply	other threads:[~2014-06-24  2:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24  2:23 [ PATCH 0/2] [BUGFIX] trace-cmd: Fix two small bugs Yoshihiro YUNOMAE
2014-06-24  2:23 ` Yoshihiro YUNOMAE [this message]
2014-06-27 19:14   ` [PATCH 1/2] trace-cmd: [BUGFIX] Initialize handle->options list in tracecmd_attach_cpu_data_fd() Steven Rostedt
2014-06-24  2:23 ` [PATCH 2/2] trace-cmd: [BUGFIX] Don't die if an instance does not have 'current_tracer' file Yoshihiro YUNOMAE
2014-06-27 19:17   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140624022343.14037.69077.stgit@yuno-kbuild.novalocal \
    --to=yoshihiro.yunomae.ez@hitachi.com \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=rostedt@goodmis.org \
    --cc=yrl.pp-manager.tt@hitachi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®