Linux-Trace-Devel Archive on
 help / color / Atom feed
* [PATCH v2] trace-cmd: Fix segmentation fault in tracecmd_read_at() in specific use case
@ 2019-10-15 10:56 Tzvetomir Stoyanov (VMware)
  0 siblings, 0 replies; only message in thread
From: Tzvetomir Stoyanov (VMware) @ 2019-10-15 10:56 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

There is a segmentation fault in update_page_info() when the requested page
is not loaded, handle->cpu_data[cpu].page is NULL. The problematic flow starts
from tracecmd_read_at() API, when reading offset in the first page (less than 4K),
and this page is still not loaded. The problem can be observed randomly -
there is a sporadic KernelShark crash when loading a file, browsing and
zooming events.
Signed-off-by: Tzvetomir Stoyanov (VMware) <>
  v2 changes:
   - Moved the check for NULL page after the loop, as Steven Rostedt
 lib/trace-cmd/trace-input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 6102eb3..43bdf6a 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -1282,7 +1282,7 @@ tracecmd_read_at(struct tracecmd_input *handle, unsigned long long offset,
-	if (cpu < handle->cpus) {
+	if (cpu < handle->cpus && handle->cpu_data[cpu].page) {
 		if (pcpu)
 			*pcpu = cpu;
 		return read_event(handle, offset, cpu);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 10:56 [PATCH v2] trace-cmd: Fix segmentation fault in tracecmd_read_at() in specific use case Tzvetomir Stoyanov (VMware)

Linux-Trace-Devel Archive on

Archives are clonable:
	git clone --mirror linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ \
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone