Re: [iovisor-dev] bpf invalid stack off=-528

2017-04-20 Thread William Tu via iovisor-dev
On Wed, Apr 19, 2017 at 10:44 AM, William Tu wrote: > Thanks for the reply. > >> could you increase the max to 1M or so >> and see what the actual number of insns it needs? > > it takes 112,762 insns. And the kernel runs a while (~6 seconds) to verify it. > >> If the program is short, as you say,

Re: [iovisor-dev] bpf invalid stack off=-528

2017-04-19 Thread William Tu via iovisor-dev
Thanks for the reply. > could you increase the max to 1M or so > and see what the actual number of insns it needs? it takes 112,762 insns. And the kernel runs a while (~6 seconds) to verify it. > If the program is short, as you say, can you debug > the state prunning to see why it's not recogniz

Re: [iovisor-dev] bpf invalid stack off=-528

2017-04-14 Thread Alexei Starovoitov via iovisor-dev
On Fri, Apr 14, 2017 at 12:48:11PM -0700, William Tu wrote: > Thanks for all the feedbacks from the iovisor summit. Since then, > we've tried a couple of workarounds for this issue, the following > shares the observations and code. > > === Original code, xdp9.c === > xdp9.c is to parse IPv4, TCP,

Re: [iovisor-dev] bpf invalid stack off=-528

2017-04-14 Thread William Tu via iovisor-dev
Thanks for all the feedbacks from the iovisor summit. Since then, we've tried a couple of workarounds for this issue, the following shares the observations and code. === Original code, xdp9.c === xdp9.c is to parse IPv4, TCP, UDP, ICMP and update checksum. https://gist.github.com/williamtu/759eedb

Re: [iovisor-dev] bpf invalid stack off=-528

2017-02-10 Thread Alexei Starovoitov via iovisor-dev
On Fri, Feb 10, 2017 at 9:08 AM, William Tu wrote: > my program is too huge so I start with simple example using xdp1_kern.c > I tried adding an ethernet header as local variable: > > --- a/samples/bpf/xdp1_kern.c > +++ b/samples/bpf/xdp1_kern.c > @@ -51,10 +51,19 @@ int xdp_prog1(struct xdp_md *c

Re: [iovisor-dev] bpf invalid stack off=-528

2017-02-10 Thread William Tu via iovisor-dev
my program is too huge so I start with simple example using xdp1_kern.c I tried adding an ethernet header as local variable: --- a/samples/bpf/xdp1_kern.c +++ b/samples/bpf/xdp1_kern.c @@ -51,10 +51,19 @@ int xdp_prog1(struct xdp_md *ctx) u64 nh_off; u32 ipproto; + struct et

Re: [iovisor-dev] bpf invalid stack off=-528

2017-02-09 Thread William Tu via iovisor-dev
On Thu, Feb 9, 2017 at 8:59 AM, Alexei Starovoitov wrote: > On Thu, Feb 9, 2017 at 8:43 AM, William Tu via iovisor-dev > wrote: >> >> $(CLANG) \ >> -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ >> -Wno-compare-distinct-pointer-types \ >> -Wno-gnu-

Re: [iovisor-dev] bpf invalid stack off=-528

2017-02-09 Thread Alexei Starovoitov via iovisor-dev
On Thu, Feb 9, 2017 at 8:43 AM, William Tu via iovisor-dev wrote: > > $(CLANG) \ > -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ > -Wno-compare-distinct-pointer-types \ > -Wno-gnu-variable-sized-type-not-at-end \ > -Wno-tautological-compare

Re: [iovisor-dev] bpf invalid stack off=-528

2017-02-09 Thread William Tu via iovisor-dev
> You are generating the C files in the end, right? So the code > shown is what clang gets to compile; or does this come from > another llvm front end somehow? yes, we are generating C files, then clang v3.8, then LLVM v4.0. It's the same compile options used in sample/bpf/Makefile > > Also this

Re: [iovisor-dev] bpf invalid stack off=-528

2017-02-09 Thread Daniel Borkmann via iovisor-dev
On 02/09/2017 04:23 PM, William Tu wrote: On Thu, Feb 9, 2017 at 5:11 AM, Daniel Borkmann wrote: On 02/08/2017 09:22 PM, William Tu via iovisor-dev wrote: Hi, I have a program which I use around at most 300byte of local stack as below. The largest struct is the "struct Headers" which is arou

Re: [iovisor-dev] bpf invalid stack off=-528

2017-02-09 Thread William Tu via iovisor-dev
On Thu, Feb 9, 2017 at 5:11 AM, Daniel Borkmann wrote: > On 02/08/2017 09:22 PM, William Tu via iovisor-dev wrote: >> >> Hi, >> >> I have a program which I use around at most 300byte of local stack as >> below. The largest struct is the "struct Headers" which is around 80 >> byte. However, when lo

Re: [iovisor-dev] bpf invalid stack off=-528

2017-02-09 Thread Daniel Borkmann via iovisor-dev
On 02/08/2017 09:22 PM, William Tu via iovisor-dev wrote: Hi, I have a program which I use around at most 300byte of local stack as below. The largest struct is the "struct Headers" which is around 80 byte. However, when loading into the verifier, it says 393: (7b) *(u64 *)(r10 -56) = r1 394: (

[iovisor-dev] bpf invalid stack off=-528

2017-02-08 Thread William Tu via iovisor-dev
Hi, I have a program which I use around at most 300byte of local stack as below. The largest struct is the "struct Headers" which is around 80 byte. However, when loading into the verifier, it says 393: (7b) *(u64 *)(r10 -56) = r1 394: (05) goto pc+56 451: (7b) *(u64 *)(r10 -528) = r0 invalid sta