From: David Miller <da...@davemloft.net>
Date: Mon, 01 May 2017 23:02:34 -0400 (EDT)

>       for (i = 0; i < prog->len; i++) {
>               const struct bpf_insn *insn = &prog->insnsi[i];
>               int ret;
> 
>               ret = build_insn(insn, ctx);
>               ctx->offset[i] = ctx->idx;
> 
>               if (ret > 0) {
>                       i++;
>                       continue;
>               }
>               if (ret)
>                       return ret;
>       }

Ok, the fix is to defer the ctx->offset[i] setting until after the
potential extra "i++" increment inside of the "if (ret > 0)" test.

This is how x86_64's JIT handles this.

I'm testing this fix on sparc64 now.

Reply via email to