| 27a8204b | 04-Sep-2024 |
Hongbo Li <[email protected]> |
vfio/mdev: Constify struct kobj_type
This 'struct kobj_type' is not modified. It is only used in kobject_init_and_add() which takes a 'const struct kobj_type *ktype' parameter.
Constifying this str
vfio/mdev: Constify struct kobj_type
This 'struct kobj_type' is not modified. It is only used in kobject_init_and_add() which takes a 'const struct kobj_type *ktype' parameter.
Constifying this structure and moving it to a read-only section, and this can increase over all security.
``` [Before] text data bss dec hex filename 2372 600 0 2972 b9c drivers/vfio/mdev/mdev_sysfs.o
[After] text data bss dec hex filename 2436 568 0 3004 bbc drivers/vfio/mdev/mdev_sysfs.o ```
Signed-off-by: Hongbo Li <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
show more ...
|
| 9c799c22 | 23-Sep-2022 |
Jason Gunthorpe <[email protected]> |
vfio/mdev: add mdev available instance checking to the core
Many of the mdev drivers use a simple counter for keeping track of the available instances. Move this code to the core code and store the
vfio/mdev: add mdev available instance checking to the core
Many of the mdev drivers use a simple counter for keeping track of the available instances. Move this code to the core code and store the counter in the mdev_parent. Implement it using correct locking, fixing mdpy.
Drivers just provide the value in the mdev_driver at registration time and the core code takes care of maintaining it and exposing the value in sysfs.
[hch: count instances per-parent instead of per-type, use an atomic_t to avoid taking mdev_list_lock in the show method]
Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Kirti Wankhede <[email protected]> Reviewed-by: Eric Farman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
show more ...
|
| 2815fe14 | 23-Sep-2022 |
Christoph Hellwig <[email protected]> |
vfio/mdev: unexport mdev_bus_type
mdev_bus_type is only used in mdev.ko now, so unexport it.
Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by:
vfio/mdev: unexport mdev_bus_type
mdev_bus_type is only used in mdev.ko now, so unexport it.
Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Kirti Wankhede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
show more ...
|
| 2aa72ec9 | 11-Apr-2022 |
Jason Gunthorpe <[email protected]> |
vfio/mdev: Use the driver core to create the 'remove' file
The device creator is supposed to use the dev.groups value to add sysfs files before device_add is called, not call sysfs_create_files() af
vfio/mdev: Use the driver core to create the 'remove' file
The device creator is supposed to use the dev.groups value to add sysfs files before device_add is called, not call sysfs_create_files() after device_add() returns. This creates a race with uevent delivery where the extra attribute will not be visible.
This was being done because the groups had been co-opted by the mdev driver, now that prior patches have moved the driver's groups to the struct device_driver the dev.group is properly free for use here.
Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Zhi Wang <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Kirti Wankhede <[email protected]> Reviewed-by: Zhi Wang <[email protected]>
show more ...
|
| e6486939 | 11-Apr-2022 |
Jason Gunthorpe <[email protected]> |
vfio/mdev: Remove mdev_parent_ops dev_attr_groups
This is only used by one sample to print a fixed string that is pointless.
In general, having a device driver attach sysfs attributes to the parent
vfio/mdev: Remove mdev_parent_ops dev_attr_groups
This is only used by one sample to print a fixed string that is pointless.
In general, having a device driver attach sysfs attributes to the parent is horrific. This should never happen, and always leads to some kind of liftime bug as it become very difficult for the sysfs attribute to go back to any data owned by the device driver.
Remove the general mechanism to create this abuse.
Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Zhi Wang <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Kirti Wankhede <[email protected]> Reviewed-by: Zhi Wang <[email protected]>
show more ...
|