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, 26 Jul 2013 09:38:56 -0400
From:	Tejun Heo <tj@...nel.org>
To:	Dennis Chen <xschen@...oft.com.cn>
Cc:	linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org,
	xiyou.wangcong@...il.com
Subject: Re: [PATCH] race condition fixing in sysfs_create_dir

Hello,

On Fri, Jul 26, 2013 at 05:59:00PM +0800, Dennis Chen wrote:
> On 07/26/2013 05:49 PM, Dennis Chen wrote:
> 
> >The patch is trying its best to avoid creating a dir under a parent dir which is removing from
> >the system:
> >     PATH0 (create a dir under 'PARENT/...')         PATH1 (remove the 'PARENT/...')
> >          sysfs_create_dir() {                         sysfs_remove_dir() {
> >          ...                                          ...
> >          if (kobj->parent)                            spin_lock(&sysfs_assoc_lock);
> >         parent_sd = kobj->parent->sd;  <----- kobj->sd = NULL;
> >      else                                         spin_unlock(&sysfs_assoc_lock);
> >         parent_sd = &sysfs_root;
> >Suppose PATH1 enter the critical section first, then PATH0 begin to execute before kobj->sd
> >has been reset to NULL, possibly PATH0 will get a non-NULL parent_sd since lack of the
> >sysfs_assoc_lock protection in PATH0. In this case, PATH0 think it has a valid parent_sd which
> >can be freed by PATH1 in the followed, refer to the comments in the patch. Maybe we need
> >to figure out a perfect solution to solve the race condition, although the codes in question are
> >in slow path...

I don't think sysfs is supposed to handle multiple actors trying to
populate and destroy the directory at the same time at all, so this
seems kinda moot.  Do you have a case where this actually matters?

Thanks.

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