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]
Message-ID: <x497h6aspj1.fsf@segfault.boston.devel.redhat.com>
Date:	Thu, 18 Aug 2011 11:33:22 -0400
From:	Jeff Moyer <jmoyer@...hat.com>
To:	Lukas Czerner <lczerner@...hat.com>
Cc:	linux-kernel@...r.kernel.org, achender@...ux.vnet.ibm.com,
	Jens Axboe <jaxboe@...ionio.com>, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] loop: add discard support for loop devices

Lukas Czerner <lczerner@...hat.com> writes:

>> @@ -484,6 +485,29 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio)
>>  			}
>>  		}
>>  
>> +		/*
>> +		 * We use punch hole to reclaim the free space used by the
>> +		 * image a.k.a. discard. However we do support discard if
>> +		 * encryption is enabled, because it may give an attacker
>> +		 * useful information.
>> +		 */
>> +		if (bio->bi_rw & REQ_DISCARD) {
>> +			struct file *file = lo->lo_backing_file;
>> +			int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
>> +
>> +			if ((!file->f_op->fallocate) ||
>> +			    lo->lo_encrypt_key_size) {
>> +				ret = -EOPNOTSUPP;
>> +				goto out;
>> +			}
>> +			ret = file->f_op->fallocate(file, mode, pos,
>> +						    bio->bi_size);
>> +			if (unlikely(ret && ret != -EINVAL &&
>> +				     ret != -EOPNOTSUPP))
>> +				ret = -EIO;
>> +			goto out;
>> +		}
>> +

Seems you missed the bizarre case of configuring a loop device over top
of a block device.

Cheers,
Jeff
--
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