Re: [PATCH 6/6] ebpf: allow BPF_REG_X in src_reg conditional jumps

2015-09-04 Thread Alexei Starovoitov
On Fri, Sep 04, 2015 at 04:43:50PM -0600, Tycho Andersen wrote: > > The fix should be something like this: > > diff --git a/net/core/filter.c b/net/core/filter.c > > index 13079f03902e..05a04ea87172 100644 > > --- a/net/core/filter.c > > +++ b/net/core/filter.c > > @@ -478,9 +478,9 @@ do_pass: > >

Re: [PATCH 6/6] ebpf: allow BPF_REG_X in src_reg conditional jumps

2015-09-04 Thread Tycho Andersen
Hi Alexei, On Fri, Sep 04, 2015 at 02:06:19PM -0700, Alexei Starovoitov wrote: > On Fri, Sep 04, 2015 at 10:04:24AM -0600, Tycho Andersen wrote: > > The classic converter generates conditional jumps with: > > > > if (BPF_SRC(fp->code) == BPF_K && (int) fp->k < 0) { > > ... > > } else { >

Re: [PATCH 6/6] ebpf: allow BPF_REG_X in src_reg conditional jumps

2015-09-04 Thread Alexei Starovoitov
On Fri, Sep 04, 2015 at 10:04:24AM -0600, Tycho Andersen wrote: > The classic converter generates conditional jumps with: > > if (BPF_SRC(fp->code) == BPF_K && (int) fp->k < 0) { > ... > } else { > insn->dst_reg = BPF_REG_A; > insn->src_reg = BPF_REG_X; > insn->imm

[PATCH 6/6] ebpf: allow BPF_REG_X in src_reg conditional jumps

2015-09-04 Thread Tycho Andersen
The classic converter generates conditional jumps with: if (BPF_SRC(fp->code) == BPF_K && (int) fp->k < 0) { ... } else { insn->dst_reg = BPF_REG_A; insn->src_reg = BPF_REG_X; insn->imm = fp->k; bpf_src = BPF_SRC(fp->code); } but here, we enforce that the s