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:	Fri, 08 Jan 2016 17:44:42 +0100
From:	Daniel Borkmann <daniel@...earbox.net>
To:	Rabin Vincent <rabin@....in>
CC:	David Laight <David.Laight@...LAB.COM>,
	'Alexei Starovoitov' <alexei.starovoitov@...il.com>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"zlim.lnx@...il.com" <zlim.lnx@...il.com>,
	"yang.shi@...aro.org" <yang.shi@...aro.org>,
	"will.deacon@....com" <will.deacon@....com>,
	"catalin.marinas@....com" <catalin.marinas@....com>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] arm64: net: bpf: don't BUG() on large shifts

On 01/08/2016 04:58 PM, Rabin Vincent wrote:
> On Thu, Jan 07, 2016 at 01:48:48PM +0100, Daniel Borkmann wrote:
>> 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.
>
> The case of what happens with such shifts with X is also already
> architecture-specific, even when using the interpreters.  For example, the
> following program returns 1 on ARM64 but 0 on ARM.
>
> 	BPF_STMT(BPF_LD | BPF_IMM, 1),
> 	BPF_STMT(BPF_LDX | BPF_IMM, 32),
> 	BPF_STMT(BPF_ALU | BPF_LSH | BPF_X, 0),
> 	BPF_STMT(BPF_RET | BPF_A, 0)
>
> To start rejecting large K shifts in the verifier because they are
> architecture-specific while continuing to allow the equally
> architecture-specific large X shifts (because we can't verify them
> statically) would be rather inconsistent.

Hmm, yeah, agree with you that this would be inconsistent. Last time we
actually had this topic [1], I believe the consensus was that such BPF
programs are to be considered "undefined".

In that case, I think just masking the K value silently into its allowed
range for classic and eBPF might be better. It would eventually not be
uniform with regards to shifts where X is involved, but if we consider
it "undefined" behaviour, such uniformity is probably not needed.

> If it is desired to enforce uniformity across architectures despite the
> risk for subtly changing the behaviour of existing programs, then the
> desired uniform semantics of these shifts should really be implemented
> both for the K and X shifts, which would mean modifiying the interpreter
> and the various arch JITs too.

   [1] https://lkml.org/lkml/2015/12/4/148

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ