* Re: [PATCH] PCI/IOV: Make SR-IOV attributes with mode 0664 use 0644
2019-09-05 6:32 [PATCH] PCI/IOV: Make SR-IOV attributes with mode 0664 use 0644 Kelsey Skunberg
@ 2019-09-05 7:34 ` Greg KH
2019-09-05 19:16 ` Kelsey Skunberg
2019-09-05 16:24 ` Don Dutile
2019-09-05 18:29 ` [Linux-kernel-mentees] " Bjorn Helgaas
2 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2019-09-05 7:34 UTC (permalink / raw)
To: Kelsey Skunberg
Cc: bhelgaas, linux-pci, linux-kernel, bodong, linux-kernel-mentees,
skhan, ddutile, berrange, sathyanarayanan.kuppuswamy
On Thu, Sep 05, 2019 at 12:32:26AM -0600, Kelsey Skunberg wrote:
> sriov_numvfs and sriov_drivers_autoprobe have "unusual" permissions (0664)
> with no reported or found reason for allowing group write permissions.
> libvirt runs as root when dealing with PCI, and chowns files for qemu
> needs. There is not a need for the "0664" permissions.
>
> sriov_numvfs was introduced in:
> commit 1789382a72a5 ("PCI: SRIOV control and status via sysfs")
>
> sriov_drivers_autoprobe was introduced in:
> commit 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to
> control VF driver binding")
>
> Change sriov_numvfs and sriov_drivers_autoprobe from "0664" permissions to
> "0644" permissions.
>
> Exchange DEVICE_ATTR() with DEVICE_ATTR_RW() which sets the mode to "0644".
> DEVICE_ATTR() should only be used for "unusual" permissions.
>
> Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
> ---
> drivers/pci/iov.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index b335db21c85e..b3f972e8cfed 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -375,12 +375,11 @@ static ssize_t sriov_drivers_autoprobe_store(struct device *dev,
> }
>
> static DEVICE_ATTR_RO(sriov_totalvfs);
> -static DEVICE_ATTR(sriov_numvfs, 0664, sriov_numvfs_show, sriov_numvfs_store);
> +static DEVICE_ATTR_RW(sriov_numvfs);
> static DEVICE_ATTR_RO(sriov_offset);
> static DEVICE_ATTR_RO(sriov_stride);
> static DEVICE_ATTR_RO(sriov_vf_device);
> -static DEVICE_ATTR(sriov_drivers_autoprobe, 0664, sriov_drivers_autoprobe_show,
> - sriov_drivers_autoprobe_store);
> +static DEVICE_ATTR_RW(sriov_drivers_autoprobe);
>
> static struct attribute *sriov_dev_attrs[] = {
> &dev_attr_sriov_totalvfs.attr,
Nice!!!
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI/IOV: Make SR-IOV attributes with mode 0664 use 0644
2019-09-05 7:34 ` Greg KH
@ 2019-09-05 19:16 ` Kelsey Skunberg
0 siblings, 0 replies; 7+ messages in thread
From: Kelsey Skunberg @ 2019-09-05 19:16 UTC (permalink / raw)
To: Greg KH
Cc: bhelgaas, linux-pci, linux-kernel, bodong, linux-kernel-mentees,
skhan, ddutile, berrange, sathyanarayanan.kuppuswamy
On Thu, Sep 05, 2019 at 09:34:16AM +0200, Greg KH wrote:
> On Thu, Sep 05, 2019 at 12:32:26AM -0600, Kelsey Skunberg wrote:
> > sriov_numvfs and sriov_drivers_autoprobe have "unusual" permissions (0664)
> > with no reported or found reason for allowing group write permissions.
> > libvirt runs as root when dealing with PCI, and chowns files for qemu
> > needs. There is not a need for the "0664" permissions.
> >
> > sriov_numvfs was introduced in:
> > commit 1789382a72a5 ("PCI: SRIOV control and status via sysfs")
> >
> > sriov_drivers_autoprobe was introduced in:
> > commit 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to
> > control VF driver binding")
> >
> > Change sriov_numvfs and sriov_drivers_autoprobe from "0664" permissions to
> > "0644" permissions.
> >
> > Exchange DEVICE_ATTR() with DEVICE_ATTR_RW() which sets the mode to "0644".
> > DEVICE_ATTR() should only be used for "unusual" permissions.
> >
> > Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
> > ---
> > drivers/pci/iov.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> > index b335db21c85e..b3f972e8cfed 100644
> > --- a/drivers/pci/iov.c
> > +++ b/drivers/pci/iov.c
> > @@ -375,12 +375,11 @@ static ssize_t sriov_drivers_autoprobe_store(struct device *dev,
> > }
> >
> > static DEVICE_ATTR_RO(sriov_totalvfs);
> > -static DEVICE_ATTR(sriov_numvfs, 0664, sriov_numvfs_show, sriov_numvfs_store);
> > +static DEVICE_ATTR_RW(sriov_numvfs);
> > static DEVICE_ATTR_RO(sriov_offset);
> > static DEVICE_ATTR_RO(sriov_stride);
> > static DEVICE_ATTR_RO(sriov_vf_device);
> > -static DEVICE_ATTR(sriov_drivers_autoprobe, 0664, sriov_drivers_autoprobe_show,
> > - sriov_drivers_autoprobe_store);
> > +static DEVICE_ATTR_RW(sriov_drivers_autoprobe);
> >
> > static struct attribute *sriov_dev_attrs[] = {
> > &dev_attr_sriov_totalvfs.attr,
>
>
> Nice!!!
>
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thank you for reviewing!
-Kelsey
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI/IOV: Make SR-IOV attributes with mode 0664 use 0644
2019-09-05 6:32 [PATCH] PCI/IOV: Make SR-IOV attributes with mode 0664 use 0644 Kelsey Skunberg
2019-09-05 7:34 ` Greg KH
@ 2019-09-05 16:24 ` Don Dutile
2019-09-05 19:19 ` Kelsey Skunberg
2019-09-05 18:29 ` [Linux-kernel-mentees] " Bjorn Helgaas
2 siblings, 1 reply; 7+ messages in thread
From: Don Dutile @ 2019-09-05 16:24 UTC (permalink / raw)
To: Kelsey Skunberg, bhelgaas, linux-pci, linux-kernel
Cc: bodong, gregkh, linux-kernel-mentees, skhan, berrange,
sathyanarayanan.kuppuswamy
On 09/05/2019 02:32 AM, Kelsey Skunberg wrote:
> sriov_numvfs and sriov_drivers_autoprobe have "unusual" permissions (0664)
> with no reported or found reason for allowing group write permissions.
> libvirt runs as root when dealing with PCI, and chowns files for qemu
> needs. There is not a need for the "0664" permissions.
>
> sriov_numvfs was introduced in:
> commit 1789382a72a5 ("PCI: SRIOV control and status via sysfs")
>
> sriov_drivers_autoprobe was introduced in:
> commit 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to
> control VF driver binding")
>
> Change sriov_numvfs and sriov_drivers_autoprobe from "0664" permissions to
> "0644" permissions.
>
> Exchange DEVICE_ATTR() with DEVICE_ATTR_RW() which sets the mode to "0644".
> DEVICE_ATTR() should only be used for "unusual" permissions.
>
> Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
> ---
> drivers/pci/iov.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index b335db21c85e..b3f972e8cfed 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -375,12 +375,11 @@ static ssize_t sriov_drivers_autoprobe_store(struct device *dev,
> }
>
> static DEVICE_ATTR_RO(sriov_totalvfs);
> -static DEVICE_ATTR(sriov_numvfs, 0664, sriov_numvfs_show, sriov_numvfs_store);
> +static DEVICE_ATTR_RW(sriov_numvfs);
> static DEVICE_ATTR_RO(sriov_offset);
> static DEVICE_ATTR_RO(sriov_stride);
> static DEVICE_ATTR_RO(sriov_vf_device);
> -static DEVICE_ATTR(sriov_drivers_autoprobe, 0664, sriov_drivers_autoprobe_show,
> - sriov_drivers_autoprobe_store);
> +static DEVICE_ATTR_RW(sriov_drivers_autoprobe);
>
> static struct attribute *sriov_dev_attrs[] = {
> &dev_attr_sriov_totalvfs.attr,
>
Thanks again for the cleanup.
Acked-by: Donald Dutile <ddutile@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI/IOV: Make SR-IOV attributes with mode 0664 use 0644
2019-09-05 16:24 ` Don Dutile
@ 2019-09-05 19:19 ` Kelsey Skunberg
0 siblings, 0 replies; 7+ messages in thread
From: Kelsey Skunberg @ 2019-09-05 19:19 UTC (permalink / raw)
To: Don Dutile
Cc: bhelgaas, linux-pci, linux-kernel, bodong, gregkh,
linux-kernel-mentees, skhan, berrange,
sathyanarayanan.kuppuswamy
On Thu, Sep 05, 2019 at 12:24:19PM -0400, Don Dutile wrote:
> On 09/05/2019 02:32 AM, Kelsey Skunberg wrote:
> > sriov_numvfs and sriov_drivers_autoprobe have "unusual" permissions (0664)
> > with no reported or found reason for allowing group write permissions.
> > libvirt runs as root when dealing with PCI, and chowns files for qemu
> > needs. There is not a need for the "0664" permissions.
> >
> > sriov_numvfs was introduced in:
> > commit 1789382a72a5 ("PCI: SRIOV control and status via sysfs")
> >
> > sriov_drivers_autoprobe was introduced in:
> > commit 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to
> > control VF driver binding")
> >
> > Change sriov_numvfs and sriov_drivers_autoprobe from "0664" permissions to
> > "0644" permissions.
> >
> > Exchange DEVICE_ATTR() with DEVICE_ATTR_RW() which sets the mode to "0644".
> > DEVICE_ATTR() should only be used for "unusual" permissions.
> >
> > Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
> > ---
> > drivers/pci/iov.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> > index b335db21c85e..b3f972e8cfed 100644
> > --- a/drivers/pci/iov.c
> > +++ b/drivers/pci/iov.c
> > @@ -375,12 +375,11 @@ static ssize_t sriov_drivers_autoprobe_store(struct device *dev,
> > }
> > static DEVICE_ATTR_RO(sriov_totalvfs);
> > -static DEVICE_ATTR(sriov_numvfs, 0664, sriov_numvfs_show, sriov_numvfs_store);
> > +static DEVICE_ATTR_RW(sriov_numvfs);
> > static DEVICE_ATTR_RO(sriov_offset);
> > static DEVICE_ATTR_RO(sriov_stride);
> > static DEVICE_ATTR_RO(sriov_vf_device);
> > -static DEVICE_ATTR(sriov_drivers_autoprobe, 0664, sriov_drivers_autoprobe_show,
> > - sriov_drivers_autoprobe_store);
> > +static DEVICE_ATTR_RW(sriov_drivers_autoprobe);
> > static struct attribute *sriov_dev_attrs[] = {
> > &dev_attr_sriov_totalvfs.attr,
> >
> Thanks again for the cleanup.
>
> Acked-by: Donald Dutile <ddutile@redhat.com>
>
Glad I could contribute. Thanks for your help and the
acknowledgment. :)
-Kelsey
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Linux-kernel-mentees] [PATCH] PCI/IOV: Make SR-IOV attributes with mode 0664 use 0644
2019-09-05 6:32 [PATCH] PCI/IOV: Make SR-IOV attributes with mode 0664 use 0644 Kelsey Skunberg
2019-09-05 7:34 ` Greg KH
2019-09-05 16:24 ` Don Dutile
@ 2019-09-05 18:29 ` Bjorn Helgaas
2019-09-05 19:21 ` Kelsey Skunberg
2 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2019-09-05 18:29 UTC (permalink / raw)
To: Kelsey Skunberg
Cc: linux-pci, linux-kernel, sathyanarayanan.kuppuswamy, berrange,
ddutile, bodong, linux-kernel-mentees, Eli Cohen
[+cc Bodong, Eli: just FYI since this affects sriov_drivers_autoprobe,
which you added with 0e7df22401a3]
On Thu, Sep 05, 2019 at 12:32:26AM -0600, Kelsey Skunberg wrote:
> sriov_numvfs and sriov_drivers_autoprobe have "unusual" permissions (0664)
> with no reported or found reason for allowing group write permissions.
> libvirt runs as root when dealing with PCI, and chowns files for qemu
> needs. There is not a need for the "0664" permissions.
>
> sriov_numvfs was introduced in:
> commit 1789382a72a5 ("PCI: SRIOV control and status via sysfs")
>
> sriov_drivers_autoprobe was introduced in:
> commit 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to
> control VF driver binding")
>
> Change sriov_numvfs and sriov_drivers_autoprobe from "0664" permissions to
> "0644" permissions.
>
> Exchange DEVICE_ATTR() with DEVICE_ATTR_RW() which sets the mode to "0644".
> DEVICE_ATTR() should only be used for "unusual" permissions.
>
> Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
Applied with Greg's Reviewed-by and Don's Acked-by to pci/misc for
v5.4, thanks!
> ---
> drivers/pci/iov.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index b335db21c85e..b3f972e8cfed 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -375,12 +375,11 @@ static ssize_t sriov_drivers_autoprobe_store(struct device *dev,
> }
>
> static DEVICE_ATTR_RO(sriov_totalvfs);
> -static DEVICE_ATTR(sriov_numvfs, 0664, sriov_numvfs_show, sriov_numvfs_store);
> +static DEVICE_ATTR_RW(sriov_numvfs);
> static DEVICE_ATTR_RO(sriov_offset);
> static DEVICE_ATTR_RO(sriov_stride);
> static DEVICE_ATTR_RO(sriov_vf_device);
> -static DEVICE_ATTR(sriov_drivers_autoprobe, 0664, sriov_drivers_autoprobe_show,
> - sriov_drivers_autoprobe_store);
> +static DEVICE_ATTR_RW(sriov_drivers_autoprobe);
>
> static struct attribute *sriov_dev_attrs[] = {
> &dev_attr_sriov_totalvfs.attr,
> --
> 2.20.1
>
> _______________________________________________
> Linux-kernel-mentees mailing list
> Linux-kernel-mentees@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Linux-kernel-mentees] [PATCH] PCI/IOV: Make SR-IOV attributes with mode 0664 use 0644
2019-09-05 18:29 ` [Linux-kernel-mentees] " Bjorn Helgaas
@ 2019-09-05 19:21 ` Kelsey Skunberg
0 siblings, 0 replies; 7+ messages in thread
From: Kelsey Skunberg @ 2019-09-05 19:21 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, linux-kernel, sathyanarayanan.kuppuswamy, berrange,
ddutile, bodong, linux-kernel-mentees, Eli Cohen
On Thu, Sep 05, 2019 at 01:29:38PM -0500, Bjorn Helgaas wrote:
> [+cc Bodong, Eli: just FYI since this affects sriov_drivers_autoprobe,
> which you added with 0e7df22401a3]
>
> On Thu, Sep 05, 2019 at 12:32:26AM -0600, Kelsey Skunberg wrote:
> > sriov_numvfs and sriov_drivers_autoprobe have "unusual" permissions (0664)
> > with no reported or found reason for allowing group write permissions.
> > libvirt runs as root when dealing with PCI, and chowns files for qemu
> > needs. There is not a need for the "0664" permissions.
> >
> > sriov_numvfs was introduced in:
> > commit 1789382a72a5 ("PCI: SRIOV control and status via sysfs")
> >
> > sriov_drivers_autoprobe was introduced in:
> > commit 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to
> > control VF driver binding")
> >
> > Change sriov_numvfs and sriov_drivers_autoprobe from "0664" permissions to
> > "0644" permissions.
> >
> > Exchange DEVICE_ATTR() with DEVICE_ATTR_RW() which sets the mode to "0644".
> > DEVICE_ATTR() should only be used for "unusual" permissions.
> >
> > Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
>
> Applied with Greg's Reviewed-by and Don's Acked-by to pci/misc for
> v5.4, thanks!
>
Appreciate you adding the cc and applying. Thanks, Bjorn!
-Kelsey
> > ---
> > drivers/pci/iov.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> > index b335db21c85e..b3f972e8cfed 100644
> > --- a/drivers/pci/iov.c
> > +++ b/drivers/pci/iov.c
> > @@ -375,12 +375,11 @@ static ssize_t sriov_drivers_autoprobe_store(struct device *dev,
> > }
> >
> > static DEVICE_ATTR_RO(sriov_totalvfs);
> > -static DEVICE_ATTR(sriov_numvfs, 0664, sriov_numvfs_show, sriov_numvfs_store);
> > +static DEVICE_ATTR_RW(sriov_numvfs);
> > static DEVICE_ATTR_RO(sriov_offset);
> > static DEVICE_ATTR_RO(sriov_stride);
> > static DEVICE_ATTR_RO(sriov_vf_device);
> > -static DEVICE_ATTR(sriov_drivers_autoprobe, 0664, sriov_drivers_autoprobe_show,
> > - sriov_drivers_autoprobe_store);
> > +static DEVICE_ATTR_RW(sriov_drivers_autoprobe);
> >
> > static struct attribute *sriov_dev_attrs[] = {
> > &dev_attr_sriov_totalvfs.attr,
> > --
> > 2.20.1
> >
> > _______________________________________________
> > Linux-kernel-mentees mailing list
> > Linux-kernel-mentees@lists.linuxfoundation.org
> > https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
^ permalink raw reply [flat|nested] 7+ messages in thread