Alexei Starovoitov
8d3b7dce86
bpf: add support for %s specifier to bpf_trace_printk()
...
%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 <linux/fs.h>
int foo(struct pt_regs *ctx, struct filename *filename)
{
void *name = 0;
bpf_probe_read(&name, sizeof(name), &filename->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 <brendan.d.gregg@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-08-28 16:27:27 -07:00
..
2015-08-12 16:42:50 -07:00
2015-06-16 11:04:29 +01:00
2015-02-19 12:39:03 -06:00
2015-08-21 11:44:04 -07:00
2015-06-30 19:44:57 -07:00
2015-08-20 00:25:25 +02:00
2015-06-22 16:26:56 +02:00
2015-07-21 10:18:07 +02:00
2015-07-01 14:17:44 -07:00
2015-06-30 19:44:59 -07:00
2015-06-26 14:02:43 -07:00
2015-07-06 14:15:08 +02:00
2015-08-18 15:31:16 +02:00
2015-08-28 16:27:27 -07:00
2015-04-11 22:27:55 -04:00
2014-10-09 22:26:04 -04:00
2015-04-26 17:22:07 -07:00
2015-04-15 15:06:55 -04:00
2015-06-27 13:53:16 -07:00
2015-04-22 14:49:23 -07:00
2015-02-11 20:07:47 -08:00
2015-07-08 09:33:38 -07:00
2014-08-08 15:57:18 -07:00
2015-04-15 16:35:22 -07:00
2015-07-03 15:20:57 -07:00
2015-06-04 23:57:18 +02:00
2015-05-07 12:02:51 +02:00
2015-07-15 10:39:17 +02:00
2015-08-10 11:18:41 -04:00
2014-08-25 15:42:19 -07:00
2015-04-15 16:35:22 -07:00
2014-07-23 10:18:06 -07:00
2015-04-12 21:03:31 +02:00
2015-06-25 17:00:43 -07:00
2014-11-19 15:25:26 -05:00
2015-07-18 03:42:51 +02:00
2014-10-21 23:44:20 +02:00
2015-06-24 14:46:01 -07:00
2015-04-15 16:35:22 -07:00
2015-04-15 16:35:22 -07:00
2014-10-29 11:18:18 -04:00
2015-05-27 11:09:50 +09:30
2014-10-14 02:18:16 +02:00
2014-09-10 15:42:12 -07:00
2015-05-12 09:46:00 +02:00
2015-06-30 19:44:57 -07:00
2014-12-10 17:41:17 -08:00
2015-02-13 21:21:42 -08:00
2015-08-07 04:39:41 +03:00
2015-07-02 16:42:13 -07:00
2015-07-29 06:13:22 +09:30
2015-01-06 11:04:29 -08:00
2014-12-04 14:34:54 -05:00
2015-02-13 21:21:38 -08:00
2015-06-30 19:44:57 -07:00
2015-07-01 10:49:25 -07:00
2014-12-16 15:53:03 -08:00
2015-04-17 09:04:06 -04:00
2015-02-13 21:21:38 -08:00
2015-04-17 09:04:06 -04:00
2015-01-17 10:02:23 +13:00
2015-04-15 16:35:23 -07:00
2015-06-30 19:44:59 -07:00
2015-07-22 17:20:34 +02:00
2015-05-09 17:35:05 -04:00
2015-08-07 04:39:40 +03:00
2015-04-19 13:19:23 -07:00
2015-06-24 17:49:40 -07:00
2015-02-09 15:24:03 -08:00
2014-12-13 12:42:48 -08:00
2015-06-19 10:03:12 +02:00
2015-04-15 16:35:22 -07:00
2015-06-25 17:00:37 -07:00
2014-12-10 17:41:10 -08:00
2015-07-03 15:20:57 -07:00
2014-07-17 09:35:17 -04:00
2015-01-18 01:03:45 -05:00
2014-08-08 15:57:18 -07:00
2015-05-27 12:56:15 -07:00
2014-07-23 10:18:05 -07:00
2014-12-05 17:19:27 -06:00
2014-12-17 12:31:40 -08:00
2014-08-26 13:45:45 -04:00
2014-12-17 12:31:40 -08:00
2014-12-04 14:34:47 -05:00
2015-06-24 17:49:40 -07:00
2015-07-01 10:49:25 -07:00