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] [day] [month] [year] [list]
Message-ID: <4E687754.1040005@redhat.com>
Date:	Thu, 08 Sep 2011 10:05:40 +0200
From:	Jerome Marchand <jmarchan@...hat.com>
To:	Nitin Gupta <ngupta@...are.org>
CC:	Greg Kroah-Hartman <gregkh@...e.de>,
	Linux Kernel List <linux-kernel@...r.kernel.org>,
	Jeff Moyer <jmoyer@...hat.com>
Subject: Re: [PATCH 1/2] staging: zram: fix zram locking

On 09/08/2011 03:35 AM, Nitin Gupta wrote:
> On 09/06/2011 09:02 AM, Jerome Marchand wrote:
>> Currently init_lock only prevents concurrent execution of zram_init_device()
>> and zram_reset_device() but not zram_make_request() nor sysfs store functions.
>>
> 
> zram_make_request() initializes the device first time it is used and 
> from then on no sysfs config writes are allowed till the device is reset 
> -- for example, you cannot change disksize while a disk is in 
> initialized state. So, I could not understand why we need to protect 
> zram_make_request vs sysfs stores.

This is true for disksize_store() (which can race with zram_init_device(), thus
the write lock in it), not for reset_store(), which obviously can happen in
initialized state. I have actually hit those races with the following
reproducer:

---
#! /bin/sh

while true; do
    for i in `seq 0 9`; do
	echo 1 > /sys/block/zram0/reset&
	echo $((1024*1024*500)) > /sys/block/zram0/disksize&
	for i in `seq 1 10`; do
	    dd if=/dev/zero of=/dev/zram0 bs=4k count=1 2>/dev/null;
	done
    done;
    wait;
done


> 
> Thanks,
> Nitin
> 
> 
> 

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