Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-12 Thread Alexei Starovoitov
Hi All, the list of things I fixed so far from V11: - dropped patch 11 and copied few macros to libbpf.h (suggested by Daniel) - replaced 'enum bpf_prog_type' with u32 to be safe in compat (.. Andy) - implemented and tested compat support (.. Daniel) - changed 'void *log_buf' to 'char *' (..

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-12 Thread Alexei Starovoitov
Hi All, the list of things I fixed so far from V11: - dropped patch 11 and copied few macros to libbpf.h (suggested by Daniel) - replaced 'enum bpf_prog_type' with u32 to be safe in compat (.. Andy) - implemented and tested compat support (.. Daniel) - changed 'void *log_buf' to 'char *' (..

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Alexei Starovoitov
On Thu, Sep 11, 2014 at 6:17 PM, Andy Lutomirski wrote: > On Thu, Sep 11, 2014 at 3:29 PM, Alexei Starovoitov wrote: >> On Thu, Sep 11, 2014 at 2:54 PM, Andy Lutomirski wrote: the verifier log contains full trace. Last unsafe instruction + error in many cases is useless. What we

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Andy Lutomirski
On Thu, Sep 11, 2014 at 3:29 PM, Alexei Starovoitov wrote: > On Thu, Sep 11, 2014 at 2:54 PM, Andy Lutomirski wrote: >>> >>> the verifier log contains full trace. Last unsafe instruction + error >>> in many cases is useless. What we found empirically from using >>> it over last 2 years is that

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Alexei Starovoitov
On Thu, Sep 11, 2014 at 2:54 PM, Andy Lutomirski wrote: >> >> the verifier log contains full trace. Last unsafe instruction + error >> in many cases is useless. What we found empirically from using >> it over last 2 years is that developers have different learning curve >> to adjust to 'safe'

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Andy Lutomirski
On Thu, Sep 11, 2014 at 1:33 PM, Alexei Starovoitov wrote: > On Thu, Sep 11, 2014 at 12:47 PM, Daniel Borkmann wrote: >> On 09/10/2014 07:32 PM, Alexei Starovoitov wrote: >>> >>> On Wed, Sep 10, 2014 at 2:03 AM, Daniel Borkmann >>> wrote: > > struct { /* anonymous struct

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Alexei Starovoitov
On Thu, Sep 11, 2014 at 12:54 PM, Daniel Borkmann wrote: > On 09/10/2014 10:21 PM, Alexei Starovoitov wrote: > ... char bpf_log_buf[LOG_BUF_SIZE]; >>> >>> >>> What happens if the size isn't LOG_BUF_SIZE? >> >> >> would do you mean? >> LOG_BUF_SIZE is just a user defined

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Alexei Starovoitov
On Thu, Sep 11, 2014 at 12:47 PM, Daniel Borkmann wrote: > On 09/10/2014 07:32 PM, Alexei Starovoitov wrote: >> >> On Wed, Sep 10, 2014 at 2:03 AM, Daniel Borkmann >> wrote: struct { /* anonymous struct used by BPF_PROG_LOAD command */ enum

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Daniel Borkmann
On 09/10/2014 10:21 PM, Alexei Starovoitov wrote: ... char bpf_log_buf[LOG_BUF_SIZE]; What happens if the size isn't LOG_BUF_SIZE? would do you mean? LOG_BUF_SIZE is just a user defined macro. Can be anything. I believe, Andy means, what would happen if log_level > 0 but the

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Daniel Borkmann
On 09/10/2014 07:32 PM, Alexei Starovoitov wrote: On Wed, Sep 10, 2014 at 2:03 AM, Daniel Borkmann wrote: struct { /* anonymous struct used by BPF_PROG_LOAD command */ enum bpf_prog_typeprog_type; __u32 insn_cnt;

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Andy Lutomirski
On Thu, Sep 11, 2014 at 1:33 PM, Alexei Starovoitov a...@plumgrid.com wrote: On Thu, Sep 11, 2014 at 12:47 PM, Daniel Borkmann dbork...@redhat.com wrote: On 09/10/2014 07:32 PM, Alexei Starovoitov wrote: On Wed, Sep 10, 2014 at 2:03 AM, Daniel Borkmann dbork...@redhat.com wrote:

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Alexei Starovoitov
On Thu, Sep 11, 2014 at 2:54 PM, Andy Lutomirski l...@amacapital.net wrote: the verifier log contains full trace. Last unsafe instruction + error in many cases is useless. What we found empirically from using it over last 2 years is that developers have different learning curve to adjust to

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Andy Lutomirski
On Thu, Sep 11, 2014 at 3:29 PM, Alexei Starovoitov a...@plumgrid.com wrote: On Thu, Sep 11, 2014 at 2:54 PM, Andy Lutomirski l...@amacapital.net wrote: the verifier log contains full trace. Last unsafe instruction + error in many cases is useless. What we found empirically from using it over

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Alexei Starovoitov
On Thu, Sep 11, 2014 at 6:17 PM, Andy Lutomirski l...@amacapital.net wrote: On Thu, Sep 11, 2014 at 3:29 PM, Alexei Starovoitov a...@plumgrid.com wrote: On Thu, Sep 11, 2014 at 2:54 PM, Andy Lutomirski l...@amacapital.net wrote: the verifier log contains full trace. Last unsafe instruction +

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Daniel Borkmann
On 09/10/2014 07:32 PM, Alexei Starovoitov wrote: On Wed, Sep 10, 2014 at 2:03 AM, Daniel Borkmann dbork...@redhat.com wrote: struct { /* anonymous struct used by BPF_PROG_LOAD command */ enum bpf_prog_typeprog_type; __u32

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Daniel Borkmann
On 09/10/2014 10:21 PM, Alexei Starovoitov wrote: ... char bpf_log_buf[LOG_BUF_SIZE]; What happens if the size isn't LOG_BUF_SIZE? would do you mean? LOG_BUF_SIZE is just a user defined macro. Can be anything. I believe, Andy means, what would happen if log_level 0 but the

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Alexei Starovoitov
On Thu, Sep 11, 2014 at 12:47 PM, Daniel Borkmann dbork...@redhat.com wrote: On 09/10/2014 07:32 PM, Alexei Starovoitov wrote: On Wed, Sep 10, 2014 at 2:03 AM, Daniel Borkmann dbork...@redhat.com wrote: struct { /* anonymous struct used by BPF_PROG_LOAD command */

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-11 Thread Alexei Starovoitov
On Thu, Sep 11, 2014 at 12:54 PM, Daniel Borkmann dbork...@redhat.com wrote: On 09/10/2014 10:21 PM, Alexei Starovoitov wrote: ... char bpf_log_buf[LOG_BUF_SIZE]; What happens if the size isn't LOG_BUF_SIZE? would do you mean? LOG_BUF_SIZE is just a user defined macro.

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Alexei Starovoitov
On Wed, Sep 10, 2014 at 11:22 AM, Andy Lutomirski wrote: >> >>attr is a pointer to a union of type bpf_attr as defined below. >> >>size is the size of the union. > > I find this strange. Why not just make attr be a pointer to the > relevant struct for the operation being

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Andy Lutomirski
On Tue, Sep 9, 2014 at 10:09 PM, Alexei Starovoitov wrote: > Hi David, > > I've managed to reduce this set to 12: > Patches 1-4 establish BPF syscall shell for maps and programs. > Patches 5-10 add verifier step by step > Patch 11 exposes existing instruction macros to user space > Patch 12 adds

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Alexei Starovoitov
On Wed, Sep 10, 2014 at 2:21 AM, Daniel Borkmann wrote: > > When you pass in these structs with pointers in it to other user space > buffers, how do you handle this with mixed 32/64 bit user/kernel space? ... > Perhaps I'm missing something, but I think, that would currently break in > your

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Alexei Starovoitov
On Wed, Sep 10, 2014 at 2:03 AM, Daniel Borkmann wrote: >> struct { /* anonymous struct used by BPF_PROG_LOAD command */ >> enum bpf_prog_typeprog_type; >> __u32 insn_cnt; >> const struct bpf_insn *insns; >>

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Alexei Starovoitov
On Wed, Sep 10, 2014 at 1:19 AM, Daniel Borkmann wrote: >> >> In the future maps can have different types: hash, array, bloom >> filter, >> radix-tree, but currently only hash type is supported: >> enum bpf_map_type { >>BPF_MAP_TYPE_UNSPEC, >>

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Daniel Borkmann
On 09/10/2014 07:09 AM, Alexei Starovoitov wrote: BPF(2) Linux Programmer's ManualBPF(2) ... union bpf_attr { struct { /* anonymous struct used by BPF_MAP_CREATE command */ enum bpf_map_type map_type;

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Daniel Borkmann
On 09/10/2014 07:09 AM, Alexei Starovoitov wrote: ... struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ int map_fd; void *key; union { void *value; void *next_key; };

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Daniel Borkmann
On 09/10/2014 07:09 AM, Alexei Starovoitov wrote: ... As requested by Andy and others, here is the man page: BPF(2) Linux Programmer's ManualBPF(2) ... In the future maps can have different types: hash, array, bloom filter, radix-tree,

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Daniel Borkmann
On 09/10/2014 07:09 AM, Alexei Starovoitov wrote: ... As requested by Andy and others, here is the man page: BPF(2) Linux Programmer's ManualBPF(2) ... In the future maps can have different types: hash, array, bloom filter, radix-tree,

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Daniel Borkmann
On 09/10/2014 07:09 AM, Alexei Starovoitov wrote: ... struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ int map_fd; void *key; union { void *value; void *next_key; };

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Daniel Borkmann
On 09/10/2014 07:09 AM, Alexei Starovoitov wrote: BPF(2) Linux Programmer's ManualBPF(2) ... union bpf_attr { struct { /* anonymous struct used by BPF_MAP_CREATE command */ enum bpf_map_type map_type;

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Alexei Starovoitov
On Wed, Sep 10, 2014 at 1:19 AM, Daniel Borkmann dbork...@redhat.com wrote: In the future maps can have different types: hash, array, bloom filter, radix-tree, but currently only hash type is supported: enum bpf_map_type { BPF_MAP_TYPE_UNSPEC,

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Alexei Starovoitov
On Wed, Sep 10, 2014 at 2:03 AM, Daniel Borkmann dbork...@redhat.com wrote: struct { /* anonymous struct used by BPF_PROG_LOAD command */ enum bpf_prog_typeprog_type; __u32 insn_cnt; const struct bpf_insn *insns;

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Alexei Starovoitov
On Wed, Sep 10, 2014 at 2:21 AM, Daniel Borkmann dbork...@redhat.com wrote: When you pass in these structs with pointers in it to other user space buffers, how do you handle this with mixed 32/64 bit user/kernel space? ... Perhaps I'm missing something, but I think, that would currently break

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Andy Lutomirski
On Tue, Sep 9, 2014 at 10:09 PM, Alexei Starovoitov a...@plumgrid.com wrote: Hi David, I've managed to reduce this set to 12: Patches 1-4 establish BPF syscall shell for maps and programs. Patches 5-10 add verifier step by step Patch 11 exposes existing instruction macros to user space

Re: [PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-10 Thread Alexei Starovoitov
On Wed, Sep 10, 2014 at 11:22 AM, Andy Lutomirski l...@amacapital.net wrote: attr is a pointer to a union of type bpf_attr as defined below. size is the size of the union. I find this strange. Why not just make attr be a pointer to the relevant struct for the operation

[PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-09 Thread Alexei Starovoitov
Hi David, I've managed to reduce this set to 12: Patches 1-4 establish BPF syscall shell for maps and programs. Patches 5-10 add verifier step by step Patch 11 exposes existing instruction macros to user space Patch 12 adds test stubs and verifier testsuite from user space I don't know how to

[PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

2014-09-09 Thread Alexei Starovoitov
Hi David, I've managed to reduce this set to 12: Patches 1-4 establish BPF syscall shell for maps and programs. Patches 5-10 add verifier step by step Patch 11 exposes existing instruction macros to user space Patch 12 adds test stubs and verifier testsuite from user space I don't know how to