All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Krowiak <akrowiak@linux.ibm.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
	David Airlie <airlied@linux.ie>,
	Alex Williamson <alex.williamson@redhat.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Jonathan Corbet <corbet@lwn.net>, Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org,
	Eric Farman <farman@linux.ibm.com>,
	Harald Freudenberger <freude@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	intel-gfx@lists.freedesktop.org,
	intel-gvt-dev@lists.freedesktop.org,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Jason Herne <jjherne@linux.ibm.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	kvm@vger.kernel.org, Kirti Wankhede <kwankhede@nvidia.com>,
	linux-doc@vger.kernel.org, linux-s390@vger.kernel.org,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	Peter Oberparleiter <oberpar@linux.ibm.com>,
	Halil Pasic <pasic@linux.ibm.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	Vineeth Vijayan <vneethv@linux.ibm.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>,
	Zhi Wang <zhi.a.wang@intel.com>, Christoph Hellwig <hch@lst.de>,
	"Tian, Kevin" <kevin.tian@intel.com>,
	"Liu, Yi L" <yi.l.liu@intel.com>
Subject: Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device
Date: Mon, 18 Apr 2022 11:52:37 -0400	[thread overview]
Message-ID: <93b098e6-d04d-ac82-7761-317c16c5d401@linux.ibm.com> (raw)
In-Reply-To: <20220418154400.GR2120790@nvidia.com>



On 4/18/22 11:44 AM, Jason Gunthorpe wrote:
> On Mon, Apr 18, 2022 at 11:28:30AM -0400, Tony Krowiak wrote:
>>> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
>>> index a4555014bd1e72..8a5c46aa2bef61 100644
>>> +++ b/drivers/vfio/vfio.c
>>> @@ -2484,19 +2484,15 @@ static int vfio_unregister_group_notifier(struct vfio_group *group,
>>>    	return ret;
>>>    }
>>> -int vfio_register_notifier(struct device *dev, enum vfio_notify_type type,
>>> +int vfio_register_notifier(struct vfio_device *dev, enum vfio_notify_type type,
>>>    			   unsigned long *events, struct notifier_block *nb)
>>>    {
>>> -	struct vfio_group *group;
>>> +	struct vfio_group *group = dev->group;
>> Is there a guarantee that dev != NULL? The original code below checks
>> the value of dev, so why is that check eliminated here?
> Yes, no kernel driver calls this with null dev. The original code
> should have been a WARN_ON as it is just protecting against a buggy
> driver. In this case if the driver is buggy we simply generate a
> backtrace through a null deref panic.
>
> Jason

Regarding the vfio_ap parts:
Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>



WARNING: multiple messages have this Message-ID (diff)
From: Tony Krowiak <akrowiak@linux.ibm.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org,
	David Airlie <airlied@linux.ie>,
	"Tian, Kevin" <kevin.tian@intel.com>,
	dri-devel@lists.freedesktop.org,
	Kirti Wankhede <kwankhede@nvidia.com>,
	Vineeth Vijayan <vneethv@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christoph Hellwig <hch@lst.de>,
	linux-s390@vger.kernel.org, "Liu, Yi L" <yi.l.liu@intel.com>,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Halil Pasic <pasic@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	intel-gfx@lists.freedesktop.org, Zhi Wang <zhi.a.wang@intel.com>,
	Eric Farman <farman@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Harald Freudenberger <freude@linux.ibm.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	intel-gvt-dev@lists.freedesktop.org,
	Jason Herne <jjherne@linux.ibm.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Peter Oberparleiter <oberpar@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>
Subject: Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device
Date: Mon, 18 Apr 2022 11:52:37 -0400	[thread overview]
Message-ID: <93b098e6-d04d-ac82-7761-317c16c5d401@linux.ibm.com> (raw)
In-Reply-To: <20220418154400.GR2120790@nvidia.com>



On 4/18/22 11:44 AM, Jason Gunthorpe wrote:
> On Mon, Apr 18, 2022 at 11:28:30AM -0400, Tony Krowiak wrote:
>>> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
>>> index a4555014bd1e72..8a5c46aa2bef61 100644
>>> +++ b/drivers/vfio/vfio.c
>>> @@ -2484,19 +2484,15 @@ static int vfio_unregister_group_notifier(struct vfio_group *group,
>>>    	return ret;
>>>    }
>>> -int vfio_register_notifier(struct device *dev, enum vfio_notify_type type,
>>> +int vfio_register_notifier(struct vfio_device *dev, enum vfio_notify_type type,
>>>    			   unsigned long *events, struct notifier_block *nb)
>>>    {
>>> -	struct vfio_group *group;
>>> +	struct vfio_group *group = dev->group;
>> Is there a guarantee that dev != NULL? The original code below checks
>> the value of dev, so why is that check eliminated here?
> Yes, no kernel driver calls this with null dev. The original code
> should have been a WARN_ON as it is just protecting against a buggy
> driver. In this case if the driver is buggy we simply generate a
> backtrace through a null deref panic.
>
> Jason

Regarding the vfio_ap parts:
Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>



WARNING: multiple messages have this Message-ID (diff)
From: Tony Krowiak <akrowiak@linux.ibm.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org,
	Kirti Wankhede <kwankhede@nvidia.com>,
	Vineeth Vijayan <vneethv@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christoph Hellwig <hch@lst.de>,
	linux-s390@vger.kernel.org, "Liu, Yi L" <yi.l.liu@intel.com>,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Halil Pasic <pasic@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	intel-gfx@lists.freedesktop.org,
	Eric Farman <farman@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Harald Freudenberger <freude@linux.ibm.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	intel-gvt-dev@lists.freedesktop.org,
	Jason Herne <jjherne@linux.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Peter Oberparleiter <oberpar@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>
Subject: Re: [Intel-gfx] [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device
Date: Mon, 18 Apr 2022 11:52:37 -0400	[thread overview]
Message-ID: <93b098e6-d04d-ac82-7761-317c16c5d401@linux.ibm.com> (raw)
In-Reply-To: <20220418154400.GR2120790@nvidia.com>



On 4/18/22 11:44 AM, Jason Gunthorpe wrote:
> On Mon, Apr 18, 2022 at 11:28:30AM -0400, Tony Krowiak wrote:
>>> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
>>> index a4555014bd1e72..8a5c46aa2bef61 100644
>>> +++ b/drivers/vfio/vfio.c
>>> @@ -2484,19 +2484,15 @@ static int vfio_unregister_group_notifier(struct vfio_group *group,
>>>    	return ret;
>>>    }
>>> -int vfio_register_notifier(struct device *dev, enum vfio_notify_type type,
>>> +int vfio_register_notifier(struct vfio_device *dev, enum vfio_notify_type type,
>>>    			   unsigned long *events, struct notifier_block *nb)
>>>    {
>>> -	struct vfio_group *group;
>>> +	struct vfio_group *group = dev->group;
>> Is there a guarantee that dev != NULL? The original code below checks
>> the value of dev, so why is that check eliminated here?
> Yes, no kernel driver calls this with null dev. The original code
> should have been a WARN_ON as it is just protecting against a buggy
> driver. In this case if the driver is buggy we simply generate a
> backtrace through a null deref panic.
>
> Jason

Regarding the vfio_ap parts:
Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>



  reply	other threads:[~2022-04-18 15:56 UTC|newest]

Thread overview: 141+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 15:53 [PATCH 0/9] Make the rest of the VFIO driver interface use vfio_device Jason Gunthorpe
2022-04-12 15:53 ` [Intel-gfx] " Jason Gunthorpe
2022-04-12 15:53 ` Jason Gunthorpe
2022-04-12 15:53 ` [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device Jason Gunthorpe
2022-04-12 15:53   ` [Intel-gfx] " Jason Gunthorpe
2022-04-12 15:53   ` Jason Gunthorpe
2022-04-13  5:55   ` Christoph Hellwig
2022-04-13  5:55     ` [Intel-gfx] " Christoph Hellwig
2022-04-13 11:39     ` Jason Gunthorpe
2022-04-13 11:39       ` [Intel-gfx] " Jason Gunthorpe
2022-04-13 11:39       ` Jason Gunthorpe
2022-04-13 16:06       ` Christoph Hellwig
2022-04-13 16:06         ` [Intel-gfx] " Christoph Hellwig
2022-04-13 16:18         ` Jason Gunthorpe
2022-04-13 16:18           ` [Intel-gfx] " Jason Gunthorpe
2022-04-13 16:18           ` Jason Gunthorpe
2022-04-13 16:29           ` Christoph Hellwig
2022-04-13 16:29             ` [Intel-gfx] " Christoph Hellwig
2022-04-13 17:37             ` Jason Gunthorpe
2022-04-13 17:37               ` [Intel-gfx] " Jason Gunthorpe
2022-04-13 17:37               ` Jason Gunthorpe
2022-04-13 19:17               ` Wang, Zhi A
2022-04-13 19:17                 ` [Intel-gfx] " Wang, Zhi A
2022-04-13 19:17                 ` Wang, Zhi A
2022-04-13 20:04                 ` Jason Gunthorpe
2022-04-13 20:04                   ` [Intel-gfx] " Jason Gunthorpe
2022-04-13 20:04                   ` Jason Gunthorpe
2022-04-13 21:08                   ` [Intel-gfx] " Wang, Zhi A
2022-04-13 21:08                     ` Wang, Zhi A
2022-04-13 21:08                     ` Wang, Zhi A
2022-04-13 23:12                     ` Jason Gunthorpe
2022-04-13 23:12                       ` [Intel-gfx] " Jason Gunthorpe
2022-04-13 23:12                       ` Jason Gunthorpe
2022-04-14  2:04                       ` Tian, Kevin
2022-04-14  2:04                         ` [Intel-gfx] " Tian, Kevin
2022-04-14  2:04                         ` Tian, Kevin
2022-04-14  2:15                     ` Tian, Kevin
2022-04-14  2:15                       ` [Intel-gfx] " Tian, Kevin
2022-04-14  2:15                       ` Tian, Kevin
2022-04-14 19:25   ` Eric Farman
2022-04-14 19:25     ` [Intel-gfx] " Eric Farman
2022-04-14 19:25     ` Eric Farman
2022-04-18 15:28   ` Tony Krowiak
2022-04-18 15:28     ` [Intel-gfx] " Tony Krowiak
2022-04-18 15:28     ` Tony Krowiak
2022-04-18 15:44     ` Jason Gunthorpe
2022-04-18 15:44       ` Jason Gunthorpe
2022-04-18 15:44       ` [Intel-gfx] " Jason Gunthorpe
2022-04-18 15:52       ` Tony Krowiak [this message]
2022-04-18 15:52         ` Tony Krowiak
2022-04-18 15:52         ` Tony Krowiak
2022-04-18 15:29   ` Jason J. Herne
2022-04-18 15:29     ` [Intel-gfx] " Jason J. Herne
2022-04-18 15:29     ` Jason J. Herne
2022-04-12 15:53 ` [PATCH 2/9] vfio/ccw: Remove mdev from struct channel_program Jason Gunthorpe
2022-04-12 15:53   ` [Intel-gfx] " Jason Gunthorpe
2022-04-12 15:53   ` Jason Gunthorpe
2022-04-14 19:25   ` Eric Farman
2022-04-14 19:25     ` [Intel-gfx] " Eric Farman
2022-04-14 19:25     ` Eric Farman
2022-04-12 15:53 ` [PATCH 3/9] vfio/mdev: Pass in a struct vfio_device * to vfio_pin/unpin_pages() Jason Gunthorpe
2022-04-12 15:53   ` [Intel-gfx] " Jason Gunthorpe
2022-04-12 15:53   ` Jason Gunthorpe
2022-04-13  5:57   ` Christoph Hellwig
2022-04-13  5:57     ` [Intel-gfx] " Christoph Hellwig
2022-04-13 11:40     ` Jason Gunthorpe
2022-04-13 11:40       ` [Intel-gfx] " Jason Gunthorpe
2022-04-13 11:40       ` Jason Gunthorpe
2022-04-14 19:26   ` Eric Farman
2022-04-14 19:26     ` [Intel-gfx] " Eric Farman
2022-04-14 19:26     ` Eric Farman
2022-04-18 15:25   ` Jason J. Herne
2022-04-18 15:25     ` [Intel-gfx] " Jason J. Herne
2022-04-18 15:25     ` Jason J. Herne
2022-04-19 17:00     ` Jason Gunthorpe
2022-04-19 17:00       ` Jason Gunthorpe
2022-04-19 17:00       ` [Intel-gfx] " Jason Gunthorpe
2022-04-18 15:56   ` Tony Krowiak
2022-04-18 15:56     ` [Intel-gfx] " Tony Krowiak
2022-04-18 15:56     ` Tony Krowiak
2022-04-12 15:53 ` [PATCH 4/9] drm/i915/gvt: Change from vfio_group_(un)pin_pages to vfio_(un)pin_pages Jason Gunthorpe
2022-04-12 15:53   ` [Intel-gfx] " Jason Gunthorpe
2022-04-12 15:53   ` Jason Gunthorpe
2022-04-13  6:01   ` Christoph Hellwig
2022-04-13  6:01     ` [Intel-gfx] " Christoph Hellwig
2022-04-13 13:39     ` Jason Gunthorpe
2022-04-13 13:39       ` [Intel-gfx] " Jason Gunthorpe
2022-04-13 13:39       ` Jason Gunthorpe
2022-04-12 15:53 ` [PATCH 5/9] vfio: Pass in a struct vfio_device * to vfio_dma_rw() Jason Gunthorpe
2022-04-12 15:53   ` [Intel-gfx] " Jason Gunthorpe
2022-04-12 15:53   ` Jason Gunthorpe
2022-04-13  6:00   ` Christoph Hellwig
2022-04-13  6:00     ` [Intel-gfx] " Christoph Hellwig
2022-04-13 13:39     ` Jason Gunthorpe
2022-04-13 13:39       ` [Intel-gfx] " Jason Gunthorpe
2022-04-13 13:39       ` Jason Gunthorpe
2022-04-12 15:53 ` [PATCH 6/9] drm/i915/gvt: Add missing module_put() in error unwind Jason Gunthorpe
2022-04-12 15:53   ` [Intel-gfx] " Jason Gunthorpe
2022-04-12 15:53   ` Jason Gunthorpe
2022-04-13  5:59   ` Christoph Hellwig
2022-04-13  5:59     ` [Intel-gfx] " Christoph Hellwig
2022-04-12 15:53 ` [PATCH 7/9] drm/i915/gvt: Delete kvmgt_vdev::vfio_group Jason Gunthorpe
2022-04-12 15:53   ` [Intel-gfx] " Jason Gunthorpe
2022-04-12 15:53   ` Jason Gunthorpe
2022-04-12 15:53 ` [PATCH 8/9] vfio: Remove dead code Jason Gunthorpe
2022-04-12 15:53   ` [Intel-gfx] " Jason Gunthorpe
2022-04-12 15:53   ` Jason Gunthorpe
2022-04-13  6:01   ` Christoph Hellwig
2022-04-13  6:01     ` [Intel-gfx] " Christoph Hellwig
2022-04-12 15:53 ` [PATCH 9/9] vfio: Remove calls to vfio_group_add_container_user() Jason Gunthorpe
2022-04-12 15:53   ` [Intel-gfx] " Jason Gunthorpe
2022-04-12 15:53   ` Jason Gunthorpe
2022-04-13  6:11   ` Christoph Hellwig
2022-04-13  6:11     ` [Intel-gfx] " Christoph Hellwig
2022-04-13 14:03     ` Jason Gunthorpe
2022-04-13 14:03       ` [Intel-gfx] " Jason Gunthorpe
2022-04-13 14:03       ` Jason Gunthorpe
2022-04-13 16:07       ` Christoph Hellwig
2022-04-13 16:07         ` [Intel-gfx] " Christoph Hellwig
2022-04-14 13:51   ` Matthew Rosato
2022-04-14 13:51     ` [Intel-gfx] " Matthew Rosato
2022-04-14 13:51     ` Matthew Rosato
2022-04-14 14:22     ` Jason Gunthorpe
2022-04-14 14:22       ` Jason Gunthorpe
2022-04-14 14:22       ` [Intel-gfx] " Jason Gunthorpe
2022-04-15  2:32       ` Tian, Kevin
2022-04-15  2:32         ` [Intel-gfx] " Tian, Kevin
2022-04-15  2:32         ` Tian, Kevin
2022-04-15 12:07         ` Jason Gunthorpe
2022-04-15 12:07           ` [Intel-gfx] " Jason Gunthorpe
2022-04-15 12:07           ` Jason Gunthorpe
2022-04-15 23:45           ` Tian, Kevin
2022-04-15 23:45             ` [Intel-gfx] " Tian, Kevin
2022-04-15 23:45             ` Tian, Kevin
2022-04-13  5:52 ` [PATCH 0/9] Make the rest of the VFIO driver interface use vfio_device Christoph Hellwig
2022-04-13  5:52   ` [Intel-gfx] " Christoph Hellwig
2022-04-13 12:31 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2022-04-13 12:31 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-04-13 12:56 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-04-13 15:21 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2022-04-14 15:21 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for Make the rest of the VFIO driver interface use vfio_device (rev2) Patchwork

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=93b098e6-d04d-ac82-7761-317c16c5d401@linux.ibm.com \
    --to=akrowiak@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=airlied@linux.ie \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=corbet@lwn.net \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=farman@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hch@lst.de \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jgg@nvidia.com \
    --cc=jjherne@linux.ibm.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=oberpar@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=svens@linux.ibm.com \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=vneethv@linux.ibm.com \
    --cc=yi.l.liu@intel.com \
    --cc=zhenyuw@linux.intel.com \
    --cc=zhi.a.wang@intel.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 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.