Re: [dm-devel] [PATCH v3 12/19] block, nvme, scsi, dm: Add blk_status to pr_ops callouts

2022-11-01 Thread Christoph Hellwig
On Sun, Oct 30, 2022 at 06:05:35PM -0500, Mike Christie wrote: > The problem I hit is that in the ioctl code I then have to do: > > @@ -269,7 +270,14 @@ static int blkdev_pr_register(struct block_device *bdev, > > if (reg.flags & ~PR_FL_IGNORE_KEY) > return -EOPNOTSUPP; > -

Re: [dm-devel] [PATCH 7/7] block: store the holder kobject in bd_holder_disk

2022-11-01 Thread Christoph Hellwig
On Mon, Oct 31, 2022 at 09:52:04AM +0800, Yu Kuai wrote: >> INIT_LIST_HEAD(&holder->list); >> -holder->bdev = bdev; >> holder->refcnt = 1; >> +holder->holder_dir = kobject_get(bdev->bd_holder_dir); > > I wonder is this safe here, if kobject reference is 0 here and > bd_holder_dir

Re: [dm-devel] [PATCH 7/7] block: store the holder kobject in bd_holder_disk

2022-11-01 Thread Christoph Hellwig
On Tue, Nov 01, 2022 at 07:12:51PM +0800, Yu Kuai wrote: >> But how could the reference be 0 here? The driver that calls >> bd_link_disk_holder must have the block device open and thus hold a >> reference to it. > > Like I said before, the caller of bd_link_disk_holder() get bdev by > blkdev_get_b

Re: [dm-devel] [PATCH 7/7] block: store the holder kobject in bd_holder_disk

2022-11-01 Thread Christoph Hellwig
On Tue, Nov 01, 2022 at 07:28:17PM +0800, Yu Kuai wrote: > What if bd_holder_dir is already freed here, then uaf can be triggered. > Thus bd_holder_dir need to be resed in del_gendisk() if it's reference > is dropped to 0, however, kobject apis can't do that... Indeed. I don't think we can simply

[dm-devel] [PATCH 1/4] dm-ioctl: fix misbehavior if list_versions races with module loading

2022-11-01 Thread Mikulas Patocka
__list_versions will first estimate the required space using the "dm_target_iterate(list_version_get_needed, &needed)" call and then will fill the space using the "dm_target_iterate(list_version_get_info, &iter_info)" call. Each of these calls locks the targets using the "down_read(&_lock)" and "up

[dm-devel] [PATCH 2/4] dm-ioctl: a small code cleanup

2022-11-01 Thread Mikulas Patocka
This is a small code cleanup in list_version_get_info. We don't need to modify info->vers if we overwrite it immediatelly. Signed-off-by: Mikulas Patocka --- drivers/md/dm-ioctl.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6/drivers/md/dm-ioctl.c ==

[dm-devel] [PATCH 3/4] dm-ioctl: fix the ioctl codes

2022-11-01 Thread Mikulas Patocka
Change the ioctl codes from DM_DEV_ARM_POLL to DM_DEV_ARM_POLL_CMD and from DM_GET_TARGET_VERSION to DM_GET_TARGET_VERSION_CMD. Note that the "cmd" field of "struct _ioctls" is never used, thus this patch doesn't fix any bug, it just makes the code consistent. Signed-off-by: Mikulas Patocka ---

[dm-devel] [PATCH 4/4] dm: support global feature string and per-target feature strings

2022-11-01 Thread Mikulas Patocka
This patch enables support for feature strings that may be returned from the kernel to userspace and may be used instead of version numbers to determine if the kernel supports a particular feature. So far, all the strings are empty. When new features will be introduced, they will be added to the d

Re: [PATCH] xfs: fail dax mount if reflink is enabled on a partition

2022-11-01 Thread Darrick J. Wong
On Sun, Oct 30, 2022 at 05:31:43PM +0800, Shiyang Ruan wrote: > > > 在 2022/10/28 9:37, Dan Williams 写道: > > Darrick J. Wong wrote: > > > [add tytso to cc since he asked about "How do you actually /get/ fsdax > > > mode these days?" this morning] > > > > > > On Tue, Oct 25, 2022 at 10:56:19AM -07

[dm-devel] Regression: wrong DIO alignment check with dm-crypt

2022-11-01 Thread Eric Biggers
Hi, I happened to notice the following QEMU bug report: https://gitlab.com/qemu-project/qemu/-/issues/1290 I believe it's a regression from the following kernel commit: commit b1a000d3b8ec582da64bb644be633e5a0beffcbf Author: Keith Busch Date: Fri Jun 10 12:58:29 2022 -0700

Re: [dm-devel] [PATCH] xfs: fail dax mount if reflink is enabled on a partition

2022-11-01 Thread ruansy.f...@fujitsu.com
在 2022/11/2 8:45, Darrick J. Wong 写道: > On Sun, Oct 30, 2022 at 05:31:43PM +0800, Shiyang Ruan wrote: >> >> >> 在 2022/10/28 9:37, Dan Williams 写道: >>> Darrick J. Wong wrote: [add tytso to cc since he asked about "How do you actually /get/ fsdax mode these days?" this morning] O

[dm-devel] [PATCH 8/7] block: don't claim devices that are not live in bd_link_disk_holder

2022-11-01 Thread Christoph Hellwig
For gendisk that are not live or their partitions, the bd_holder_dir pointer is not valid and the kobject might not have been allocated yet or freed already. Check that the disk is live before creating the linkage and error out otherwise. Signed-off-by: Christoph Hellwig --- block/holder.c | 5