Thread (31 messages) 31 messages, 4 authors, 2015-03-25

Re: [PATCH v9 tip 6/9] samples: bpf: simple non-portable kprobe filter example

From: Ingo Molnar <mingo@kernel.org>
Date: 2015-03-23 07:35:15
Also in: lkml, netdev

* Alexei Starovoitov [off-list ref] wrote:
+void read_trace_pipe(void)
+{
+	int trace_fd;
+
+	trace_fd = open(DEBUGFS "trace_pipe", O_RDONLY, 0);
+	if (trace_fd < 0)
+		return;
+
+	while (1) {
+		static char buf[4096];
+		ssize_t sz;
+
+		sz = read(trace_fd, buf, sizeof(buf));
read() will return -1 on failure ...
+		if (sz) {
... this test passes ...
+			buf[sz] = 0;
... and here we smash the stack?
+			puts(buf);
+		}
+	}

Thanks,

	Ingo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help