linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: illusionist.neo@gmail.com (Shubham Bansal)
To: linux-arm-kernel@lists.infradead.org
Subject: arch: arm: bpf: Converting cBPF to eBPF for arm 32 bit
Date: Sun, 7 May 2017 03:47:08 +0530	[thread overview]
Message-ID: <CAHgaXdLsUYEmY86Nz3rC50repRA_rz-CVYx_i90k1Q5G1E-mCw@mail.gmail.com> (raw)
In-Reply-To: <CAHgaXd+2vF=d5zpWTg+a=vSnv2ZA+8LCR_MXT_MDKn4r2s8sig@mail.gmail.com>

Okay. My mistake. I just checked the verify function.

Apologies.
Best,
Shubham Bansal


On Sun, May 7, 2017 at 1:57 AM, Shubham Bansal
<illusionist.neo@gmail.com> wrote:
> Thanks David.
>
> Hi all,
>
> I have two questions about the code at arch/arm64/net/bpf_jit_comp.c.
>
> 1. At line 708, " const u8 r1 = bpf2a64[BPF_REG_1]; /* r1: struct
> sk_buff *skb */ ".
>     Why is this code using BPF_REG_1 before saving it? As far as I
> know, BPF_REG_1 has pointer to bpf program context and this code
> clearly is overwriting that pointer which makes that pointer useless
> for future usage. It clearly looks like a bug.
>
> 2. At line 256, " emit(A64_LDR64(prg, tmp, r3), ctx); ".
>     This line of code is used to load an array( of pointers ) element,
> where r3 is used as an index of that array. Shouldn't it be be
> arithmetic left shifted by 3 or multiplied by 8 to get the right
> address in that array of pointers ?
>
> Apologies if any of the above question is stupid to ask.
>
> Best,
> Shubham
> Best,
> Shubham Bansal
>
>
> On Sun, May 7, 2017 at 12:08 AM, David Miller <davem@davemloft.net> wrote:
>> From: Shubham Bansal <illusionist.neo@gmail.com>
>> Date: Sat, 6 May 2017 22:18:16 +0530
>>
>>> Hi Daniel,
>>>
>>> Thanks for the last reply about the testing of eBPF JIT.
>>>
>>> I have one issue though, I am not able to find what BPF_ABS and
>>> BPF_IND instruction does exactly.
>>
>> They are not instructions, they are modifiers for the BPF_LD
>> instruction which indicate an SKB load is to be performed.
>>
>> You never need to ask what a BPF instruction does, it is clear
>> defined in the BPF interperter found in kernel/bpf/core.c
>>
>> Look for the case statement LD_ABS_W and friends in __bpf_prog_run().

  reply	other threads:[~2017-05-06 22:17 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 10:38 arch: arm: bpf: Converting cBPF to eBPF for arm 32 bit Shubham Bansal
2017-01-30 21:57 ` Kees Cook
     [not found]   ` <CAHgaXd+nj69n-Xf46N=4M-j-0hKHVrrLfsvRZCG=2CCAtVF6ZA@mail.gmail.com>
     [not found]     ` <CAGXu5j+NSLomuSgD40kys+pWc+J9aB6Bbk_gSP9Lp_ScimQn_w@mail.gmail.com>
2017-02-01 13:01       ` Shubham Bansal
     [not found]         ` <76621BFF-B30B-4417-AB2B-DB21CA6092D9@netronome.com>
2017-02-03  7:04           ` Shubham Bansal
2017-02-03  8:25             ` nick viljoen
2017-02-08  7:29         ` Shubham Bansal
2017-02-08 19:41         ` Kees Cook
2017-03-15 12:13           ` Shubham Bansal
2017-03-15 21:55             ` David Miller
2017-03-28 20:49               ` Shubham Bansal
2017-03-29  0:00                 ` Daniel Borkmann
2017-03-30 14:04                   ` Shubham Bansal
2017-04-06 11:05                     ` Shubham Bansal
2017-04-06 12:51                       ` Daniel Borkmann
2017-05-06 16:48                         ` Shubham Bansal
2017-05-06 18:38                           ` David Miller
2017-05-06 20:27                             ` Shubham Bansal
2017-05-06 22:17                               ` Shubham Bansal [this message]
2017-05-09 20:12                         ` Shubham Bansal
2017-05-09 20:19                           ` David Miller
2017-05-09 20:25                           ` Daniel Borkmann
     [not found] <CAHgaXdKsO2xoKYp7g91g+n+d_1KHSSByLjzBB-WjVXSjhB7qxw@mail.gmail.com>
     [not found] ` <20170510.212952.1440495072777358778.davem@davemloft.net>
     [not found]   ` <CAHgaXdK8LEEUPm4jTRRzCnjwdWAauHmmB=caZsSFY8MmStH89Q@mail.gmail.com>
     [not found]     ` <20170510.215218.2185526627014393313.davem@davemloft.net>
     [not found]       ` <CAHgaXdKZ_v+iO7uqEDx7PA7D+xcp1FngGvJ1SRSsGXNQ-iWWDQ@mail.gmail.com>
2017-05-11  9:32         ` Shubham Bansal
2017-05-11 15:30           ` Kees Cook
2017-05-13 21:38             ` Shubham Bansal
2017-05-15 17:44               ` Kees Cook
2017-05-15 19:55               ` Daniel Borkmann
2017-05-20 20:01                 ` Shubham Bansal
2017-05-22 13:01                   ` Daniel Borkmann
2017-05-22 17:04                     ` Shubham Bansal
2017-05-22 20:05                       ` Kees Cook
2017-05-23  2:58                         ` Shubham Bansal
2017-05-23  4:27                           ` Kees Cook
2017-05-22 18:58                   ` Kees Cook
2017-05-22 19:08                     ` Florian Fainelli
2017-05-23  3:34                       ` Shubham Bansal
2017-05-23  4:22                         ` Kees Cook
2017-05-23  5:03                           ` Shubham Bansal
2017-05-23  5:35                             ` Kees Cook
     [not found]                               ` <CAHgaXdJa9uJYO3bODuzDRaqOas0i=zMk0jioWFXKm_=UJRtVrw@mail.gmail.com>
2017-05-23 19:32                                 ` Kees Cook

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=CAHgaXdLsUYEmY86Nz3rC50repRA_rz-CVYx_i90k1Q5G1E-mCw@mail.gmail.com \
    --to=illusionist.neo@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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).