Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Ilias Apalodimas
On Mon, Sep 14, 2020 at 11:52:16AM -0700, Xi Wang wrote: > On Mon, Sep 14, 2020 at 11:28 AM Ilias Apalodimas > wrote: > > Even if that's true, is any reason at all why we should skip the first > > element > > of the array, that's now needed since 7c2e988f400 to jump back to the first > >

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Xi Wang
On Mon, Sep 14, 2020 at 11:28 AM Ilias Apalodimas wrote: > Even if that's true, is any reason at all why we should skip the first element > of the array, that's now needed since 7c2e988f400 to jump back to the first > instruction? > Introducing 2 extra if conditions and hotfix the array on the

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Ilias Apalodimas
Hi Luke, On Mon, Sep 14, 2020 at 11:21:58AM -0700, Luke Nelson wrote: > On Mon, Sep 14, 2020 at 11:08 AM Xi Wang wrote: > > I don't think there's some consistent semantics of "offsets" across > > the JITs of different architectures (maybe it's good to clean that > > up). RV64 and RV32 JITs are

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Ilias Apalodimas
Hi Xi, On Mon, Sep 14, 2020 at 11:08:13AM -0700, Xi Wang wrote: > On Mon, Sep 14, 2020 at 10:55 AM Ilias Apalodimas > wrote: > > We've briefly discussed this approach with Yauheni while coming up with the > > posted patch. > > I think that contructing the array correctly in the first place is

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Luke Nelson
On Mon, Sep 14, 2020 at 11:08 AM Xi Wang wrote: > I don't think there's some consistent semantics of "offsets" across > the JITs of different architectures (maybe it's good to clean that > up). RV64 and RV32 JITs are doing something similar to arm64 with > respect to offsets. CCing Björn and

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Xi Wang
On Mon, Sep 14, 2020 at 10:55 AM Ilias Apalodimas wrote: > We've briefly discussed this approach with Yauheni while coming up with the > posted patch. > I think that contructing the array correctly in the first place is better. > Right now it might only be used in bpf2a64_offset() and >

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Ilias Apalodimas
On Mon, Sep 14, 2020 at 10:47:33AM -0700, Xi Wang wrote: > On Mon, Sep 14, 2020 at 10:03 AM Ilias Apalodimas > wrote: > > Naresh from Linaro reported it during his tests on 5.8-rc1 as well [1]. > > I've included both Jiri and him on the v2 as reporters. > > > > [1]

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Xi Wang
On Mon, Sep 14, 2020 at 10:03 AM Ilias Apalodimas wrote: > Naresh from Linaro reported it during his tests on 5.8-rc1 as well [1]. > I've included both Jiri and him on the v2 as reporters. > > [1] https://lkml.org/lkml/2020/8/11/58 I'm curious what you think of Luke's earlier patch to this bug:

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Ilias Apalodimas
On Mon, Sep 14, 2020 at 06:12:34PM +0200, Jesper Dangaard Brouer wrote: > > On Mon, 14 Sep 2020 15:01:15 +0100 Will Deacon wrote: > > > Hi Ilias, > > > > On Mon, Sep 14, 2020 at 04:23:50PM +0300, Ilias Apalodimas wrote: > > > On Mon, Sep 14, 2020 at 03:35:04PM +0300, Ilias Apalodimas wrote:

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Jesper Dangaard Brouer
On Mon, 14 Sep 2020 15:01:15 +0100 Will Deacon wrote: > Hi Ilias, > > On Mon, Sep 14, 2020 at 04:23:50PM +0300, Ilias Apalodimas wrote: > > On Mon, Sep 14, 2020 at 03:35:04PM +0300, Ilias Apalodimas wrote: > > > On Mon, Sep 14, 2020 at 01:20:43PM +0100, Will Deacon wrote: > > > > On Mon,

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Ilias Apalodimas
Hi Will, On Mon, Sep 14, 2020 at 03:01:15PM +0100, Will Deacon wrote: > Hi Ilias, > [...] > > > > > > > > No Fixes: tag? > > > > > > I'll re-spin and apply one > > > > > Any suggestion on any Fixes I should apply? The original code was 'correct' > > and > > broke only when bounded loops

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Will Deacon
Hi Ilias, On Mon, Sep 14, 2020 at 04:23:50PM +0300, Ilias Apalodimas wrote: > On Mon, Sep 14, 2020 at 03:35:04PM +0300, Ilias Apalodimas wrote: > > On Mon, Sep 14, 2020 at 01:20:43PM +0100, Will Deacon wrote: > > > On Mon, Sep 14, 2020 at 11:36:21AM +0300, Ilias Apalodimas wrote: > > > > Running

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Ilias Apalodimas
Hi Will, On Mon, Sep 14, 2020 at 03:35:04PM +0300, Ilias Apalodimas wrote: > On Mon, Sep 14, 2020 at 01:20:43PM +0100, Will Deacon wrote: > > On Mon, Sep 14, 2020 at 11:36:21AM +0300, Ilias Apalodimas wrote: > > > Running the eBPF test_verifier leads to random errors looking like this: > > > > >

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Ilias Apalodimas
On Mon, Sep 14, 2020 at 01:20:43PM +0100, Will Deacon wrote: > On Mon, Sep 14, 2020 at 11:36:21AM +0300, Ilias Apalodimas wrote: > > Running the eBPF test_verifier leads to random errors looking like this: > > > > [ 6525.735488] Unexpected kernel BRK exception at EL1 > > [ 6525.735502] Internal

Re: [PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Will Deacon
On Mon, Sep 14, 2020 at 11:36:21AM +0300, Ilias Apalodimas wrote: > Running the eBPF test_verifier leads to random errors looking like this: > > [ 6525.735488] Unexpected kernel BRK exception at EL1 > [ 6525.735502] Internal error: ptrace BRK handler: f2000100 [#1] SMP > [ 6525.741609] Modules

[PATCH] arm64: bpf: Fix branch offset in JIT

2020-09-14 Thread Ilias Apalodimas
Running the eBPF test_verifier leads to random errors looking like this: [ 6525.735488] Unexpected kernel BRK exception at EL1 [ 6525.735502] Internal error: ptrace BRK handler: f2000100 [#1] SMP [ 6525.741609] Modules linked in: nls_utf8 cifs libdes libarc4 dns_resolver fscache binfmt_misc