PCI/MSI: fix page fault when msi_populate_sysfs() failed
PATCH 1/1 PCI/MSI: fix page fault when msi_populate_sysfs() failed
I got a page fault report when doing fault injection test:
BUG: unable to handle page fault for address: fffffffffffffff4 ... RIP: 0010:sysfs_remove_groups+0x25/0x60 ... Call Trace: msi_destroy_sysfs+0x30/0xa0 free_msi_irqs+0x11d/0x1b0 __pci_enable_msix_range+0x67f/0x760 pci_alloc_irq_vectors_affinity+0xe7/0x170 vp_find_vqs_msix+0x129/0x560 vp_find_vqs+0x52/0x230 vp_modern_find_vqs+0x47/0xb0 p9_virtio_probe+0xa1/0x460 [9pnet_virtio] virtio_dev_probe+0x1ed/0x2e0 really_probe+0x1c7/0x400 __driver_probe_device+0xa4/0x120 driver_probe_device+0x32/0xe0 __driver_attach+0xbf/0x130 bus_for_each_dev+0xbb/0x110 driver_attach+0x27/0x30 bus_add_driver+0x1d9/0x270 driver_register+0xa9/0x180 register_virtio_driver+0x31/0x50 p9_virtio_init+0x3c/0x1000 [9pnet_virtio] do_one_initcall+0x7b/0x380 do_init_module+0x5f/0x21e load_module+0x265c/0x2c60 __do_sys_finit_module+0xb0/0xf0 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x34/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xae
When populating msi_irqs sysfs failed in msi_capability_init() or msix_capability_init(), dev->msi_irq_groups will point to ERR_PTR(...). This will cause a page fault when destroying the wrong dev->msi_irq_groups in free_msi_irqs().
Fix this by setting dev->msi_irq_groups to NULL when msi_populate_sysfs() failed.
--- drivers/pci/msi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/msi.c +2 -0
@@ -561,6 +561,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec, dev->msi_irq_groups =msi_populate_sysfs (&dev->dev);if (IS_ERR (dev->msi_irq_groups)) { ret =PTR_ERR (dev->msi_irq_groups); + dev->msi_irq_groups =NULL ; goto err; }
@@ -733,6 +734,7 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, dev->msi_irq_groups =msi_populate_sysfs (&dev->dev);if (IS_ERR (dev->msi_irq_groups)) { ret =PTR_ERR (dev->msi_irq_groups); + dev->msi_irq_groups =NULL ; goto out_free; }
Signature · 1 line
2.17.1
Quoted 40 lines · Wang Hai
I got a page fault report when doing fault injection test:
BUG: unable to handle page fault for address: fffffffffffffff4 ... RIP: 0010:sysfs_remove_groups+0x25/0x60 ... Call Trace: msi_destroy_sysfs+0x30/0xa0 free_msi_irqs+0x11d/0x1b0 __pci_enable_msix_range+0x67f/0x760 pci_alloc_irq_vectors_affinity+0xe7/0x170 vp_find_vqs_msix+0x129/0x560 vp_find_vqs+0x52/0x230 vp_modern_find_vqs+0x47/0xb0 p9_virtio_probe+0xa1/0x460 [9pnet_virtio] virtio_dev_probe+0x1ed/0x2e0 really_probe+0x1c7/0x400 __driver_probe_device+0xa4/0x120 driver_probe_device+0x32/0xe0 __driver_attach+0xbf/0x130 bus_for_each_dev+0xbb/0x110 driver_attach+0x27/0x30 bus_add_driver+0x1d9/0x270 driver_register+0xa9/0x180 register_virtio_driver+0x31/0x50 p9_virtio_init+0x3c/0x1000 [9pnet_virtio] do_one_initcall+0x7b/0x380 do_init_module+0x5f/0x21e load_module+0x265c/0x2c60 __do_sys_finit_module+0xb0/0xf0 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x34/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xaeWhen populating
msi_irqssysfs failed inmsi_capability_init()ormsix_capability_init(),dev->msi_irq_groupswill point toERR_PTR(...). This will cause a page fault when destroying the wrongdev->msi_irq_groupsinfree_msi_irqs().
Quoted 6 lines
Fix this by setting
dev->msi_irq_groupsto NULL whenmsi_populate_sysfs()failed.Fixes 2f170814bdd2 ("genirq/msi: Move MSI sysfs handling from PCI to MSI core")Reported-by Hulk Robot <[email protected]>Signed-off-by Wang Hai <[email protected]>
Quoted 17 lines
--- drivers/pci/msi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/pci/msi.c +1
-0@@ -561,6 +561,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec, dev->msi_irq_groups =msi_populate_sysfs (&dev->dev);if (IS_ERR (dev->msi_irq_groups)) { ret =PTR_ERR (dev->msi_irq_groups); + dev->msi_irq_groups =NULL ; goto err; }
drivers/pci/msi.c static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, · line 737
Quoted 4 lines
drivers/pci/msi.c +1
-0@@ -733,6 +734,7 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, dev->msi_irq_groups =msi_populate_sysfs (&dev->dev);if (IS_ERR (dev->msi_irq_groups)) { ret =PTR_ERR (dev->msi_irq_groups); + dev->msi_irq_groups =NULL ;
Can you define a temp variable and assign it to dev->msi_irq_groups if the temp variable
is not PTR_ERR?
Quoted 6 lines
drivers/pci/msi.c +0
-1goto out_free; } --2.17.1
Thanks
Barry
Quoted 64 lines · Barry Song
Quoted 39 lines · Wang Hai
I got a page fault report when doing fault injection test:
BUG: unable to handle page fault for address: fffffffffffffff4 ... RIP: 0010:sysfs_remove_groups+0x25/0x60 ... Call Trace: msi_destroy_sysfs+0x30/0xa0 free_msi_irqs+0x11d/0x1b0 __pci_enable_msix_range+0x67f/0x760 pci_alloc_irq_vectors_affinity+0xe7/0x170 vp_find_vqs_msix+0x129/0x560 vp_find_vqs+0x52/0x230 vp_modern_find_vqs+0x47/0xb0 p9_virtio_probe+0xa1/0x460 [9pnet_virtio] virtio_dev_probe+0x1ed/0x2e0 really_probe+0x1c7/0x400 __driver_probe_device+0xa4/0x120 driver_probe_device+0x32/0xe0 __driver_attach+0xbf/0x130 bus_for_each_dev+0xbb/0x110 driver_attach+0x27/0x30 bus_add_driver+0x1d9/0x270 driver_register+0xa9/0x180 register_virtio_driver+0x31/0x50 p9_virtio_init+0x3c/0x1000 [9pnet_virtio] do_one_initcall+0x7b/0x380 do_init_module+0x5f/0x21e load_module+0x265c/0x2c60 __do_sys_finit_module+0xb0/0xf0 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x34/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xaeWhen populating
msi_irqssysfs failed inmsi_capability_init()ormsix_capability_init(),dev->msi_irq_groupswill point toERR_PTR(...). This will cause a page fault when destroying the wrongdev->msi_irq_groupsinfree_msi_irqs().Quoted 6 lines
Fix this by setting
dev->msi_irq_groupsto NULL whenmsi_populate_sysfs()failed.Fixes 2f170814bdd2 ("genirq/msi: Move MSI sysfs handling from PCI to MSI core")Reported-by Hulk Robot <[email protected]>Signed-off-by Wang Hai <[email protected]>Acked-by Barry Song <[email protected]>Quoted 16 lines
--- drivers/pci/msi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/pci/msi.c +1
-0@@ -561,6 +561,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec, dev->msi_irq_groups =msi_populate_sysfs (&dev->dev);if (IS_ERR (dev->msi_irq_groups)) { ret =PTR_ERR (dev->msi_irq_groups); + dev->msi_irq_groups =NULL ; goto err; }
Quoted 8 lines
drivers/pci/msi.c static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, · line 737
Quoted 5 lines
drivers/pci/msi.c +1
-0@@ -733,6 +734,7 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, dev->msi_irq_groups =msi_populate_sysfs (&dev->dev);if (IS_ERR (dev->msi_irq_groups)) { ret =PTR_ERR (dev->msi_irq_groups); + dev->msi_irq_groups =NULL ;Can you define a temp variable and assign it to
dev->msi_irq_groupsif the temp variable
is notPTR_ERR?
Of course, I will send a v2 patch.
Quoted 11 lines
Quoted 7 lines
drivers/pci/msi.c +0
-1goto out_free; } --2.17.1
Thanks
Barry
.
Signature · 1 line
Wang Hai
For v2, please note "git log --oneline drivers/pci/msi.c" and make your patch follow the style, including capitalization.
Quoted 4 lines · wanghai (M)
Quoted 2 lines · Barry Song
Quoted 1 line · Wang Hai
I got a page fault report when doing fault injection test:
When you send v2, can you include information about how you injected the fault? If it's easy, others can reproduce the failure that way.
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
BUG: unable to handle page fault for address: fffffffffffffff4 ... RIP: 0010:sysfs_remove_groups+0x25/0x60 ... Call Trace: msi_destroy_sysfs+0x30/0xa0 free_msi_irqs+0x11d/0x1b0 __pci_enable_msix_range+0x67f/0x760 pci_alloc_irq_vectors_affinity+0xe7/0x170 vp_find_vqs_msix+0x129/0x560 vp_find_vqs+0x52/0x230 vp_modern_find_vqs+0x47/0xb0 p9_virtio_probe+0xa1/0x460 [9pnet_virtio] virtio_dev_probe+0x1ed/0x2e0 really_probe+0x1c7/0x400 __driver_probe_device+0xa4/0x120 driver_probe_device+0x32/0xe0 __driver_attach+0xbf/0x130 bus_for_each_dev+0xbb/0x110 driver_attach+0x27/0x30 bus_add_driver+0x1d9/0x270 driver_register+0xa9/0x180 register_virtio_driver+0x31/0x50 p9_virtio_init+0x3c/0x1000 [9pnet_virtio] do_one_initcall+0x7b/0x380 do_init_module+0x5f/0x21e load_module+0x265c/0x2c60 __do_sys_finit_module+0xb0/0xf0 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x34/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xaeWhen populating
msi_irqssysfs failed inmsi_capability_init()ormsix_capability_init(),dev->msi_irq_groupswill point toERR_PTR(...). This will cause a page fault when destroying the wrongdev->msi_irq_groupsinfree_msi_irqs().
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Fix this by setting
dev->msi_irq_groupsto NULL whenmsi_populate_sysfs()failed.Fixes 2f170814bdd2 ("genirq/msi: Move MSI sysfs handling from PCI to MSI core")Reported-by Hulk Robot <[email protected]>
What exactly was reported by the Hulk Robot? Did it really do the fault injection and report the page fault?
Quoted 42 lines
Quoted 19 lines
Quoted 1 line
Signed-off-by Wang Hai <[email protected]>Acked-by Barry Song <[email protected]>Quoted 16 lines
--- drivers/pci/msi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/pci/msi.c +1
-0@@ -561,6 +561,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec, dev->msi_irq_groups =msi_populate_sysfs (&dev->dev);if (IS_ERR (dev->msi_irq_groups)) { ret =PTR_ERR (dev->msi_irq_groups); + dev->msi_irq_groups =NULL ; goto err; }Quoted 8 lines
drivers/pci/msi.c static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, · line 737
Quoted 5 lines
drivers/pci/msi.c +1
-0@@ -733,6 +734,7 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, dev->msi_irq_groups =msi_populate_sysfs (&dev->dev);if (IS_ERR (dev->msi_irq_groups)) { ret =PTR_ERR (dev->msi_irq_groups); + dev->msi_irq_groups =NULL ;Can you define a temp variable and assign it to
dev->msi_irq_groupsif the temp variable
is notPTR_ERR?Of course, I will send a v2 patch.
Quoted 11 lines
Quoted 7 lines
drivers/pci/msi.c +0
-1goto out_free; } --2.17.1
Thanks
Barry
.Signature · 1 line
Wang Hai
Quoted 9 lines · Bjorn Helgaas
For v2, please note "git log --oneline
drivers/pci/msi.c" and make your patch follow the style, including capitalization.Quoted 3 lines · wanghai (M)
Quoted 2 lines · Barry Song
Quoted 1 line · Wang Hai
I got a page fault report when doing fault injection test:
When you send v2, can you include information about how you injected the fault? If it's easy, others can reproduce the failure that way.
Sorry, the reproduction needs to be based on the fault injection framework provided by Hulk Robot. I don't know how the framework is implemented.
The way to reproduce this is to do a fault injection to make 'msi_attrs = kcalloc() in msi_populate_sysfs()' fail when insmod 9pnet_virtio.ko.
I sent v2 yesterday, can you help review it?
https://lore.kernel.org/linux-pci/[email protected]/
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
BUG: unable to handle page fault for address: fffffffffffffff4 ... RIP: 0010:sysfs_remove_groups+0x25/0x60 ... Call Trace: msi_destroy_sysfs+0x30/0xa0 free_msi_irqs+0x11d/0x1b0 __pci_enable_msix_range+0x67f/0x760 pci_alloc_irq_vectors_affinity+0xe7/0x170 vp_find_vqs_msix+0x129/0x560 vp_find_vqs+0x52/0x230 vp_modern_find_vqs+0x47/0xb0 p9_virtio_probe+0xa1/0x460 [9pnet_virtio] virtio_dev_probe+0x1ed/0x2e0 really_probe+0x1c7/0x400 __driver_probe_device+0xa4/0x120 driver_probe_device+0x32/0xe0 __driver_attach+0xbf/0x130 bus_for_each_dev+0xbb/0x110 driver_attach+0x27/0x30 bus_add_driver+0x1d9/0x270 driver_register+0xa9/0x180 register_virtio_driver+0x31/0x50 p9_virtio_init+0x3c/0x1000 [9pnet_virtio] do_one_initcall+0x7b/0x380 do_init_module+0x5f/0x21e load_module+0x265c/0x2c60 __do_sys_finit_module+0xb0/0xf0 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x34/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xaeWhen populating
msi_irqssysfs failed inmsi_capability_init()ormsix_capability_init(),dev->msi_irq_groupswill point toERR_PTR(...). This will cause a page fault when destroying the wrongdev->msi_irq_groupsinfree_msi_irqs().
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Fix this by setting
dev->msi_irq_groupsto NULL whenmsi_populate_sysfs()failed.Fixes 2f170814bdd2 ("genirq/msi: Move MSI sysfs handling from PCI to MSI core")Reported-by Hulk Robot <[email protected]>What exactly was reported by the Hulk Robot? Did it really do the fault injection and report the page fault?
Yes, it reported the error and provided a way to reproduce it
Quoted 43 lines
Quoted 31 lines
Quoted 19 lines
Quoted 1 line
Signed-off-by Wang Hai <[email protected]>Acked-by Barry Song <[email protected]>Quoted 16 lines
--- drivers/pci/msi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/pci/msi.c +1
-0@@ -561,6 +561,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec, dev->msi_irq_groups =msi_populate_sysfs (&dev->dev);if (IS_ERR (dev->msi_irq_groups)) { ret =PTR_ERR (dev->msi_irq_groups); + dev->msi_irq_groups =NULL ; goto err; }Quoted 8 lines
drivers/pci/msi.c static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, · line 737
Quoted 5 lines
drivers/pci/msi.c +1
-0@@ -733,6 +734,7 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, dev->msi_irq_groups =msi_populate_sysfs (&dev->dev);if (IS_ERR (dev->msi_irq_groups)) { ret =PTR_ERR (dev->msi_irq_groups); + dev->msi_irq_groups =NULL ;Can you define a temp variable and assign it to
dev->msi_irq_groupsif the temp variable
is notPTR_ERR?Of course, I will send a v2 patch.
Quoted 3 lines
Quoted 3 lines
drivers/pci/msi.c +0
-0goto out_free; }Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
--
2.17.1Thanks
Barry
.Signature · 1 line
Wang Hai.
Signature · 1 line
Wang Hai
Quoted 57 lines · wanghai (M)
Quoted 9 lines · Bjorn Helgaas
For v2, please note "git log --oneline
drivers/pci/msi.c" and make your patch follow the style, including capitalization.Quoted 3 lines · wanghai (M)
Quoted 2 lines · Barry Song
Quoted 1 line · Wang Hai
I got a page fault report when doing fault injection test:
When you send v2, can you include information about how you injected the fault? If it's easy, others can reproduce the failure that way.
Sorry, the reproduction needs to be based on the fault injection framework provided by Hulk Robot. I don't know how the framework is implemented.
The way to reproduce this is to do a fault injection to make '
msi_attrs=kcalloc()inmsi_populate_sysfs()' fail when insmod 9pnet_virtio.ko.I sent v2 yesterday, can you help review it?
https://lore.kernel.org/linux-pci/[email protected]/Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
BUG: unable to handle page fault for address: fffffffffffffff4 ... RIP: 0010:sysfs_remove_groups+0x25/0x60 ... Call Trace: msi_destroy_sysfs+0x30/0xa0 free_msi_irqs+0x11d/0x1b0 __pci_enable_msix_range+0x67f/0x760 pci_alloc_irq_vectors_affinity+0xe7/0x170 vp_find_vqs_msix+0x129/0x560 vp_find_vqs+0x52/0x230 vp_modern_find_vqs+0x47/0xb0 p9_virtio_probe+0xa1/0x460 [9pnet_virtio] virtio_dev_probe+0x1ed/0x2e0 really_probe+0x1c7/0x400 __driver_probe_device+0xa4/0x120 driver_probe_device+0x32/0xe0 __driver_attach+0xbf/0x130 bus_for_each_dev+0xbb/0x110 driver_attach+0x27/0x30 bus_add_driver+0x1d9/0x270 driver_register+0xa9/0x180 register_virtio_driver+0x31/0x50 p9_virtio_init+0x3c/0x1000 [9pnet_virtio] do_one_initcall+0x7b/0x380 do_init_module+0x5f/0x21e load_module+0x265c/0x2c60 __do_sys_finit_module+0xb0/0xf0 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x34/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xaeWhen populating
msi_irqssysfs failed inmsi_capability_init()ormsix_capability_init(),dev->msi_irq_groupswill point toERR_PTR(...). This will cause a page fault when destroying the wrongdev->msi_irq_groupsinfree_msi_irqs().
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Fix this by setting
dev->msi_irq_groupsto NULL whenmsi_populate_sysfs()failed.Fixes 2f170814bdd2 ("genirq/msi: Move MSI sysfs handling from PCI to MSI core")Reported-by Hulk Robot <[email protected]>What exactly was reported by the Hulk Robot? Did it really do the fault injection and report the page fault?
Yes, it reported the error and provided a way to reproduce it
Great, can you include a link to that report then?
Quoted 60 lines · Bjorn Helgaas
Quoted 59 lines · wanghai (M)
Quoted 9 lines · Bjorn Helgaas
For v2, please note "git log --oneline
drivers/pci/msi.c" and make your patch follow the style, including capitalization.Quoted 3 lines · wanghai (M)
Quoted 2 lines · Barry Song
Quoted 1 line · Wang Hai
I got a page fault report when doing fault injection test:
When you send v2, can you include information about how you injected the fault? If it's easy, others can reproduce the failure that way.
Sorry, the reproduction needs to be based on the fault injection framework provided by Hulk Robot. I don't know how the framework is implemented.
The way to reproduce this is to do a fault injection to make '
msi_attrs=kcalloc()inmsi_populate_sysfs()' fail when insmod 9pnet_virtio.ko.I sent v2 yesterday, can you help review it?
https://lore.kernel.org/linux-pci/[email protected]/Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
BUG: unable to handle page fault for address: fffffffffffffff4 ... RIP: 0010:sysfs_remove_groups+0x25/0x60 ... Call Trace: msi_destroy_sysfs+0x30/0xa0 free_msi_irqs+0x11d/0x1b0 __pci_enable_msix_range+0x67f/0x760 pci_alloc_irq_vectors_affinity+0xe7/0x170 vp_find_vqs_msix+0x129/0x560 vp_find_vqs+0x52/0x230 vp_modern_find_vqs+0x47/0xb0 p9_virtio_probe+0xa1/0x460 [9pnet_virtio] virtio_dev_probe+0x1ed/0x2e0 really_probe+0x1c7/0x400 __driver_probe_device+0xa4/0x120 driver_probe_device+0x32/0xe0 __driver_attach+0xbf/0x130 bus_for_each_dev+0xbb/0x110 driver_attach+0x27/0x30 bus_add_driver+0x1d9/0x270 driver_register+0xa9/0x180 register_virtio_driver+0x31/0x50 p9_virtio_init+0x3c/0x1000 [9pnet_virtio] do_one_initcall+0x7b/0x380 do_init_module+0x5f/0x21e load_module+0x265c/0x2c60 __do_sys_finit_module+0xb0/0xf0 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x34/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xaeWhen populating
msi_irqssysfs failed inmsi_capability_init()ormsix_capability_init(),dev->msi_irq_groupswill point toERR_PTR(...). This will cause a page fault when destroying the wrongdev->msi_irq_groupsinfree_msi_irqs().Fix this by setting
dev->msi_irq_groupsto NULL whenmsi_populate_sysfs()failed.
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Fixes 2f170814bdd2 ("genirq/msi: Move MSI sysfs handling from PCI to MSI core")Reported-by Hulk Robot <[email protected]>What exactly was reported by the Hulk Robot? Did it really do the fault injection and report the page fault?
Yes, it reported the error and provided a way to reproduce it
Great, can you include a link to that report then? .
Currently hulk robot is still in the process of continuous improvement and is not open to the public for the time being, so you can not access our links at the moment. We will open it in the future when it is perfected.
Signature · 1 line
Wang Hai
Quoted 65 lines · wanghai (M)
Quoted 62 lines · Bjorn Helgaas
Quoted 61 lines · wanghai (M)
Quoted 9 lines · Bjorn Helgaas
For v2, please note "git log --oneline
drivers/pci/msi.c" and make your patch follow the style, including capitalization.Quoted 3 lines · wanghai (M)
Quoted 2 lines · Barry Song
Quoted 1 line · Wang Hai
I got a page fault report when doing fault injection test:
When you send v2, can you include information about how you injected the fault? If it's easy, others can reproduce the failure that way.
Sorry, the reproduction needs to be based on the fault injection framework provided by Hulk Robot. I don't know how the framework is implemented.
The way to reproduce this is to do a fault injection to make '
msi_attrs=kcalloc()inmsi_populate_sysfs()' fail when insmod 9pnet_virtio.ko.I sent v2 yesterday, can you help review it?
https://lore.kernel.org/linux-pci/[email protected]/Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
BUG: unable to handle page fault for address: fffffffffffffff4 ... RIP: 0010:sysfs_remove_groups+0x25/0x60 ... Call Trace: msi_destroy_sysfs+0x30/0xa0 free_msi_irqs+0x11d/0x1b0 __pci_enable_msix_range+0x67f/0x760 pci_alloc_irq_vectors_affinity+0xe7/0x170 vp_find_vqs_msix+0x129/0x560 vp_find_vqs+0x52/0x230 vp_modern_find_vqs+0x47/0xb0 p9_virtio_probe+0xa1/0x460 [9pnet_virtio] virtio_dev_probe+0x1ed/0x2e0 really_probe+0x1c7/0x400 __driver_probe_device+0xa4/0x120 driver_probe_device+0x32/0xe0 __driver_attach+0xbf/0x130 bus_for_each_dev+0xbb/0x110 driver_attach+0x27/0x30 bus_add_driver+0x1d9/0x270 driver_register+0xa9/0x180 register_virtio_driver+0x31/0x50 p9_virtio_init+0x3c/0x1000 [9pnet_virtio] do_one_initcall+0x7b/0x380 do_init_module+0x5f/0x21e load_module+0x265c/0x2c60 __do_sys_finit_module+0xb0/0xf0 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x34/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xaeWhen populating
msi_irqssysfs failed inmsi_capability_init()ormsix_capability_init(),dev->msi_irq_groupswill point toERR_PTR(...). This will cause a page fault when destroying the wrongdev->msi_irq_groupsinfree_msi_irqs().Fix this by setting
dev->msi_irq_groupsto NULL whenmsi_populate_sysfs()failed.Fixes 2f170814bdd2 ("genirq/msi: Move MSI sysfs handling from PCI to MSI core")Reported-by Hulk Robot <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
What exactly was reported by the Hulk Robot? Did it really do the fault injection and report the page fault?
Yes, it reported the error and provided a way to reproduce it
Great, can you include a link to that report then? .
Currently hulk robot is still in the process of continuous improvement and is not open to the public for the time being, so you can not access our links at the moment. We will open it in the future when it is perfected.
hi hai, would you like to put some information in the commit log like if 'msi_attrs = kcalloc() in msi_populate_sysfs()' fails, blah, blah, blah...
It seems this can make things a bit clearer to me. Anyway, it doesn't matter too much. The fix is correct.
Quoted 4 lines
--
Wang Hai
Thanks
barry
Quoted 70 lines · Barry Song
Quoted 69 lines · wanghai (M)
Quoted 67 lines · Bjorn Helgaas
Quoted 56 lines · wanghai (M)
Quoted 9 lines · Bjorn Helgaas
For v2, please note "git log --oneline
drivers/pci/msi.c" and make your patch follow the style, including capitalization.Quoted 3 lines · wanghai (M)
Quoted 2 lines · Barry Song
Quoted 1 line · Wang Hai
I got a page fault report when doing fault injection test:
When you send v2, can you include information about how you injected the fault? If it's easy, others can reproduce the failure that way.
Sorry, the reproduction needs to be based on the fault injection framework provided by Hulk Robot. I don't know how the framework is implemented.
The way to reproduce this is to do a fault injection to make '
msi_attrs=kcalloc()inmsi_populate_sysfs()' fail when insmod 9pnet_virtio.ko.I sent v2 yesterday, can you help review it?
https://lore.kernel.org/linux-pci/[email protected]/Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
BUG: unable to handle page fault for address: fffffffffffffff4 ... RIP: 0010:sysfs_remove_groups+0x25/0x60 ... Call Trace: msi_destroy_sysfs+0x30/0xa0 free_msi_irqs+0x11d/0x1b0 __pci_enable_msix_range+0x67f/0x760 pci_alloc_irq_vectors_affinity+0xe7/0x170 vp_find_vqs_msix+0x129/0x560 vp_find_vqs+0x52/0x230 vp_modern_find_vqs+0x47/0xb0 p9_virtio_probe+0xa1/0x460 [9pnet_virtio] virtio_dev_probe+0x1ed/0x2e0 really_probe+0x1c7/0x400 __driver_probe_device+0xa4/0x120 driver_probe_device+0x32/0xe0 __driver_attach+0xbf/0x130 bus_for_each_dev+0xbb/0x110 driver_attach+0x27/0x30 bus_add_driver+0x1d9/0x270 driver_register+0xa9/0x180 register_virtio_driver+0x31/0x50 p9_virtio_init+0x3c/0x1000 [9pnet_virtio] do_one_initcall+0x7b/0x380 do_init_module+0x5f/0x21e load_module+0x265c/0x2c60 __do_sys_finit_module+0xb0/0xf0 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x34/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xaeWhen populating
msi_irqssysfs failed inmsi_capability_init()ormsix_capability_init(),dev->msi_irq_groupswill point toERR_PTR(...). This will cause a page fault when destroying the wrongdev->msi_irq_groupsinfree_msi_irqs().Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Fix this by setting
dev->msi_irq_groupsto NULL whenmsi_populate_sysfs()failed.Fixes 2f170814bdd2 ("genirq/msi: Move MSI sysfs handling from PCI to MSI core")Reported-by Hulk Robot <[email protected]>What exactly was reported by the Hulk Robot? Did it really do the fault injection and report the page fault?
Yes, it reported the error and provided a way to reproduce it
Great, can you include a link to that report then? .
Quoted 8 lines
Quoted 3 lines
Currently hulk robot is still in the process of continuous improvement and is not open to the public for the time being, so you can not access our links at the moment. We will open it in the future when it is perfected.
hi hai, would you like to put some information in the commit log like if '
msi_attrs=kcalloc()inmsi_populate_sysfs()' fails, blah, blah, blah...It seems this can make things a bit clearer to me. Anyway, it doesn't matter too much. The fix is correct.
Okay, I'll refine the commit log and resend a patch
Quoted 7 lines
Quoted 3 lines
--
Wang HaiThanks
barry
.
Signature · 1 line
Wang Hai