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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 11 Jan 2008 13:49:49 +0100
From:	Andi Kleen <andi@...stfloor.org>
To:	Nikanth Karthikesan <knikanth@...e.de>
Cc:	Andi Kleen <andi@...stfloor.org>, linux-kernel@...r.kernel.org,
	mpm@...enic.com
Subject: Re: Query on lock protection in random number driver

On Fri, Jan 11, 2008 at 04:58:28PM +0530, Nikanth Karthikesan wrote:
> On Fri, 2008-01-11 at 12:12 +0100, Andi Kleen wrote:
> > Nikanth Karthikesan <knikanth@...e.de> writes:
> > >
> > > Also the globals random_read_wakeup_thresh and
> > > random_write_wakeup_thresh are not at all protected by any locks! Why
> > > locks are not needed for these?
> > 
> > Reading variables sizeof <= native word size (32bit or 64bit depending
> > on architecture) is atomic by itself. This is not necessarily
> > guaranteed in ISO-C or POSIX threads, but Linux can assume that.
> 
> Yes, I found that by checking the implementation of atomic_read.
> 
> But I didnt check the implementation of atomic_set before sending the
> mail and assumed assigning to a variable may not be atomic on all arch,
> and because of that, we may be reading a half-written, variable! But
> assigning to an int is also atomic on all arch.

For completeness this both only applies to naturally aligned variables
for portable code.

-Andi
--
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