Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1262542
| From | Daniel Borkmann <daniel@iogearbox.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] arm64: bpf: fix div-by-zero case |
| Date | 2015-11-04 20:40 +0100 |
| Message-ID | <qrc4y-4EN-15@gated-at.bofh.it> (permalink) |
| References | <qr0d4-5pG-7@gated-at.bofh.it> <qr0mJ-5J7-5@gated-at.bofh.it> <qraYO-411-27@gated-at.bofh.it> <qrbi9-47z-11@gated-at.bofh.it> <qrbi9-47z-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 11/04/2015 07:41 PM, Shi, Yang wrote:
...
>>> 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 :)
>
> Does the below change look like a valid test?
>
> + "MOD default X",
> + .u.insns = {
> + /*
> + * A = 0x42
> + * A = A mod X ; this halt the filter execution if X is 0
> + * ret 0x42
> + */
> + BPF_STMT(BPF_LD | BPF_IMM, 0x42),
> + BPF_STMT(BPF_ALU | BPF_MOD | BPF_X, 0),
> + BPF_STMT(BPF_RET | BPF_K, 0x42),
> + },
> + CLASSIC | FLAG_NO_DATA,
> + {},
> + { {0x1, 0x0 } },
> + },
> + {
> + "MOD default A",
> + .u.insns = {
> + /*
> + * A = A mod 1
> + * ret A
> + */
> + BPF_STMT(BPF_ALU | BPF_MOD | BPF_K, 0x1),
> + BPF_STMT(BPF_RET | BPF_A, 0x0),
> + },
> + CLASSIC | FLAG_NO_DATA,
> + {},
> + { {0x1, 0x0 } },
> + },
>
> My test result with it:
> test_bpf: #284 MOD default X jited:1 ret 66 != 0 FAIL (1 times)
> test_bpf: #285 MOD default A jited:1 102 PASS
>
> If it looks right, I will post a patch to add the test cases.
Looks good to me.
Thanks,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] arm64: bpf: fix div-by-zero case Zi Shen Lim <zlim.lnx@gmail.com> - 2015-11-04 08:00 +0100
Re: [PATCH] arm64: bpf: fix div-by-zero case Xi Wang <xi.wang@gmail.com> - 2015-11-04 08:10 +0100
Re: [PATCH] arm64: bpf: fix div-by-zero case "Shi, Yang" <yang.shi@linaro.org> - 2015-11-04 19:30 +0100
Re: [PATCH] arm64: bpf: fix div-by-zero case "Shi, Yang" <yang.shi@linaro.org> - 2015-11-04 19:50 +0100
Re: [PATCH] arm64: bpf: fix div-by-zero case Daniel Borkmann <daniel@iogearbox.net> - 2015-11-04 20:40 +0100
Re: [PATCH] arm64: bpf: fix div-by-zero case Z Lim <zlim.lnx@gmail.com> - 2015-11-04 20:00 +0100
Re: [PATCH] arm64: bpf: fix div-by-zero case "Shi, Yang" <yang.shi@linaro.org> - 2015-11-04 19:10 +0100
csiph-web