[PATCH v3 1/3] bpf,x64: pad NOPs to make images converge more easily

2021-01-14 Thread Gary Lin
The x64 bpf jit expects bpf images converge within the given passes, but it could fail to do so with some corner cases. For example: l0: ja 40 l1: ja 40 [... repeated ja 40 ] l39:ja 40 l40:ret #0 This bpf program contains 40 "ja 40" instructions w

Re: [PATCH v3 1/3] bpf,x64: pad NOPs to make images converge more easily

2021-01-14 Thread Alexei Starovoitov
On Thu, Jan 14, 2021 at 1:54 AM Gary Lin wrote: > * pass to emit the final image. > */ > - for (pass = 0; pass < 20 || image; pass++) { > - proglen = do_jit(prog, addrs, image, oldproglen, &ctx); > + for (pass = 0; pass < MAX_PASSES || image; pass++) { >

Re: [PATCH v3 1/3] bpf,x64: pad NOPs to make images converge more easily

2021-01-15 Thread Gary Lin
On Thu, Jan 14, 2021 at 10:37:33PM -0800, Alexei Starovoitov wrote: > On Thu, Jan 14, 2021 at 1:54 AM Gary Lin wrote: > > * pass to emit the final image. > > */ > > - for (pass = 0; pass < 20 || image; pass++) { > > - proglen = do_jit(prog, addrs, image, oldpr

Re: [PATCH v3 1/3] bpf,x64: pad NOPs to make images converge more easily

2021-01-15 Thread Alexei Starovoitov
On Fri, Jan 15, 2021 at 1:41 AM Gary Lin wrote: > > On Thu, Jan 14, 2021 at 10:37:33PM -0800, Alexei Starovoitov wrote: > > On Thu, Jan 14, 2021 at 1:54 AM Gary Lin wrote: > > > * pass to emit the final image. > > > */ > > > - for (pass = 0; pass < 20 || image; pass++) { >

Re: [PATCH v3 1/3] bpf,x64: pad NOPs to make images converge more easily

2021-01-17 Thread Gary Lin
On Fri, Jan 15, 2021 at 08:04:06AM -0800, Alexei Starovoitov wrote: > On Fri, Jan 15, 2021 at 1:41 AM Gary Lin wrote: > > > > On Thu, Jan 14, 2021 at 10:37:33PM -0800, Alexei Starovoitov wrote: > > > On Thu, Jan 14, 2021 at 1:54 AM Gary Lin wrote: > > > > * pass to emit the final image.