linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Mark Lord <mlord@pobox.com>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kees Cook <keescook@chromium.org>,
	Andy Lutomirski <luto@amacapital.net>,
	mpe@ellerman.id.au, Will Drewry <wad@chromium.org>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH] bpf, powerpc: fix jit for seccomp_data access
Date: Tue, 20 Feb 2018 14:49:20 -0500	[thread overview]
Message-ID: <2f428cf9-23f3-d1f1-1524-46d6faa17386@pobox.com> (raw)
In-Reply-To: <1519154571.d9vaokens9.naveen@linux.ibm.com>

I am using SECCOMP to filter syscalls on a ppc32 platform,
and noticed that the JIT compiler was failing on the BPF
even though the interpreter was working fine.

The issue was that the compiler was missing one of the instructions
used by SECCOMP, so here is a patch to enable JIT for that instruction.

Signed-Off-By:  Mark Lord <mlord@pobox.com>

--- old/arch/powerpc/net/bpf_jit_comp.c 2018-02-16 14:07:01.000000000 -0500
+++ linux/arch/powerpc/net/bpf_jit_comp.c       2018-02-20 14:41:20.805227494 -0500
@@ -329,6 +329,9 @@ static int bpf_jit_build_body(struct bpf
                        BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4);
                        PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, len));
                        break;
+               case BPF_LDX | BPF_W | BPF_ABS: /* A = *((u32 *)(seccomp_data + K)); */
+                       PPC_LWZ_OFFS(r_A, r_skb, K);
+                       break;
                case BPF_LDX | BPF_W | BPF_LEN: /* X = skb->len; */
                        PPC_LWZ_OFFS(r_X, r_skb, offsetof(struct sk_buff, len));
                        break;
-- 
Mark Lord
Real-Time Remedies Inc.
mlord@pobox.com

       reply	other threads:[~2018-02-20 21:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d79074fe-2ee1-c132-ef2d-f6bb618b53bb@pobox.com>
     [not found] ` <2a91fe0c-ea85-dd79-6682-66b1301d7e49@iogearbox.net>
     [not found]   ` <53a6b85c-8cb7-d4d0-8234-7ecfb1a709b2@pobox.com>
     [not found]     ` <1519154571.d9vaokens9.naveen@linux.ibm.com>
2018-02-20 19:49       ` Mark Lord [this message]
2018-02-21  0:33         ` [PATCH] bpf, powerpc: fix jit for seccomp_data access Michael Ellerman
2018-02-21  0:47           ` Daniel Borkmann
2018-02-22  3:34             ` Michael Ellerman
2018-02-23  5:39         ` Michael Ellerman
     [not found]       ` <2f428cf9-23f3-d1f1-1524-46d6faa17386__30848.5239781023$1519169515$gmane$org@pobox.com>
     [not found]         ` <2f428cf9-23f3-d1f1-1524-46d6faa17386__30848.5239781023$1519169515$gmane$org@ pobox.com>
2018-02-21  8:35           ` [PATCH] " Naveen N. Rao
2018-02-21 12:52             ` Mark Lord
2018-02-21 13:41               ` Mark Lord
2018-02-21 14:08                 ` Naveen N. Rao
2018-02-22  3:38                   ` Michael Ellerman

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=2f428cf9-23f3-d1f1-1524-46d6faa17386@pobox.com \
    --to=mlord@pobox.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=keescook@chromium.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=luto@amacapital.net \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=wad@chromium.org \
    /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).