<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/trace/bpf_trace.c, branch v4.5</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.5</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.5'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-01-29T07:35:25Z</updated>
<entry>
<title>perf/bpf: Convert perf_event_array to use struct file</title>
<updated>2016-01-29T07:35:25Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>alexei.starovoitov@gmail.com</email>
</author>
<published>2016-01-26T04:59:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e03e7ee34fdd1c3ef494949a75cb8c61c7265fa9'/>
<id>urn:sha1:e03e7ee34fdd1c3ef494949a75cb8c61c7265fa9</id>
<content type='text'>
Robustify refcounting.

Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@infradead.org&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: David Ahern &lt;dsahern@gmail.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Vince Weaver &lt;vincent.weaver@maine.edu&gt;
Cc: Wang Nan &lt;wangnan0@huawei.com&gt;
Cc: vince@deater.net
Link: http://lkml.kernel.org/r/20160126045947.GA40151@ast-mbp.thefacebook.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Constify bpf_verifier_ops structure</title>
<updated>2015-12-23T19:27:19Z</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@lip6.fr</email>
</author>
<published>2015-12-11T17:35:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=27dff4e04199cf0ecf06239a26d0d225d3c046e9'/>
<id>urn:sha1:27dff4e04199cf0ecf06239a26d0d225d3c046e9</id>
<content type='text'>
This bpf_verifier_ops structure is never modified, like the other
bpf_verifier_ops structures, so declare it as const.

Done with the help of Coccinelle.

Link: http://lkml.kernel.org/r/1449855359-13724-1-git-send-email-Julia.Lawall@lip6.fr

Signed-off-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>bpf: make tracing helpers gpl only</title>
<updated>2015-10-27T04:53:34Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>ast@plumgrid.com</email>
</author>
<published>2015-10-23T21:58:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1075ef5950da97927ae1b3ef76d03e211c4fdb55'/>
<id>urn:sha1:1075ef5950da97927ae1b3ef76d03e211c4fdb55</id>
<content type='text'>
exported perf symbols are GPL only, mark eBPF helper functions
used in tracing as GPL only as well.

Suggested-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpf: fix bpf_perf_event_read() helper</title>
<updated>2015-10-27T04:49:26Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>ast@plumgrid.com</email>
</author>
<published>2015-10-23T00:10:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=62544ce8e01c1879d420ba309f7f319d24c0f4e6'/>
<id>urn:sha1:62544ce8e01c1879d420ba309f7f319d24c0f4e6</id>
<content type='text'>
Fix safety checks for bpf_perf_event_read():
- only non-inherited events can be added to perf_event_array map
  (do this check statically at map insertion time)
- dynamically check that event is local and !pmu-&gt;count
Otherwise buggy bpf program can cause kernel splat.

Also fix error path after perf_event_attrs()
and remove redundant 'extern'.

Fixes: 35578d798400 ("bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter")
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Tested-by: Wang Nan &lt;wangnan0@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpf: introduce bpf_perf_event_output() helper</title>
<updated>2015-10-22T13:42:15Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>ast@plumgrid.com</email>
</author>
<published>2015-10-21T03:02:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a43eec304259a6c637f4014a6d4767159b6a3aa3'/>
<id>urn:sha1:a43eec304259a6c637f4014a6d4767159b6a3aa3</id>
<content type='text'>
This helper is used to send raw data from eBPF program into
special PERF_TYPE_SOFTWARE/PERF_COUNT_SW_BPF_OUTPUT perf_event.
User space needs to perf_event_open() it (either for one or all cpus) and
store FD into perf_event_array (similar to bpf_perf_event_read() helper)
before eBPF program can send data into it.

Today the programs triggered by kprobe collect the data and either store
it into the maps or print it via bpf_trace_printk() where latter is the debug
facility and not suitable to stream the data. This new helper replaces
such bpf_trace_printk() usage and allows programs to have dedicated
channel into user space for post-processing of the raw data collected.

Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpf: add support for %s specifier to bpf_trace_printk()</title>
<updated>2015-08-28T23:27:27Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>ast@plumgrid.com</email>
</author>
<published>2015-08-28T22:56:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8d3b7dce8622919da5c5822ef7338d6604c9fe6e'/>
<id>urn:sha1:8d3b7dce8622919da5c5822ef7338d6604c9fe6e</id>
<content type='text'>
%s specifier makes bpf program and kernel debugging easier.
To make sure that trace_printk won't crash the unsafe string
is copied into stack and unsafe pointer is substituted.

The following C program:
 #include &lt;linux/fs.h&gt;
int foo(struct pt_regs *ctx, struct filename *filename)
{
  void *name = 0;

  bpf_probe_read(&amp;name, sizeof(name), &amp;filename-&gt;name);
  bpf_trace_printk("executed %s\n", name);
  return 0;
}

when attached to kprobe do_execve()
will produce output in /sys/kernel/debug/tracing/trace_pipe :
    make-13492 [002] d..1  3250.997277: : executed /bin/sh
      sh-13493 [004] d..1  3250.998716: : executed /usr/bin/gcc
     gcc-13494 [002] d..1  3250.999822: : executed /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1
     gcc-13495 [002] d..1  3251.006731: : executed /usr/bin/as
     gcc-13496 [002] d..1  3251.011831: : executed /usr/lib/gcc/x86_64-linux-gnu/4.7/collect2
collect2-13497 [000] d..1  3251.012941: : executed /usr/bin/ld

Suggested-by: Brendan Gregg &lt;brendan.d.gregg@gmail.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter</title>
<updated>2015-08-10T05:50:06Z</updated>
<author>
<name>Kaixu Xia</name>
<email>xiakaixu@huawei.com</email>
</author>
<published>2015-08-06T07:02:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=35578d7984003097af2b1e34502bc943d40c1804'/>
<id>urn:sha1:35578d7984003097af2b1e34502bc943d40c1804</id>
<content type='text'>
According to the perf_event_map_fd and index, the function
bpf_perf_event_read() can convert the corresponding map
value to the pointer to struct perf_event and return the
Hardware PMU counter value.

Signed-off-by: Kaixu Xia &lt;xiakaixu@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpf: let kprobe programs use bpf_get_smp_processor_id() helper</title>
<updated>2015-06-15T22:53:50Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>ast@plumgrid.com</email>
</author>
<published>2015-06-13T02:39:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ab1973d3258aa8c40d153dc12bbb1aac56731e47'/>
<id>urn:sha1:ab1973d3258aa8c40d153dc12bbb1aac56731e47</id>
<content type='text'>
It's useful to do per-cpu histograms.

Suggested-by: Daniel Wagner &lt;daniel.wagner@bmw-carit.de&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpf: allow networking programs to use bpf_trace_printk() for debugging</title>
<updated>2015-06-15T22:53:50Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>ast@plumgrid.com</email>
</author>
<published>2015-06-13T02:39:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0756ea3e85139d23a8148ebaa95411c2f0aa4f11'/>
<id>urn:sha1:0756ea3e85139d23a8148ebaa95411c2f0aa4f11</id>
<content type='text'>
bpf_trace_printk() is a helper function used to debug eBPF programs.
Let socket and TC programs use it as well.
Note, it's DEBUG ONLY helper. If it's used in the program,
the kernel will print warning banner to make sure users don't use
it in production.

Signed-off-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpf: introduce current-&gt;pid, tgid, uid, gid, comm accessors</title>
<updated>2015-06-15T22:53:50Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>ast@plumgrid.com</email>
</author>
<published>2015-06-13T02:39:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ffeedafbf0236f03aeb2e8db273b3e5ae5f5bc89'/>
<id>urn:sha1:ffeedafbf0236f03aeb2e8db273b3e5ae5f5bc89</id>
<content type='text'>
eBPF programs attached to kprobes need to filter based on
current-&gt;pid, uid and other fields, so introduce helper functions:

u64 bpf_get_current_pid_tgid(void)
Return: current-&gt;tgid &lt;&lt; 32 | current-&gt;pid

u64 bpf_get_current_uid_gid(void)
Return: current_gid &lt;&lt; 32 | current_uid

bpf_get_current_comm(char *buf, int size_of_buf)
stores current-&gt;comm into buf

They can be used from the programs attached to TC as well to classify packets
based on current task fields.

Update tracex2 example to print histogram of write syscalls for each process
instead of aggregated for all.

Signed-off-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
