From: Shung-Hsi Yu <shung-hsi.yu@suse.com>
To: Dave Thaler <dthaler@microsoft.com>
Cc: bpf <bpf@vger.kernel.org>, Christoph Hellwig <hch@infradead.org>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>
Subject: Re: Rethink how to deal with division/modulo-on-zero (was Re: FW: ebpf-docs: draft of ISA doc updates in progress)
Date: Thu, 22 Sep 2022 13:00:31 +0800 [thread overview]
Message-ID: <Yyvr7z5kTFY2Gc9w@syu-laptop> (raw)
In-Reply-To: <DM4PR21MB344078B626F92E3476090082A34F9@DM4PR21MB3440.namprd21.prod.outlook.com>
On Wed, Sep 21, 2022 at 02:41:28PM +0000, Dave Thaler wrote:
> Shung-Hsi Yu <shung-hsi.yu@suse.com> writes:
> > Just like how BPF verifier prevents a _possible_ out-of-bound memory access,
> > e.g. arr[i] when `i` is not bound-checked. Ideally I'd expect a coherent
> > approach toward division/modulo-on-zero as well; the verifier should prevent
> > program that _might_ do division-on-zero from loading in the first place.
> [...]
> > Admittedly even if achievable, this is a radical approach that is not backward
> > compatible. If such check is implemented, programs that used to load may
> > now be rejected.
>
> FWIW, the PREVAIL verifier attempted to do that, although it was incomplete until a patch I just submitted to it yesterday.
Cool, and skimming through the PR I'm surprised by how minimal the changes
are. Interesting to know that it's possible.
> However, when running the patched version, it would reject some cilium, falco, suricata, etc. programs that it uses as test cases,
> so my patch proposed making it optional in that verifier although maybe there's
> some better alternative.
>
> Certainly I think a runtime should implement the 0 check itself regardless of whether it's rejected or allowed by verification, but I wanted to share evidence that your "may now be rejected" is demonstrably true.
Thanks!
> Dave
>
next prev parent reply other threads:[~2022-09-22 5:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CY5PR21MB377000AC95B475C47B702293A3439@CY5PR21MB3770.namprd21.prod.outlook.com>
2022-09-13 8:12 ` FW: ebpf-docs: draft of ISA doc updates in progress Dave Thaler
2022-09-14 6:22 ` Shung-Hsi Yu
2022-09-14 9:35 ` Dave Thaler
2022-09-19 17:04 ` Christoph Hellwig
2022-09-20 19:12 ` Dave Thaler
2022-09-20 23:39 ` Alexei Starovoitov
2022-09-21 8:34 ` Rethink how to deal with division/modulo-on-zero (was Re: FW: ebpf-docs: draft of ISA doc updates in progress) Shung-Hsi Yu
2022-09-21 13:50 ` Alexei Starovoitov
2022-09-22 5:00 ` Shung-Hsi Yu
2022-09-23 23:15 ` Alexei Starovoitov
2022-09-21 14:41 ` Dave Thaler
2022-09-22 5:00 ` Shung-Hsi Yu [this message]
2022-09-21 17:53 ` FW: ebpf-docs: draft of ISA doc updates in progress Dave Thaler
2022-09-19 16:58 ` Christoph Hellwig
2022-09-20 19:37 ` Dave Thaler
2022-09-20 23:45 ` Alexei Starovoitov
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=Yyvr7z5kTFY2Gc9w@syu-laptop \
--to=shung-hsi.yu@suse.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=dthaler@microsoft.com \
--cc=hch@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.