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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 29 Jul 2021 08:50:01 -0700
From:   Yonghong Song <yhs@...com>
To:     Johan Almbladh <johan.almbladh@...finetworks.com>
CC:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Tony Ambardar <Tony.Ambardar@...il.com>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH 10/14] bpf/tests: Add branch conversion JIT test



On 7/29/21 6:24 AM, Johan Almbladh wrote:
> On Thu, Jul 29, 2021 at 2:55 AM Yonghong Song <yhs@...com> wrote:
>>> +static int bpf_fill_long_jmp(struct bpf_test *self)
>>> +{
>>> +     unsigned int len = BPF_MAXINSNS;
>>
>> BPF_MAXINSNS is 4096 as defined in uapi/linux/bpf_common.h.
>> Will it be able to trigger a PC relative branch + long
>> conditional jump?
> 
> It does, on the MIPS32 JIT. The ALU64 MUL instruction with a large
> immediate was chosen since it expands to a lot of MIPS32 instructions:
> 2 to load the immediate, 1 to zero/sign extend it, and then 9 for the
> 64x64 multiply.

Maybe added a comment in the code to mention that with BPF_MAXINSNS
PC relative branch + long conditional jump can be triggered on MIPS32
JIT. Other architecture may need a different/larger number?

> 
> Other JITs will be different of course. On the other hand, other
> architectures have other limitations that this test may not trigger
> anyway. I added the test because I was implementing a non-trivial
> iterative branch conversion logic in the MIPS32 JIT. One can argue
> that when such complex JIT mechanisms are added, the test suite should
> also be updated to cover that, especially if the mechanism handles
> something that almost never occur in practice.
> 
> Since I was able to trigger the branch conversion with BPF_MAXINSNS
> instructions, and no other test was using more, I left it at that.
> However, should I or someone else work on the MIPS64 JIT, I think
> updating the test suite so that similar special cases there are
> triggered would be a valuable contribution.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ