Re: [PATCH bpf-next] bpf/verifier: enable ctx + const + 0.

2018-05-02 Thread Jakub Kicinski
On Wed, 2 May 2018 10:54:56 -0700, William Tu wrote: > On Wed, May 2, 2018 at 1:29 AM, Daniel Borkmann wrote: > > On 05/02/2018 06:52 AM, Alexei Starovoitov wrote: > >> On Tue, May 01, 2018 at 09:35:29PM -0700, William Tu wrote: > >> Please test it with real program and

Re: [PATCH bpf-next] bpf/verifier: enable ctx + const + 0.

2018-05-02 Thread William Tu
On Wed, May 2, 2018 at 1:29 AM, Daniel Borkmann wrote: > On 05/02/2018 06:52 AM, Alexei Starovoitov wrote: >> On Tue, May 01, 2018 at 09:35:29PM -0700, William Tu wrote: >>> How did you test this patch? >>> Without the patch, the test case will fail. >>> With the

Re: [PATCH bpf-next] bpf/verifier: enable ctx + const + 0.

2018-05-02 Thread Daniel Borkmann
On 05/02/2018 06:52 AM, Alexei Starovoitov wrote: > On Tue, May 01, 2018 at 09:35:29PM -0700, William Tu wrote: >> >>> How did you test this patch? >>> >> Without the patch, the test case will fail. >> With the patch, the test case passes. > > Please test it with real program and you'll see

Re: [PATCH bpf-next] bpf/verifier: enable ctx + const + 0.

2018-05-01 Thread Alexei Starovoitov
On Tue, May 01, 2018 at 09:35:29PM -0700, William Tu wrote: > > > How did you test this patch? > > > Without the patch, the test case will fail. > With the patch, the test case passes. Please test it with real program and you'll see crashes and garbage returned.

Re: [PATCH bpf-next] bpf/verifier: enable ctx + const + 0.

2018-05-01 Thread William Tu
On Tue, May 1, 2018 at 4:16 PM, Alexei Starovoitov wrote: > On Mon, Apr 30, 2018 at 10:15:05AM -0700, William Tu wrote: >> Existing verifier does not allow 'ctx + const + const'. However, due to >> compiler optimization, there is a case where BPF compilerit

Re: [PATCH bpf-next] bpf/verifier: enable ctx + const + 0.

2018-05-01 Thread Alexei Starovoitov
On Mon, Apr 30, 2018 at 10:15:05AM -0700, William Tu wrote: > Existing verifier does not allow 'ctx + const + const'. However, due to > compiler optimization, there is a case where BPF compilerit generates > 'ctx + const + 0', as shown below: > > 599: (1d) if r2 == r4 goto pc+2 >

[PATCH bpf-next] bpf/verifier: enable ctx + const + 0.

2018-04-30 Thread William Tu
Existing verifier does not allow 'ctx + const + const'. However, due to compiler optimization, there is a case where BPF compilerit generates 'ctx + const + 0', as shown below: 599: (1d) if r2 == r4 goto pc+2 R0=inv(id=0) R1=ctx(id=0,off=40,imm=0)