[PATCH v2] arm64: bpf: Fix branch offset in JIT
ilias.apalodimas at linaro.org
Wed Sep 16 12:04:04 EDT 2020
On Tue, Sep 15, 2020 at 02:11:03PM +0100, Will Deacon wrote:
> > continue;
> > }
> > - if (ctx->image == NULL)
> > - ctx->offset[i] = ctx->idx;
> > if (ret)
> > return ret;
> > }
> > + if (ctx->image == NULL)
> > + ctx->offset[i] = ctx->idx;
> I think it would be cleared to set ctx->offset before the for loop (with
> a comment about what it is) and then change the for loop to iterate from 1
> all the way to prog->len.
On a second thought while trying to code this, I'd prefer leaving it as is.
First of all we'll have to increase ctx->idx while adding ctx->offset and
more importantly, I don't think that's a 'special' case.
It's still the same thing i.e the start of the 1st instruction (which happens
to be the end of prologue), the next one will be the start of the second
instruction etc etc.
I don't mind changing if you feel strongly about it, but I think it makese sense
More information about the linux-arm-kernel