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
| ||
|
Message-Id: <20170516.155211.2029345941344452552.davem@davemloft.net> Date: Tue, 16 May 2017 15:52:11 -0400 (EDT) From: David Miller <davem@...emloft.net> To: ecree@...arflare.com Cc: daniel@...earbox.net, ast@...com, alexei.starovoitov@...il.com, netdev@...r.kernel.org Subject: Re: [PATCH v2 1/3] bpf: Use 1<<16 as ceiling for immediate alignment in verifier. From: Edward Cree <ecree@...arflare.com> Date: Tue, 16 May 2017 13:37:42 +0100 > On 15/05/17 17:04, David Miller wrote: >> If we use 1<<31, then sequences like: >> >> R1 = 0 >> R1 <<= 2 >> >> do silly things. > Hmm. It might be a bit late for this, but I wonder if, instead of handling > alignments as (1 << align), you could store them as -(1 << align), i.e. > leading 1s followed by 'align' 0s. > Now the alignment of 0 is 0 (really 1 << 32), which doesn't change when > left-shifted some more. Shifts of other numbers' alignments also do the > right thing, e.g. align(6) << 2 = (-2) << 2 = -8 = align(6 << 2). Of > course you do all this in unsigned, to make sure right shifts work. > This also makes other arithmetic simple to track; for instance, align(a + b) > is at worst align(a) | align(b). (Of course, this bound isn't tight.) > A number is 2^(n+1)-aligned if the 2^n bit of its alignment is cleared. > Considered as unsigned numbers, smaller values are stricter alignments. Thanks for the bit twiddling suggestion, I'll take a look!
Powered by blists - more mailing lists