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-next>] [day] [month] [year] [list]
Message-ID: <20150520003859.GA55280@jaegeuk-mac02.mot.com>
Date:	Tue, 19 May 2015 17:38:59 -0700
From:	Jaegeuk Kim <jaegeuk@...nel.org>
To:	nick <xerofoify@...il.com>
Cc:	Theodore Ts'o <tytso@....edu>, linux-kernel@...r.kernel.org,
	linux-fsdevel@...r.kernel.org,
	linux-f2fs-devel@...ts.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs crypto: add rwsem to avoid data races

On Tue, May 19, 2015 at 10:35:30AM -0400, nick wrote:
> 
> 
> On 2015-05-19 10:29 AM, Theodore Ts'o wrote:
> > On Mon, May 18, 2015 at 10:36:41PM -0700, Jaegeuk Kim wrote:
> >> Previoulsy, fi->i_crypt_info was not covered by any lock, resulting in
> >> memory leak.
> >>
> >> This patch adds a rwsem to avoid leaking objects on i_crypt_info.
> >>
> >> Signed-off-by: Jaegeuk Kim <jaegeuk@...nel.org>
> > 
> > I'm not sure we need an rwsem to fix this issue.  In terms of
> > serializing the creation and deletion of the structure, it should be
> > possible to use an cmpxchg() on the pointer itself.  (e.g., if we lose
> > the race on the creation side, we just release our structure and use
> > the one that the winner allocated).
> > 
> > If we do end up needing to serialize access to the tfm in the
> > i_crypt_info object for datapath reads/writes, then we might need a
> > mutex, but I think that should be it, no?
> > 
> > 	       	     	   	       - Ted
> > 
> I have to agree with Ted here, as mutual exclusion locking is ideal
> for the scenario here of a reader vs writer exclusion. My only concern

What I'm saying is writer vs writer actually.

> is that can there be many readers to one writer here as if so reader/writer
> spin locks may be better.

I could write another patch using a rwlock by removing needless down_write for
f2fs_free_encryption_info.

Thanks,

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