lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87bm46z8jl.fsf@netronome.com>
Date:   Thu, 24 Jan 2019 09:53:02 +0000
From:   Jiong Wang <jiong.wang@...ronome.com>
To:     Sandipan Das <sandipan@...ux.ibm.com>
Cc:     Jiong Wang <jiong.wang@...ronome.com>, ast@...nel.org,
        daniel@...earbox.net, netdev@...r.kernel.org,
        oss-drivers@...ronome.com,
        "Naveen N . Rao" <naveen.n.rao@...ux.ibm.com>
Subject: Re: [PATCH bpf-next v2 13/16] ppc: bpf: implement jitting of JMP32


Sandipan Das writes:

> Hi Jiong,
>
> On 21/01/19 6:45 PM, Jiong Wang wrote:
>> This patch implements code-gen for new JMP32 instructions on ppc.
>> 
>> For JMP32 | JSET, instruction encoding for PPC_RLWINM_DOT is added to check
>> the result of ANDing low 32-bit of operands.
>> 
>> Cc: Naveen N. Rao <naveen.n.rao@...ux.ibm.com>
>> Cc: Sandipan Das <sandipan@...ux.ibm.com>
>> Signed-off-by: Jiong Wang <jiong.wang@...ronome.com>
>> ---
>>  arch/powerpc/include/asm/ppc-opcode.h |  1 +
>>  arch/powerpc/net/bpf_jit.h            |  4 ++
>>  arch/powerpc/net/bpf_jit_comp64.c     | 98 ++++++++++++++++++++++++++++++-----
>>  3 files changed, 89 insertions(+), 14 deletions(-)
>> [...]
>
> I ran the verifier selftests on a ppc64 test system and found that the jmp32 tests
> were failing because the instructions were not being decoded by the JIT compiler.
> The codegen logic looks good to me and the tests passed after I fixed the decoding
> logic. Here are the changes that I had to make:

Ah, I missed the outer layer decoding logic.

Thanks for the review, test and fix. Will integrate the following in v3.

Regards,
Jiong

>
> diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
> index 2e40c2b251ba..15bba765fa79 100644
> --- a/arch/powerpc/net/bpf_jit_comp64.c
> +++ b/arch/powerpc/net/bpf_jit_comp64.c
> @@ -768,36 +768,58 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
>                 case BPF_JMP | BPF_JGT | BPF_X:
>                 case BPF_JMP | BPF_JSGT | BPF_K:
>                 case BPF_JMP | BPF_JSGT | BPF_X:
> +               case BPF_JMP32 | BPF_JGT | BPF_K:
> +               case BPF_JMP32 | BPF_JGT | BPF_X:
> +               case BPF_JMP32 | BPF_JSGT | BPF_K:
> +               case BPF_JMP32 | BPF_JSGT | BPF_X:
>                         true_cond = COND_GT;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JLT | BPF_K:
>                 case BPF_JMP | BPF_JLT | BPF_X:
>                 case BPF_JMP | BPF_JSLT | BPF_K:
>                 case BPF_JMP | BPF_JSLT | BPF_X:
> +               case BPF_JMP32 | BPF_JLT | BPF_K:
> +               case BPF_JMP32 | BPF_JLT | BPF_X:
> +               case BPF_JMP32 | BPF_JSLT | BPF_K:
> +               case BPF_JMP32 | BPF_JSLT | BPF_X:
>                         true_cond = COND_LT;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JGE | BPF_K:
>                 case BPF_JMP | BPF_JGE | BPF_X:
>                 case BPF_JMP | BPF_JSGE | BPF_K:
>                 case BPF_JMP | BPF_JSGE | BPF_X:
> +               case BPF_JMP32 | BPF_JGE | BPF_K:
> +               case BPF_JMP32 | BPF_JGE | BPF_X:
> +               case BPF_JMP32 | BPF_JSGE | BPF_K:
> +               case BPF_JMP32 | BPF_JSGE | BPF_X:
>                         true_cond = COND_GE;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JLE | BPF_K:
>                 case BPF_JMP | BPF_JLE | BPF_X:
>                 case BPF_JMP | BPF_JSLE | BPF_K:
>                 case BPF_JMP | BPF_JSLE | BPF_X:
> +               case BPF_JMP32 | BPF_JLE | BPF_K:
> +               case BPF_JMP32 | BPF_JLE | BPF_X:
> +               case BPF_JMP32 | BPF_JSLE | BPF_K:
> +               case BPF_JMP32 | BPF_JSLE | BPF_X:
>                         true_cond = COND_LE;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JEQ | BPF_K:
>                 case BPF_JMP | BPF_JEQ | BPF_X:
> +               case BPF_JMP32 | BPF_JEQ | BPF_K:
> +               case BPF_JMP32 | BPF_JEQ | BPF_X:
>                         true_cond = COND_EQ;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JNE | BPF_K:
>                 case BPF_JMP | BPF_JNE | BPF_X:
> +               case BPF_JMP32 | BPF_JNE | BPF_K:
> +               case BPF_JMP32 | BPF_JNE | BPF_X:
>                         true_cond = COND_NE;
>                         goto cond_branch;
>                 case BPF_JMP | BPF_JSET | BPF_K:
>                 case BPF_JMP | BPF_JSET | BPF_X:
> +               case BPF_JMP32 | BPF_JSET | BPF_K:
> +               case BPF_JMP32 | BPF_JSET | BPF_X:
>                         true_cond = COND_NE;
>                         /* Fall through */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ