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:   Sat, 7 May 2022 00:41:55 +0900
From:   Damien Le Moal <damien.lemoal@...nsource.wdc.com>
To:     Pankaj Raghav <p.raghav@...sung.com>, jaegeuk@...nel.org,
        hare@...e.de, dsterba@...e.com, axboe@...nel.dk, hch@....de,
        snitzer@...nel.org
Cc:     Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
        bvanassche@....org, linux-fsdevel@...r.kernel.org,
        matias.bjorling@....com, Jens Axboe <axboe@...com>,
        gost.dev@...sung.com, jonathan.derrick@...ux.dev,
        jiangbo.365@...edance.com, linux-nvme@...ts.infradead.org,
        dm-devel@...hat.com, Naohiro Aota <naohiro.aota@....com>,
        linux-kernel@...r.kernel.org, Johannes Thumshirn <jth@...nel.org>,
        Sagi Grimberg <sagi@...mberg.me>,
        Alasdair Kergon <agk@...hat.com>, linux-block@...r.kernel.org,
        Chaitanya Kulkarni <kch@...dia.com>,
        Keith Busch <kbusch@...nel.org>, linux-btrfs@...r.kernel.org,
        Luis Chamberlain <mcgrof@...nel.org>
Subject: Re: [PATCH v3 11/11] dm-zoned: ensure only power of 2 zone sizes are
 allowed

On 2022/05/06 17:11, Pankaj Raghav wrote:
> From: Luis Chamberlain <mcgrof@...nel.org>
> 
> Today dm-zoned relies on the assumption that you have a zone size
> with a power of 2. Even though the block layer today enforces this
> requirement, these devices do exist and so provide a stop-gap measure
> to ensure these devices cannot be used by mistake
> 
> Reviewed-by: Hannes Reinecke <hare@...e.de>
> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
> Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
> ---
>  drivers/md/dm-zone.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c
> index 3e7b1fe15..27dc4ddf2 100644
> --- a/drivers/md/dm-zone.c
> +++ b/drivers/md/dm-zone.c
> @@ -231,6 +231,18 @@ static int dm_revalidate_zones(struct mapped_device *md, struct dm_table *t)
>  	struct request_queue *q = md->queue;
>  	unsigned int noio_flag;
>  	int ret;
> +	struct block_device *bdev = md->disk->part0;
> +	sector_t zone_sectors;
> +	char bname[BDEVNAME_SIZE];
> +
> +	zone_sectors = bdev_zone_sectors(bdev);
> +
> +	if (!is_power_of_2(zone_sectors)) {
> +		DMWARN("%s: %s only power of two zone size supported\n",
> +		       dm_device_name(md),
> +		       bdevname(bdev, bname));
> +		return 1;

return -EINVAL;

The error propagates to dm_table_set_restrictions() so a proper error code must
be returned.


> +	}
>  
>  	/*
>  	 * Check if something changed. If yes, cleanup the current resources


-- 
Damien Le Moal
Western Digital Research

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ