From: Daniel Borkmann <daniel@iogearbox.net>
To: David Laight <David.Laight@ACULAB.COM>,
'Alexei Starovoitov' <alexei.starovoitov@gmail.com>,
Rabin Vincent <rabin@rab.in>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"zlim.lnx@gmail.com" <zlim.lnx@gmail.com>,
"yang.shi@linaro.org" <yang.shi@linaro.org>,
"will.deacon@arm.com" <will.deacon@arm.com>,
"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] arm64: net: bpf: don't BUG() on large shifts
Date: Thu, 07 Jan 2016 13:48:48 +0100 [thread overview]
Message-ID: <568E5EB0.8020102@iogearbox.net> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CCBF08E@AcuExch.aculab.com>
On 01/07/2016 12:07 PM, David Laight wrote:
> From: Alexei Starovoitov
>> Sent: 06 January 2016 22:13
>> On Wed, Jan 06, 2016 at 09:31:27PM +0100, Rabin Vincent wrote:
>>> On Tue, Jan 05, 2016 at 09:55:58AM -0800, Alexei Starovoitov wrote:
>>>> this one is better to be addressed in verifier instead of eBPF JITs.
>>>> Please reject it in check_alu_op() instead.
>>>
>>> AFAICS the eBPF verifier is not called on the eBPF filters generated by
>>> the BPF->eBPF conversion in net/core/filter.c, so performing this check
>>> only in check_alu_op() will be insufficient. So I think we'd need to
>>> add this check to bpf_check_classic() too. Or am I missing something?
>>
>> correct. the check is needed in bpf_check_classic() too and I believe
>> it's ok to tighten it up in this case, since >32 shift is
>> invalid/undefined anyway. We can either accept it as nop or K&=31
>> or error. I think returning error is more user friendly long term, though
>> there is a small risk of rejecting previously loadable broken programs.
>
> Or replace with an assignment of zero?
The question is what is less risky in terms of uabi. To reject such
filters with such K shift vals upfront in verifier, or to just allow
[0, reg_size - 1] values and handle outliers silently. I think both
might be possible, the latter just needs to be clearly specified in
the documentation somewhere. If we go for the latter, then probably
just rewriting that K value as masked one might seem better. Broken
programs might then still be loadable (and still be broken) ... afaik
in case of register (case of shifts with X) with large shift vals
ARM64 is doing 'modulo reg_size' implicitly.
next prev parent reply other threads:[~2016-01-07 12:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 17:39 [PATCH] arm64: net: bpf: don't BUG() on large shifts Rabin Vincent
2016-01-05 17:55 ` Alexei Starovoitov
2016-01-06 20:31 ` Rabin Vincent
2016-01-06 22:12 ` Alexei Starovoitov
2016-01-07 11:07 ` David Laight
2016-01-07 12:48 ` Daniel Borkmann [this message]
2016-01-08 15:58 ` Rabin Vincent
2016-01-08 16:44 ` Daniel Borkmann
2016-01-08 19:18 ` Alexei Starovoitov
2016-01-08 15:44 ` Will Deacon
2016-01-08 19:09 ` Alexei Starovoitov
2016-01-12 17:17 ` Will Deacon
2016-01-12 19:23 ` Alexei Starovoitov
2016-01-13 4:45 ` Z Lim
2016-01-13 12:08 ` Will Deacon
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=568E5EB0.8020102@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=David.Laight@ACULAB.COM \
--cc=alexei.starovoitov@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=rabin@rab.in \
--cc=will.deacon@arm.com \
--cc=yang.shi@linaro.org \
--cc=zlim.lnx@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).