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]
Message-ID: <CABg9mcuAuoSBg4zWYHnaTzAGsH4BK5-VhD=HRDmsHJRCUrnJUw@mail.gmail.com>
Date:	Wed, 4 Nov 2015 10:25:05 -0800
From:	Z Lim <zlim.lnx@...il.com>
To:	"Shi, Yang" <yang.shi@...aro.org>
Cc:	Xi Wang <xi.wang@...il.com>,
	Catalin Marinas <catalin.marinas@....com>,
	stable@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	Alexei Starovoitov <ast@...mgrid.com>
Subject: Re: [PATCH] arm64: bpf: fix div-by-zero case

On Wed, Nov 4, 2015 at 10:21 AM, Shi, Yang <yang.shi@...aro.org> wrote:
> On 11/3/2015 11:04 PM, Xi Wang wrote:
>>
>> On Tue, Nov 3, 2015 at 10:56 PM, Zi Shen Lim <zlim.lnx@...il.com> wrote:
>>>
>>>          case BPF_ALU | BPF_DIV | BPF_X:
>>>          case BPF_ALU64 | BPF_DIV | BPF_X:
>>> +       {
>>> +               const u8 r0 = bpf2a64[BPF_REG_0];
>>> +
>>> +               /* if (src == 0) return 0 */
>>> +               jmp_offset = 3; /* skip ahead to else path */
>>> +               check_imm19(jmp_offset);
>>> +               emit(A64_CBNZ(is64, src, jmp_offset), ctx);
>>> +               emit(A64_MOVZ(1, r0, 0, 0), ctx);
>>> +               jmp_offset = epilogue_offset(ctx);
>>> +               check_imm26(jmp_offset);
>>> +               emit(A64_B(jmp_offset), ctx);
>>> +               /* else */
>>>                  emit(A64_UDIV(is64, dst, dst, src), ctx);
>>>                  break;
>>> +       }
>>>          case BPF_ALU | BPF_MOD | BPF_X:
>>>          case BPF_ALU64 | BPF_MOD | BPF_X:
>>
>>
>> BPF_MOD might need the same fix.

I'll post a fix for this case as well.

>
>
> Agreed, and we may need add one more test cases in test_bpf module to cover
> MOD?

Let me know if you have a test case ready :)

>
> Yang
>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@...ts.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ