netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <dborkman@redhat.com>
To: Xi Wang <xi.wang@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Will Drewry <wad@chromium.org>,
	Eric Dumazet <edumazet@google.com>,
	Russell King <linux@arm.linux.org.uk>,
	David Laight <david.laight@aculab.com>,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nicolas Schichan <nschichan@freebox.fr>
Subject: Re: [PATCH v2 net-next 3/3] ARM: net: bpf_jit_32: support BPF_S_ANC_SECCOMP_LD_W instruction
Date: Sat, 27 Apr 2013 08:27:17 +0200	[thread overview]
Message-ID: <517B6FC5.7070003@redhat.com> (raw)
In-Reply-To: <1367029047-14830-4-git-send-email-xi.wang@gmail.com>

On 04/27/2013 04:17 AM, Xi Wang wrote:
> This patch implements the seccomp BPF_S_ANC_SECCOMP_LD_W instruction
> in ARM JIT.
>
> Signed-off-by: Xi Wang <xi.wang@gmail.com>
> Cc: Daniel Borkmann <dborkman@redhat.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Will Drewry <wad@chromium.org>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: David Laight <david.laight@aculab.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Nicolas Schichan <nschichan@freebox.fr>
> ---
>   arch/arm/net/bpf_jit_32.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
>
> diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
> index 073b085..9bfce464 100644
> --- a/arch/arm/net/bpf_jit_32.c
> +++ b/arch/arm/net/bpf_jit_32.c
> @@ -19,6 +19,7 @@
>   #include <linux/if_vlan.h>
>   #include <asm/cacheflush.h>
>   #include <asm/hwcap.h>
> +#include <asm/syscall.h>
>
>   #include "bpf_jit_32.h"
>
> @@ -845,6 +846,19 @@ b_epilogue:
>   			off = offsetof(struct sk_buff, queue_mapping);
>   			emit(ARM_LDRH_I(r_A, r_skb, off), ctx);
>   			break;
> +#ifdef CONFIG_SECCOMP_FILTER
> +		case BPF_S_ANC_SECCOMP_LD_W:
> +			if (k == offsetof(struct seccomp_data, arch)) {
> +				emit_mov_i(r_A, AUDIT_ARCH_ARM, ctx);
> +				break;
> +			}

Not an expert in ARM, but ...

Arent't you doing here a similar thing in terms of getting arch as Eric
criticized (Nicolas' implementation does not use that part btw.)? Also,
even if it would be possible here, now your 2 JIT implementations differ
in behaviour. I think this is unintended.

Besides all that, I think I also pointed you to a patch that already made
it in for ARM, not sure why you keep posting the ARM JIT implementation?

> +			ctx->seen |= SEEN_CALL;
> +			emit_mov_i(ARM_R3, (u32)seccomp_bpf_load, ctx);
> +			emit_mov_i(ARM_R0, k, ctx);
> +			emit_blx_r(ARM_R3, ctx);
> +			emit(ARM_MOV_R(r_A, ARM_R0), ctx);
> +			break;
> +#endif
>   		default:
>   			return -1;
>   		}
>

  reply	other threads:[~2013-04-27  6:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-27  2:17 [PATCH v2 net-next 0/3] seccomp filter JIT Xi Wang
2013-04-27  2:17 ` [PATCH v2 net-next 1/3] filter: refactor BPF JIT for seccomp filters Xi Wang
2013-04-27  2:17 ` [PATCH v2 net-next 2/3] x86: bpf_jit_comp: support BPF_S_ANC_SECCOMP_LD_W instruction Xi Wang
2013-04-28  1:21   ` Eric Dumazet
2013-04-29  7:48     ` Xi Wang
2013-04-27  2:17 ` [PATCH v2 net-next 3/3] ARM: net: bpf_jit_32: " Xi Wang
2013-04-27  6:27   ` Daniel Borkmann [this message]
2013-04-27 18:32     ` Xi Wang
2013-04-29 10:16       ` Daniel Borkmann
2013-04-29 12:39       ` Nicolas Schichan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=517B6FC5.7070003@redhat.com \
    --to=dborkman@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=david.laight@aculab.com \
    --cc=edumazet@google.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=nschichan@freebox.fr \
    --cc=wad@chromium.org \
    --cc=xi.wang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).