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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150430054702.GA21771@blaptop>
Date:	Thu, 30 Apr 2015 14:47:02 +0900
From:	Minchan Kim <minchan@...nel.org>
To:	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Nitin Gupta <ngupta@...are.org>, linux-kernel@...r.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [PATCHv3 9/9] zram: add dynamic device add/remove functionality

Hello Sergey,

On Wed, Apr 29, 2015 at 04:23:28PM +0900, Sergey Senozhatsky wrote:
> On (04/29/15 16:02), Sergey Senozhatsky wrote:
> > sure. I was talking about this one:
> > 
> > 	CPU0			CPU1
> > 	umount
> > 	zram_remove()
> > 	lock ->bd_mutex
> > 	zram_reset_device()
> > 	unlock ->bd_mutex
> > 				disksize_store
> > 				mount
> > 				echo 'test' > /mnt/test
> > 	kfree zram
> > 				zram write
> > 
> 
> I'll take a look later today. currently I think of something like:
> 
> 
> 	sysfs_remove_group()
> 	lock ->bd_mutex
> 		... check ->bd_openers
> 
> 	zram_reset_device()
> 	blk_cleanup_queue()
> 	del_gendisk()
> 	put_disk()
> 
> 	unlock ->bd_mutex
> 	bdput bdev
> 
> 	idr_remove()
> 	kfree(zram)
> 
> 
> iow, idr_remove() and kfree() are done outside of ->bd_mutex lock.
> but I may be wrong. haven't tested yet. but seems reasonable: we
> invalidate ->bdev, delete partitions, etc., holding ->bd_mutex and
> then release ->bdev, which does final put. need to check that in
> detail.
> 
> 	-ss


Isn't it related to bd_mutex?
I think the problem of deadlock is that you are trying to remove sysfs file
in sysfs handler.

#> echo 1 > /sys/xxx/zram_remove

kernfs_fop_write - hold s_active
  -> zram_remove_store
    -> zram_remove
      -> sysfs_remove_group - hold s_active *again*

Right?

-- 
Kind regards,
Minchan Kim
--
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