lkml.org 
[lkml]   [2020]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] arm64: bpf: Fix branch offset in JIT
Hi Will, 

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[0] 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[0] 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
as-is.

Thanks
/Ilias
>
> Will

\
 
 \ /
  Last update: 2020-09-16 23:08    [W:0.065 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site