From: Stefan Hajnoczi <stefanha@redhat.com> To: Yury Kamenev <damtev@yandex-team.ru> Cc: mst@redhat.com, jasowang@redhat.com, pbonzini@redhat.com, axboe@kernel.dk, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de> Subject: Re: [PATCH 1/1] virtio: disable partitions scanning for no partitions block Date: Mon, 24 May 2021 15:29:22 +0100 [thread overview] Message-ID: <YKu4Qovv1KMplifY@stefanha-x1.localdomain> (raw) In-Reply-To: <20210520133908.98891-2-damtev@yandex-team.ru> [-- Attachment #1: Type: text/plain, Size: 3246 bytes --] On Thu, May 20, 2021 at 04:39:08PM +0300, Yury Kamenev wrote: Hi, Is there a VIRTIO spec change for the new VIRTIO_BLK_F_NO_PS feature bit? Please send one: https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=virtio#feedback GENHD_FL_NO_PART_SCAN is not used much in other drivers. This makes me wonder if the same use case is addressed through other means with SCSI, NVMe, etc devices. Maybe Christoph or Jens can weigh in on whether adding a bit to disable partition scanning for a virtio-blk fits into the big picture? Is your goal to avoid accidentally detecting partitions because it's confusing when that happens? VIRTIO is currently undergoing auditing and changes to support untrusted devices. From that perspective adding a device feature bit to disable partition scanning does not help protect the guest from an untrusted disk. The guest cannot trust the device, instead the guest itself would need to be configured to avoid partition scanning of untrusted devices. Stefan > Signed-off-by: Yury Kamenev <damtev@yandex-team.ru> > --- > drivers/block/virtio_blk.c | 6 ++++++ > include/uapi/linux/virtio_blk.h | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c > index b9fa3ef5b57c..17edcfee2208 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -799,6 +799,10 @@ static int virtblk_probe(struct virtio_device *vdev) > vblk->disk->flags |= GENHD_FL_EXT_DEVT; > vblk->index = index; > > + /*Disable partitions scanning for no-partitions block*/ Formatting cleanup and rephrasing: /* Disable partition scanning for devices with no partitions */ > + if (virtio_has_feature(vdev, VIRTIO_BLK_F_NO_PS)) I suggest user a more obvious name: VIRTIO_BLK_F_NO_PART_SCAN > + vblk->disk->flags |= GENHD_FL_NO_PART_SCAN; > + > /* configure queue flush support */ > virtblk_update_cache_mode(vdev); > > @@ -977,6 +981,7 @@ static unsigned int features_legacy[] = { > VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, > VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE, > VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES, > + VIRTIO_BLK_F_NO_PS, > } > ; > static unsigned int features[] = { > @@ -984,6 +989,7 @@ static unsigned int features[] = { > VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, > VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE, > VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES, > + VIRTIO_BLK_F_NO_PS, > }; > > static struct virtio_driver virtio_blk = { > diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h > index d888f013d9ff..f197d07afb05 100644 > --- a/include/uapi/linux/virtio_blk.h > +++ b/include/uapi/linux/virtio_blk.h > @@ -40,6 +40,7 @@ > #define VIRTIO_BLK_F_MQ 12 /* support more than one vq */ > #define VIRTIO_BLK_F_DISCARD 13 /* DISCARD is supported */ > #define VIRTIO_BLK_F_WRITE_ZEROES 14 /* WRITE ZEROES is supported */ > +#define VIRTIO_BLK_F_NO_PS 16 /* No partitions */ > > /* Legacy feature bits */ > #ifndef VIRTIO_BLK_NO_LEGACY > -- > 2.24.3 (Apple Git-128) > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Stefan Hajnoczi <stefanha@redhat.com> To: Yury Kamenev <damtev@yandex-team.ru> Cc: axboe@kernel.dk, mst@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, pbonzini@redhat.com, Christoph Hellwig <hch@lst.de> Subject: Re: [PATCH 1/1] virtio: disable partitions scanning for no partitions block Date: Mon, 24 May 2021 15:29:22 +0100 [thread overview] Message-ID: <YKu4Qovv1KMplifY@stefanha-x1.localdomain> (raw) In-Reply-To: <20210520133908.98891-2-damtev@yandex-team.ru> [-- Attachment #1.1: Type: text/plain, Size: 3246 bytes --] On Thu, May 20, 2021 at 04:39:08PM +0300, Yury Kamenev wrote: Hi, Is there a VIRTIO spec change for the new VIRTIO_BLK_F_NO_PS feature bit? Please send one: https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=virtio#feedback GENHD_FL_NO_PART_SCAN is not used much in other drivers. This makes me wonder if the same use case is addressed through other means with SCSI, NVMe, etc devices. Maybe Christoph or Jens can weigh in on whether adding a bit to disable partition scanning for a virtio-blk fits into the big picture? Is your goal to avoid accidentally detecting partitions because it's confusing when that happens? VIRTIO is currently undergoing auditing and changes to support untrusted devices. From that perspective adding a device feature bit to disable partition scanning does not help protect the guest from an untrusted disk. The guest cannot trust the device, instead the guest itself would need to be configured to avoid partition scanning of untrusted devices. Stefan > Signed-off-by: Yury Kamenev <damtev@yandex-team.ru> > --- > drivers/block/virtio_blk.c | 6 ++++++ > include/uapi/linux/virtio_blk.h | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c > index b9fa3ef5b57c..17edcfee2208 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -799,6 +799,10 @@ static int virtblk_probe(struct virtio_device *vdev) > vblk->disk->flags |= GENHD_FL_EXT_DEVT; > vblk->index = index; > > + /*Disable partitions scanning for no-partitions block*/ Formatting cleanup and rephrasing: /* Disable partition scanning for devices with no partitions */ > + if (virtio_has_feature(vdev, VIRTIO_BLK_F_NO_PS)) I suggest user a more obvious name: VIRTIO_BLK_F_NO_PART_SCAN > + vblk->disk->flags |= GENHD_FL_NO_PART_SCAN; > + > /* configure queue flush support */ > virtblk_update_cache_mode(vdev); > > @@ -977,6 +981,7 @@ static unsigned int features_legacy[] = { > VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, > VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE, > VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES, > + VIRTIO_BLK_F_NO_PS, > } > ; > static unsigned int features[] = { > @@ -984,6 +989,7 @@ static unsigned int features[] = { > VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, > VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE, > VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES, > + VIRTIO_BLK_F_NO_PS, > }; > > static struct virtio_driver virtio_blk = { > diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h > index d888f013d9ff..f197d07afb05 100644 > --- a/include/uapi/linux/virtio_blk.h > +++ b/include/uapi/linux/virtio_blk.h > @@ -40,6 +40,7 @@ > #define VIRTIO_BLK_F_MQ 12 /* support more than one vq */ > #define VIRTIO_BLK_F_DISCARD 13 /* DISCARD is supported */ > #define VIRTIO_BLK_F_WRITE_ZEROES 14 /* WRITE ZEROES is supported */ > +#define VIRTIO_BLK_F_NO_PS 16 /* No partitions */ > > /* Legacy feature bits */ > #ifndef VIRTIO_BLK_NO_LEGACY > -- > 2.24.3 (Apple Git-128) > [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] [-- Attachment #2: Type: text/plain, Size: 183 bytes --] _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2021-05-24 14:29 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-20 13:39 [PATCH 0/1] virtio: disable partitions scanning for no partitions block Yury Kamenev 2021-05-20 13:39 ` [PATCH 1/1] " Yury Kamenev 2021-05-24 14:29 ` Stefan Hajnoczi [this message] 2021-05-24 14:29 ` Stefan Hajnoczi 2021-05-24 14:56 ` Christoph Hellwig 2021-05-24 14:56 ` Christoph Hellwig 2021-05-24 16:25 ` Ulf Hansson 2021-05-24 16:25 ` Ulf Hansson [not found] ` <90021621883891@mail.yandex-team.ru> 2021-05-24 19:41 ` Paolo Bonzini 2021-05-24 19:41 ` Paolo Bonzini 2021-05-25 12:00 ` Iurii Kamenev -- strict thread matches above, loose matches on Subject: below -- 2021-07-15 9:47 [PATCH 0/1] " Yury Kamenev 2021-07-15 9:47 ` [PATCH 1/1] " Yury Kamenev 2021-07-15 11:22 ` Paolo Bonzini 2021-07-15 11:22 ` Paolo Bonzini 2021-07-16 1:09 ` kernel test robot 2021-07-16 1:09 ` kernel test robot 2021-07-16 1:09 ` kernel test robot 2021-07-16 2:57 ` Jason Wang 2021-07-16 2:57 ` Jason Wang 2021-05-20 13:36 [PATCH 0/1] " Yury Kamenev 2021-05-20 13:36 ` [PATCH 1/1] " Yury Kamenev
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=YKu4Qovv1KMplifY@stefanha-x1.localdomain \ --to=stefanha@redhat.com \ --cc=axboe@kernel.dk \ --cc=damtev@yandex-team.ru \ --cc=hch@lst.de \ --cc=jasowang@redhat.com \ --cc=linux-block@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mst@redhat.com \ --cc=pbonzini@redhat.com \ --cc=virtualization@lists.linux-foundation.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.