* [PATCH v2] powerpc/bpf: populate extable entries only during the last pass
@ 2023-04-25 6:58 Hari Bathini
2023-04-25 14:36 ` Naveen N. Rao
2023-07-03 5:21 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Hari Bathini @ 2023-04-25 6:58 UTC (permalink / raw)
To: linuxppc-dev, bpf
Cc: Song Liu, Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
stable, Naveen N. Rao
Since commit 85e031154c7c ("powerpc/bpf: Perform complete extra passes
to update addresses"), two additional passes are performed to avoid
space and CPU time wastage on powerpc. But these extra passes led to
WARN_ON_ONCE() hits in bpf_add_extable_entry() as extable entries are
populated again, during the extra pass, without resetting the index.
Fix it by resetting entry index before repopulating extable entries,
if and when there is an additional pass.
Fixes: 85e031154c7c ("powerpc/bpf: Perform complete extra passes to update addresses")
Cc: stable@vger.kernel.org
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
---
arch/powerpc/net/bpf_jit_comp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index e93aefcfb83f..37043dfc1add 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -101,6 +101,8 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
bpf_hdr = jit_data->header;
proglen = jit_data->proglen;
extra_pass = true;
+ /* During extra pass, ensure index is reset before repopulating extable entries */
+ cgctx.exentry_idx = 0;
goto skip_init_ctx;
}
--
2.40.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] powerpc/bpf: populate extable entries only during the last pass
2023-04-25 6:58 [PATCH v2] powerpc/bpf: populate extable entries only during the last pass Hari Bathini
@ 2023-04-25 14:36 ` Naveen N. Rao
2023-07-03 5:21 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Naveen N. Rao @ 2023-04-25 14:36 UTC (permalink / raw)
To: bpf, Hari Bathini, linuxppc-dev
Cc: Song Liu, Daniel Borkmann, Andrii Nakryiko, stable,
Alexei Starovoitov
Hari Bathini wrote:
> Since commit 85e031154c7c ("powerpc/bpf: Perform complete extra passes
> to update addresses"), two additional passes are performed to avoid
> space and CPU time wastage on powerpc. But these extra passes led to
> WARN_ON_ONCE() hits in bpf_add_extable_entry() as extable entries are
> populated again, during the extra pass, without resetting the index.
> Fix it by resetting entry index before repopulating extable entries,
> if and when there is an additional pass.
>
> Fixes: 85e031154c7c ("powerpc/bpf: Perform complete extra passes to update addresses")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> ---
> arch/powerpc/net/bpf_jit_comp.c | 2 ++
> 1 file changed, 2 insertions(+)
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
- Naveen
>
> diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
> index e93aefcfb83f..37043dfc1add 100644
> --- a/arch/powerpc/net/bpf_jit_comp.c
> +++ b/arch/powerpc/net/bpf_jit_comp.c
> @@ -101,6 +101,8 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
> bpf_hdr = jit_data->header;
> proglen = jit_data->proglen;
> extra_pass = true;
> + /* During extra pass, ensure index is reset before repopulating extable entries */
> + cgctx.exentry_idx = 0;
> goto skip_init_ctx;
> }
>
> --
> 2.40.0
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] powerpc/bpf: populate extable entries only during the last pass
2023-04-25 6:58 [PATCH v2] powerpc/bpf: populate extable entries only during the last pass Hari Bathini
2023-04-25 14:36 ` Naveen N. Rao
@ 2023-07-03 5:21 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2023-07-03 5:21 UTC (permalink / raw)
To: linuxppc-dev, bpf, Hari Bathini
Cc: Song Liu, Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
stable, Naveen N. Rao
On Tue, 25 Apr 2023 12:28:29 +0530, Hari Bathini wrote:
> Since commit 85e031154c7c ("powerpc/bpf: Perform complete extra passes
> to update addresses"), two additional passes are performed to avoid
> space and CPU time wastage on powerpc. But these extra passes led to
> WARN_ON_ONCE() hits in bpf_add_extable_entry() as extable entries are
> populated again, during the extra pass, without resetting the index.
> Fix it by resetting entry index before repopulating extable entries,
> if and when there is an additional pass.
>
> [...]
Applied to powerpc/fixes.
[1/1] powerpc/bpf: populate extable entries only during the last pass
https://git.kernel.org/powerpc/c/35a4b8ce4ac00e940b46b1034916ccb22ce9bdef
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-03 5:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-25 6:58 [PATCH v2] powerpc/bpf: populate extable entries only during the last pass Hari Bathini
2023-04-25 14:36 ` Naveen N. Rao
2023-07-03 5:21 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).