diff mbox

[v2] ARM: net: add JIT support for loads from struct seccomp_data.

Message ID 1431003613-16554-1-git-send-email-nschichan@freebox.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Nicolas Schichan May 7, 2015, 1 p.m. UTC
Signed-off-by: Nicolas Schichan <nschichan@freebox.fr>
---

This patch was first sent as part of a serie modifying the core
seccomp code to allow the use of the classic BPF JIT. As the core
changes have been submitted to netdev by Daniel Borkmann, it is now
time to re-submit this patch separately.

While not physically dependent of the core seccomp changes they are
needed for the code added in this patch to be triggered.

 arch/arm/net/bpf_jit_32.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

David Miller May 10, 2015, 2:28 a.m. UTC | #1
From: Nicolas Schichan <nschichan@freebox.fr>
Date: Thu,  7 May 2015 15:00:13 +0200

> Signed-off-by: Nicolas Schichan <nschichan@freebox.fr>
> ---
> 
> This patch was first sent as part of a serie modifying the core
> seccomp code to allow the use of the classic BPF JIT. As the core
> changes have been submitted to netdev by Daniel Borkmann, it is now
> time to re-submit this patch separately.
> 
> While not physically dependent of the core seccomp changes they are
> needed for the code added in this patch to be triggered.

Where would you like this to be applied, my tree?

This is an ongoing situation, where people have traditionally not
consistently wanted bpf JIT patches to go into the networking tree.

So I beg everyone posting such things to netdev to be _clear_
and _explicit_ about whether you expect me to integrate the patch
or not.

Thanks.
Russell King - ARM Linux May 10, 2015, 7:40 p.m. UTC | #2
On Sat, May 09, 2015 at 10:28:58PM -0400, David Miller wrote:
> From: Nicolas Schichan <nschichan@freebox.fr>
> Date: Thu,  7 May 2015 15:00:13 +0200
> 
> > Signed-off-by: Nicolas Schichan <nschichan@freebox.fr>
> > ---
> > 
> > This patch was first sent as part of a serie modifying the core
> > seccomp code to allow the use of the classic BPF JIT. As the core
> > changes have been submitted to netdev by Daniel Borkmann, it is now
> > time to re-submit this patch separately.
> > 
> > While not physically dependent of the core seccomp changes they are
> > needed for the code added in this patch to be triggered.
> 
> Where would you like this to be applied, my tree?
> 
> This is an ongoing situation, where people have traditionally not
> consistently wanted bpf JIT patches to go into the networking tree.
> 
> So I beg everyone posting such things to netdev to be _clear_
> and _explicit_ about whether you expect me to integrate the patch
> or not.

I think you have taken previous ARM net JIT patches, so I think it
makes sense if you continue to do so.  I'm not knowledgable of the
JIT interface myself, all I can say about many of these patches is
that they look okay to me on a superficial basis.

I suspect you're doing more or less the same, but from a slightly
different perspective (presumably through not knowing ARM assembly.)
David Miller May 10, 2015, 11:20 p.m. UTC | #3
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
Date: Sun, 10 May 2015 20:40:28 +0100

> I think you have taken previous ARM net JIT patches, so I think it
> makes sense if you continue to do so.  I'm not knowledgable of the
> JIT interface myself, all I can say about many of these patches is
> that they look okay to me on a superficial basis.
> 
> I suspect you're doing more or less the same, but from a slightly
> different perspective (presumably through not knowing ARM assembly.)

Ok, I'll flow the ARM JIT patches through my tree then.

Thanks Russell.
David Miller May 12, 2015, 10:20 p.m. UTC | #4
From: Nicolas Schichan <nschichan@freebox.fr>
Date: Thu,  7 May 2015 15:00:13 +0200

> Signed-off-by: Nicolas Schichan <nschichan@freebox.fr>

Applied, thanks.
diff mbox

Patch

diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index f412b53..6bda637 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -863,6 +863,16 @@  b_epilogue:
 			off = offsetof(struct sk_buff, queue_mapping);
 			emit(ARM_LDRH_I(r_A, r_skb, off), ctx);
 			break;
+		case BPF_LDX | BPF_W | BPF_ABS:
+			/*
+			 * load a 32bit word from struct seccomp_data.
+			 * seccomp_check_filter() will already have checked
+			 * that k is 32bit aligned and lies within the
+			 * struct seccomp_data.
+			 */
+			ctx->seen |= SEEN_SKB;
+			emit(ARM_LDR_I(r_A, r_skb, k), ctx);
+			break;
 		default:
 			return -1;
 		}