Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-19 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 12:18 PM, Andy Lutomirski wrote: > On Fri, Aug 15, 2014 at 12:16 PM, Alexei Starovoitov > wrote: >> This bpf_context struct for tracing is trying to answer the question: >> 'what's the most convenient way to access tracepoint arguments >> from a script'. >> When kernel

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-19 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 12:18 PM, Andy Lutomirski l...@amacapital.net wrote: On Fri, Aug 15, 2014 at 12:16 PM, Alexei Starovoitov a...@plumgrid.com wrote: This bpf_context struct for tracing is trying to answer the question: 'what's the most convenient way to access tracepoint arguments

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 12:18 PM, Andy Lutomirski wrote: >> >> clang/llvm has no problem with u64 :) >> This bpf_context struct for tracing is trying to answer the question: >> 'what's the most convenient way to access tracepoint arguments >> from a script'. >> When kernel code has something

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Fri, Aug 15, 2014 at 12:29 PM, Alexei Starovoitov wrote: > On Fri, Aug 15, 2014 at 12:20 PM, Andy Lutomirski wrote: I don't think that fixing this should be a prerequisite for merging, since the risk is so small. Nonetheless, it would be nice. (This family of attacks has

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 12:20 PM, Andy Lutomirski wrote: >>> >>> I don't think that fixing this should be a prerequisite for merging, >>> since the risk is so small. Nonetheless, it would be nice. (This >>> family of attacks has lead to several root vulnerabilities in the >>> past.) >> >> Ok. I

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Fri, Aug 15, 2014 at 12:16 PM, Alexei Starovoitov wrote: > On Fri, Aug 15, 2014 at 12:02 PM, Andy Lutomirski wrote: >>> >>> correct. eBPF program would be using 8-byte read on 64-bit kernel >>> and 4-byte read on 32-bit kernel. Same with access to ptrace fields >>> and pretty much all other

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Fri, Aug 15, 2014 at 12:07 PM, Alexei Starovoitov wrote: > On Fri, Aug 15, 2014 at 11:53 AM, Andy Lutomirski wrote: >> On Fri, Aug 15, 2014 at 10:51 AM, Alexei Starovoitov >> wrote: >>> On Fri, Aug 15, 2014 at 10:25 AM, Andy Lutomirski >>> wrote: On Wed, Aug 13, 2014 at 12:57 AM,

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 12:02 PM, Andy Lutomirski wrote: >> >> correct. eBPF program would be using 8-byte read on 64-bit kernel >> and 4-byte read on 32-bit kernel. Same with access to ptrace fields >> and pretty much all other fields in the kernel. The program will be >> different on different

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 11:53 AM, Andy Lutomirski wrote: > On Fri, Aug 15, 2014 at 10:51 AM, Alexei Starovoitov > wrote: >> On Fri, Aug 15, 2014 at 10:25 AM, Andy Lutomirski >> wrote: >>> On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov >>> wrote: User interface: fd =

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Fri, Aug 15, 2014 at 11:56 AM, Alexei Starovoitov wrote: > On Fri, Aug 15, 2014 at 11:50 AM, Andy Lutomirski wrote: >> On Aug 15, 2014 10:36 AM, "Alexei Starovoitov" wrote: >>> >>> On Fri, Aug 15, 2014 at 10:20 AM, Andy Lutomirski >>> wrote: >>> > The downside of this approach is that

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 11:50 AM, Andy Lutomirski wrote: > On Aug 15, 2014 10:36 AM, "Alexei Starovoitov" wrote: >> >> On Fri, Aug 15, 2014 at 10:20 AM, Andy Lutomirski >> wrote: >> > The downside of this approach is that compat support might be >> > difficult or impossible. >> >> Would do you

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Fri, Aug 15, 2014 at 10:51 AM, Alexei Starovoitov wrote: > On Fri, Aug 15, 2014 at 10:25 AM, Andy Lutomirski wrote: >> On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov >> wrote: >>> User interface: >>> fd = open("/sys/kernel/debug/tracing/__event__/filter") >>> >>> write(fd, "bpf_123")

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Aug 15, 2014 10:36 AM, "Alexei Starovoitov" wrote: > > On Fri, Aug 15, 2014 at 10:20 AM, Andy Lutomirski wrote: > > The downside of this approach is that compat support might be > > difficult or impossible. > > Would do you mean by compat? 32-bit programs on 64-bit kernels? > There is no such

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 10:25 AM, Andy Lutomirski wrote: > On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov > wrote: >> User interface: >> fd = open("/sys/kernel/debug/tracing/__event__/filter") >> >> write(fd, "bpf_123") > > I didn't follow all the code flow leading to parsing the

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 10:20 AM, Andy Lutomirski wrote: > The downside of this approach is that compat support might be > difficult or impossible. Would do you mean by compat? 32-bit programs on 64-bit kernels? There is no such concept for eBPF. All eBPF programs are always operating on 64-bit

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov wrote: > User interface: > fd = open("/sys/kernel/debug/tracing/__event__/filter") > > write(fd, "bpf_123") I didn't follow all the code flow leading to parsing the "bpf_123" string, but if it works the way I imagine it does, it's a security

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Thu, Aug 14, 2014 at 11:08 PM, Alexei Starovoitov wrote: > On Thu, Aug 14, 2014 at 2:20 PM, Brendan Gregg > wrote: >> On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov >> wrote: >> [...] >>> +/* For tracing filters save first six arguments of tracepoint events. >>> + * On 64-bit

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Thu, Aug 14, 2014 at 2:20 PM, Brendan Gregg wrote: > On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov > wrote: > [...] >> +/* For tracing filters save first six arguments of tracepoint events. >> + * On 64-bit architectures argN fields will match one to one to arguments >> passed >> + *

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Thu, Aug 14, 2014 at 2:20 PM, Brendan Gregg brendan.d.gr...@gmail.com wrote: On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov a...@plumgrid.com wrote: [...] +/* For tracing filters save first six arguments of tracepoint events. + * On 64-bit architectures argN fields will match one to

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Thu, Aug 14, 2014 at 11:08 PM, Alexei Starovoitov a...@plumgrid.com wrote: On Thu, Aug 14, 2014 at 2:20 PM, Brendan Gregg brendan.d.gr...@gmail.com wrote: On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov a...@plumgrid.com wrote: [...] +/* For tracing filters save first six arguments

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov a...@plumgrid.com wrote: User interface: fd = open(/sys/kernel/debug/tracing/__event__/filter) write(fd, bpf_123) I didn't follow all the code flow leading to parsing the bpf_123 string, but if it works the way I imagine it does, it's a

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 10:20 AM, Andy Lutomirski l...@amacapital.net wrote: The downside of this approach is that compat support might be difficult or impossible. Would do you mean by compat? 32-bit programs on 64-bit kernels? There is no such concept for eBPF. All eBPF programs are always

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 10:25 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov a...@plumgrid.com wrote: User interface: fd = open(/sys/kernel/debug/tracing/__event__/filter) write(fd, bpf_123) I didn't follow all the code flow leading to

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Aug 15, 2014 10:36 AM, Alexei Starovoitov a...@plumgrid.com wrote: On Fri, Aug 15, 2014 at 10:20 AM, Andy Lutomirski l...@amacapital.net wrote: The downside of this approach is that compat support might be difficult or impossible. Would do you mean by compat? 32-bit programs on 64-bit

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Fri, Aug 15, 2014 at 10:51 AM, Alexei Starovoitov a...@plumgrid.com wrote: On Fri, Aug 15, 2014 at 10:25 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov a...@plumgrid.com wrote: User interface: fd =

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 11:50 AM, Andy Lutomirski l...@amacapital.net wrote: On Aug 15, 2014 10:36 AM, Alexei Starovoitov a...@plumgrid.com wrote: On Fri, Aug 15, 2014 at 10:20 AM, Andy Lutomirski l...@amacapital.net wrote: The downside of this approach is that compat support might be

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Fri, Aug 15, 2014 at 11:56 AM, Alexei Starovoitov a...@plumgrid.com wrote: On Fri, Aug 15, 2014 at 11:50 AM, Andy Lutomirski l...@amacapital.net wrote: On Aug 15, 2014 10:36 AM, Alexei Starovoitov a...@plumgrid.com wrote: On Fri, Aug 15, 2014 at 10:20 AM, Andy Lutomirski l...@amacapital.net

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 11:53 AM, Andy Lutomirski l...@amacapital.net wrote: On Fri, Aug 15, 2014 at 10:51 AM, Alexei Starovoitov a...@plumgrid.com wrote: On Fri, Aug 15, 2014 at 10:25 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Fri, Aug 15, 2014 at 12:07 PM, Alexei Starovoitov a...@plumgrid.com wrote: On Fri, Aug 15, 2014 at 11:53 AM, Andy Lutomirski l...@amacapital.net wrote: On Fri, Aug 15, 2014 at 10:51 AM, Alexei Starovoitov a...@plumgrid.com wrote: On Fri, Aug 15, 2014 at 10:25 AM, Andy Lutomirski

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Fri, Aug 15, 2014 at 12:16 PM, Alexei Starovoitov a...@plumgrid.com wrote: On Fri, Aug 15, 2014 at 12:02 PM, Andy Lutomirski l...@amacapital.net wrote: correct. eBPF program would be using 8-byte read on 64-bit kernel and 4-byte read on 32-bit kernel. Same with access to ptrace fields and

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 12:02 PM, Andy Lutomirski l...@amacapital.net wrote: correct. eBPF program would be using 8-byte read on 64-bit kernel and 4-byte read on 32-bit kernel. Same with access to ptrace fields and pretty much all other fields in the kernel. The program will be different on

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 12:20 PM, Andy Lutomirski l...@amacapital.net wrote: I don't think that fixing this should be a prerequisite for merging, since the risk is so small. Nonetheless, it would be nice. (This family of attacks has lead to several root vulnerabilities in the past.) Ok. I

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Andy Lutomirski
On Fri, Aug 15, 2014 at 12:29 PM, Alexei Starovoitov a...@plumgrid.com wrote: On Fri, Aug 15, 2014 at 12:20 PM, Andy Lutomirski l...@amacapital.net wrote: I don't think that fixing this should be a prerequisite for merging, since the risk is so small. Nonetheless, it would be nice. (This

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-15 Thread Alexei Starovoitov
On Fri, Aug 15, 2014 at 12:18 PM, Andy Lutomirski l...@amacapital.net wrote: clang/llvm has no problem with u64 :) This bpf_context struct for tracing is trying to answer the question: 'what's the most convenient way to access tracepoint arguments from a script'. When kernel code has

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-14 Thread Brendan Gregg
On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov wrote: [...] > +/* For tracing filters save first six arguments of tracepoint events. > + * On 64-bit architectures argN fields will match one to one to arguments > passed > + * to tracepoint events. > + * On 32-bit architectures u64 arguments

Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events

2014-08-14 Thread Brendan Gregg
On Wed, Aug 13, 2014 at 12:57 AM, Alexei Starovoitov a...@plumgrid.com wrote: [...] +/* For tracing filters save first six arguments of tracepoint events. + * On 64-bit architectures argN fields will match one to one to arguments passed + * to tracepoint events. + * On 32-bit architectures