* [PATCH net] bpf, arm: start flushing icache range from header
@ 2015-11-14 0:26 Daniel Borkmann
2015-11-16 11:40 ` Mark Rutland
2015-11-16 19:41 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Borkmann @ 2015-11-14 0:26 UTC (permalink / raw)
To: davem; +Cc: nschichan, ast, linux-arm-kernel, netdev, Daniel Borkmann
During review I noticed that the icache range we're flushing should
start at header already and not at ctx.image.
Reason is that after 55309dd3d4cd ("net: bpf: arm: address randomize
and write protect JIT code"), we also want to make sure to flush the
random-sized trap in front of the start of the actual program (analogous
to x86). No operational differences from user side.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Nicolas Schichan <nschichan@freebox.fr>
Cc: Alexei Starovoitov <ast@kernel.org>
---
( As arm32 fixes usually go via Dave's tree, targeting -net. )
arch/arm/net/bpf_jit_32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index 2f4b14c..591f9db 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -1061,7 +1061,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
}
build_epilogue(&ctx);
- flush_icache_range((u32)ctx.target, (u32)(ctx.target + ctx.idx));
+ flush_icache_range((u32)header, (u32)(ctx.target + ctx.idx));
#if __LINUX_ARM_ARCH__ < 7
if (ctx.imm_count)
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] bpf, arm: start flushing icache range from header
2015-11-14 0:26 [PATCH net] bpf, arm: start flushing icache range from header Daniel Borkmann
@ 2015-11-16 11:40 ` Mark Rutland
2015-11-16 12:00 ` Mark Rutland
2015-11-16 19:41 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Mark Rutland @ 2015-11-16 11:40 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: davem, linux-arm-kernel, netdev, ast, nschichan
On Sat, Nov 14, 2015 at 01:26:53AM +0100, Daniel Borkmann wrote:
> During review I noticed that the icache range we're flushing should
> start at header already and not at ctx.image.
>
> Reason is that after 55309dd3d4cd ("net: bpf: arm: address randomize
> and write protect JIT code"), we also want to make sure to flush the
> random-sized trap in front of the start of the actual program (analogous
> to x86). No operational differences from user side.
>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Tested-by: Nicolas Schichan <nschichan@freebox.fr>
> Cc: Alexei Starovoitov <ast@kernel.org>
> ---
> ( As arm32 fixes usually go via Dave's tree, targeting -net. )
>
> arch/arm/net/bpf_jit_32.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
> index 2f4b14c..591f9db 100644
> --- a/arch/arm/net/bpf_jit_32.c
> +++ b/arch/arm/net/bpf_jit_32.c
> @@ -1061,7 +1061,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
> }
> build_epilogue(&ctx);
>
> - flush_icache_range((u32)ctx.target, (u32)(ctx.target + ctx.idx));
> + flush_icache_range((u32)header, (u32)(ctx.target + ctx.idx));
As with the arm64 patch, doesn't this prevent us from flushing the end
of the image? ctx.idx doesn't seem to take into account the header size.
Mark.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] bpf, arm: start flushing icache range from header
2015-11-16 11:40 ` Mark Rutland
@ 2015-11-16 12:00 ` Mark Rutland
0 siblings, 0 replies; 4+ messages in thread
From: Mark Rutland @ 2015-11-16 12:00 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: netdev, nschichan, davem, linux-arm-kernel, ast
On Mon, Nov 16, 2015 at 11:40:55AM +0000, Mark Rutland wrote:
> On Sat, Nov 14, 2015 at 01:26:53AM +0100, Daniel Borkmann wrote:
> > During review I noticed that the icache range we're flushing should
> > start at header already and not at ctx.image.
> >
> > Reason is that after 55309dd3d4cd ("net: bpf: arm: address randomize
> > and write protect JIT code"), we also want to make sure to flush the
> > random-sized trap in front of the start of the actual program (analogous
> > to x86). No operational differences from user side.
> >
> > Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> > Tested-by: Nicolas Schichan <nschichan@freebox.fr>
> > Cc: Alexei Starovoitov <ast@kernel.org>
> > ---
> > ( As arm32 fixes usually go via Dave's tree, targeting -net. )
> >
> > arch/arm/net/bpf_jit_32.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
> > index 2f4b14c..591f9db 100644
> > --- a/arch/arm/net/bpf_jit_32.c
> > +++ b/arch/arm/net/bpf_jit_32.c
> > @@ -1061,7 +1061,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
> > }
> > build_epilogue(&ctx);
> >
> > - flush_icache_range((u32)ctx.target, (u32)(ctx.target + ctx.idx));
> > + flush_icache_range((u32)header, (u32)(ctx.target + ctx.idx));
>
> As with the arm64 patch, doesn't this prevent us from flushing the end
> of the image? ctx.idx doesn't seem to take into account the header size.
I'd misread the patch; it is fine.
Sorry for the noise.
Mark.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] bpf, arm: start flushing icache range from header
2015-11-14 0:26 [PATCH net] bpf, arm: start flushing icache range from header Daniel Borkmann
2015-11-16 11:40 ` Mark Rutland
@ 2015-11-16 19:41 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-11-16 19:41 UTC (permalink / raw)
To: daniel; +Cc: nschichan, ast, linux-arm-kernel, netdev
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Sat, 14 Nov 2015 01:26:53 +0100
> During review I noticed that the icache range we're flushing should
> start at header already and not at ctx.image.
>
> Reason is that after 55309dd3d4cd ("net: bpf: arm: address randomize
> and write protect JIT code"), we also want to make sure to flush the
> random-sized trap in front of the start of the actual program (analogous
> to x86). No operational differences from user side.
>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Tested-by: Nicolas Schichan <nschichan@freebox.fr>
> Cc: Alexei Starovoitov <ast@kernel.org>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-16 19:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-14 0:26 [PATCH net] bpf, arm: start flushing icache range from header Daniel Borkmann
2015-11-16 11:40 ` Mark Rutland
2015-11-16 12:00 ` Mark Rutland
2015-11-16 19:41 ` David Miller
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).