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:	Mon, 20 Jul 2015 16:44:05 +0200
From:	Sowmini Varadhan <sowmini.varadhan@...cle.com>
To:	Guenter Roeck <linux@...ck-us.net>
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	benh@...nel.crashing.org, davem@...emloft.net,
	jose.marchesi@...cle.com, sowmini.varadhan@...cle.com,
	dave.kleikamp@...cle.com
Subject: Re: [PATCH] iommu-common: Do not use 64 bit  constant
 0xffffffffffffffffl for computing align_mask

On (07/19/15 08:27), Guenter Roeck wrote:
> > -		align_mask = 0xffffffffffffffffl >> (64 - align_order);
> > +		align_mask = ~0l >> (64 - align_order);
> >  
> Wonder if this just hides the real problem. Unless align_order
> is very large, the resulting mask on 32 bit systems may be 0.
> Is this really the idea ?

<subsequent example code deleted> 

> So either case ~0l appears to be wrong; it should be ~0ul.
> I don't know if ~0ull makes a difference for some architectures. 

I agree about the unsigned part. However, regarding the arch specific
twists..

I checked into this.. even though I have a test program on 
x86_64 that "does the right thing" for both of 

  align_mask = ~0ul >> (64 - align_order);
  align_mask = ~0ul >> (BITS_PER_LONG - align_order);

when I compiled with -m32 and without (I tried align_order == 1 and 31
for edge cases), I think there are some gcc/arch specific variations
possible based on undefined behavior, so that the second variant 
is safer.

I'll send out a patch with that version soon.

--Sowmini

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ