From: Eric Biggers <ebiggers@kernel.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
dm-devel@redhat.com, linux-block@vger.kernel.org,
Mike Snitzer <msnitzer@redhat.com>
Subject: Re: [PATCH] block: fix an integer overflow in logical block size
Date: Tue, 2 Jun 2020 14:39:21 -0700 [thread overview]
Message-ID: <20200602213921.GA229073@gmail.com> (raw)
In-Reply-To: <alpine.LRH.2.02.2001150833180.31494@file01.intranet.prod.int.rdu2.redhat.com>
On Wed, Jan 15, 2020 at 08:35:25AM -0500, Mikulas Patocka wrote:
> Logical block size has type unsigned short. That means that it can be at
> most 32768. However, there are architectures that can run with 64k pages
> (for example arm64) and on these architectures, it may be possible to
> create block devices with 64k block size.
>
> For exmaple (run this on an architecture with 64k pages):
> # modprobe brd rd_size=1048576
> # dmsetup create cache --table "0 `blockdev --getsize /dev/ram0` writecache s /dev/ram0 /dev/ram1 65536 0"
> # mkfs.ext4 -b 65536 /dev/mapper/cache
> # mount -t ext4 /dev/mapper/cache /mnt/test
>
> Mount will fail with this error because it tries to read the superblock using 2-sector
> access:
> device-mapper: writecache: I/O is not aligned, sector 2, size 1024, block size 65536
> EXT4-fs (dm-0): unable to read superblock
>
> This patch changes the logical block size from unsigned short to unsigned
> int to avoid the overflow.
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Mikulas, a question about this patch. In crypt_io_hints() in
drivers/md/dm-crypt.c there is:
limits->logical_block_size =
max_t(unsigned short, limits->logical_block_size, cc->sector_size);
Shouldn't that have been changed to 'unsigned int', now that
limits->logical_block_size is 'unsigned int' rather than 'unsigned short'?
- Eric
prev parent reply other threads:[~2020-06-02 21:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-15 13:35 [PATCH] block: fix an integer overflow in logical block size Mikulas Patocka
2020-01-16 1:59 ` Martin K. Petersen
2020-01-16 3:02 ` Ming Lei
2020-01-16 4:43 ` Jens Axboe
2020-06-02 21:39 ` Eric Biggers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200602213921.GA229073@gmail.com \
--to=ebiggers@kernel.org \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=msnitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).