pci: endpoint test BUG
A message that is not in the archive (sent off-list or not yet received): [email protected]
Randy Dunlap
Tested-byQuoted 24 lines · Hillf Danton
On Sun, 15 Sep 2019 09:34:37 -0700
Quoted 11 lines
Kernel is 5.3-rc8 on
x86_64.Loading and removing the pci-epf-test module causes a BUG.
[40928.435755] calling pci_epf_test_init+0x0/0x1000 [pci_epf_test] @ 12132 [40928.436717] initcall pci_epf_test_init+0x0/0x1000 [pci_epf_test] returned 0 after 891 usecs [40936.996081] ================================================================== [40936.996125] BUG: KASAN: use-after-free in pci_epf_remove_cfs+0x1ae/0x1f0 [40936.996153] Write of size 8 at addr ffff88810a22a068 by task rmmod/12139Fix
fb0de5b8dcc6andef1433f717a2if the currentgroup::group_entryused by pci epf does not break how configfs uses it.drivers/pci/endpoint/pci-epf-core.c +0
-0@@ -153,9 +153,11 @@ static void pci_epf_remove_cfs(struct pcreturn ;mutex_lock (&pci_epf_mutex);
drivers/pci/endpoint/pci-epf-core.c static void pci_epf_remove_cfs(struct pc · line 163
Quoted 10 lines
drivers/pci/endpoint/pci-epf-core.c +4
-2-list_for_each_entry_safe (group, tmp, &driver->epf_group, group_entry) +list_for_each_entry_safe (group, tmp, &driver->epf_group, + group_entry) { +list_del_init (&group->group_entry);pci_ep_cfs_remove_epf_group (group); -list_del (&driver->epf_group); + }mutex_unlock (&pci_epf_mutex); }
Fixes the problem for me. Thanks.
Please make a proper patch.
Signature · 1 line
~Randy
Quoted 22 lines · Hillf Danton
On Sun, 15 Sep 2019 09:34:37 -0700
Quoted 11 lines
Kernel is 5.3-rc8 on
x86_64.Loading and removing the pci-epf-test module causes a BUG.
[40928.435755] calling pci_epf_test_init+0x0/0x1000 [pci_epf_test] @ 12132 [40928.436717] initcall pci_epf_test_init+0x0/0x1000 [pci_epf_test] returned 0 after 891 usecs [40936.996081] ================================================================== [40936.996125] BUG: KASAN: use-after-free in pci_epf_remove_cfs+0x1ae/0x1f0 [40936.996153] Write of size 8 at addr ffff88810a22a068 by task rmmod/12139Fix
fb0de5b8dcc6andef1433f717a2if the currentgroup::group_entryused by pci epf does not break how configfs uses it.drivers/pci/endpoint/pci-epf-core.c +0
-0@@ -153,9 +153,11 @@ static void pci_epf_remove_cfs(struct pcreturn ;
drivers/pci/endpoint/pci-epf-core.c static void pci_epf_remove_cfs(struct pc · line 162
Quoted 10 lines
drivers/pci/endpoint/pci-epf-core.c +4
-2mutex_lock (&pci_epf_mutex); -list_for_each_entry_safe (group, tmp, &driver->epf_group, group_entry) +list_for_each_entry_safe (group, tmp, &driver->epf_group, + group_entry) { +list_del_init (&group->group_entry);pci_ep_cfs_remove_epf_group (group); -list_del (&driver->epf_group); + }mutex_unlock (&pci_epf_mutex); }
Thank you Hillf. Kishon, can you confirm that's the proper fix for this bug please ? I would like to turn this into a patch and merge it in the upcoming merge window PR so it ought to be fairly quick, please let me know asap.
Lorenzo
Kishon Vijay Abraham I
Acked-byQuoted 23 lines · Lorenzo Pieralisi
Quoted 22 lines · Hillf Danton
On Sun, 15 Sep 2019 09:34:37 -0700
Quoted 11 lines
Kernel is 5.3-rc8 on
x86_64.Loading and removing the pci-epf-test module causes a BUG.
[40928.435755] calling pci_epf_test_init+0x0/0x1000 [pci_epf_test] @ 12132 [40928.436717] initcall pci_epf_test_init+0x0/0x1000 [pci_epf_test] returned 0 after 891 usecs [40936.996081] ================================================================== [40936.996125] BUG: KASAN: use-after-free in pci_epf_remove_cfs+0x1ae/0x1f0 [40936.996153] Write of size 8 at addr ffff88810a22a068 by task rmmod/12139Fix
fb0de5b8dcc6andef1433f717a2if the currentgroup::group_entryused by pci epf does not break how configfs uses it.drivers/pci/endpoint/pci-epf-core.c +0
-0@@ -153,9 +153,11 @@ static void pci_epf_remove_cfs(struct pcreturn ;
Quoted 10 lines
drivers/pci/endpoint/pci-epf-core.c static void pci_epf_remove_cfs(struct pc · line 162
Quoted 10 lines
drivers/pci/endpoint/pci-epf-core.c +4
-2mutex_lock (&pci_epf_mutex); -list_for_each_entry_safe (group, tmp, &driver->epf_group, group_entry) +list_for_each_entry_safe (group, tmp, &driver->epf_group, + group_entry) { +list_del_init (&group->group_entry);pci_ep_cfs_remove_epf_group (group); -list_del (&driver->epf_group); + }mutex_unlock (&pci_epf_mutex); }
Quoted 8 lines
Thank you Hillf. Kishon, can you confirm that's the proper fix for this bug please ? I would like to turn this into a patch and merge it in the upcoming merge window PR so it ought to be fairly quick, please let me know asap.
Lorenzo
Quoted 25 lines · Kishon Vijay Abraham I
Quoted 23 lines · Lorenzo Pieralisi
Quoted 22 lines · Hillf Danton
On Sun, 15 Sep 2019 09:34:37 -0700
Quoted 11 lines
Kernel is 5.3-rc8 on
x86_64.Loading and removing the pci-epf-test module causes a BUG.
[40928.435755] calling pci_epf_test_init+0x0/0x1000 [pci_epf_test] @ 12132 [40928.436717] initcall pci_epf_test_init+0x0/0x1000 [pci_epf_test] returned 0 after 891 usecs [40936.996081] ================================================================== [40936.996125] BUG: KASAN: use-after-free in pci_epf_remove_cfs+0x1ae/0x1f0 [40936.996153] Write of size 8 at addr ffff88810a22a068 by task rmmod/12139Fix
fb0de5b8dcc6andef1433f717a2if the currentgroup::group_entryused by pci epf does not break how configfs uses it.drivers/pci/endpoint/pci-epf-core.c +0
-0@@ -153,9 +153,11 @@ static void pci_epf_remove_cfs(struct pcreturn ;
Quoted 19 lines
Quoted 10 lines
drivers/pci/endpoint/pci-epf-core.c static void pci_epf_remove_cfs(struct pc · line 162
Quoted 10 lines
drivers/pci/endpoint/pci-epf-core.c +4
-2mutex_lock (&pci_epf_mutex); -list_for_each_entry_safe (group, tmp, &driver->epf_group, group_entry) +list_for_each_entry_safe (group, tmp, &driver->epf_group, + group_entry) { +list_del_init (&group->group_entry);pci_ep_cfs_remove_epf_group (group); -list_del (&driver->epf_group); + }mutex_unlock (&pci_epf_mutex); }Quoted 5 lines
Thank you Hillf. Kishon, can you confirm that's the proper fix for this bug please ? I would like to turn this into a patch and merge it in the upcoming merge window PR so it ought to be fairly quick, please let me know asap.
Kishon, Hillf, can you turn it into a patch and send it asap please ?
Thanks,
Lorenzo
Quoted 36 lines · Hillf Danton
Quoted 1 line
Kishon, Hillf, can you turn it into a patch and send it asap please ?
What was sent a couple of days before,
To: Bjorn Helgaas <[email protected]>
Cc linux-pci <[email protected]>, LKML <[email protected]>Subject: [PATCH] PCI: endpoint: Fix uaf on unregistering driver
...
Fixes ef1433f717a2 ("PCI: endpoint: Create configfs entry for each pci_epf_device_id table entry")Reported-and-tested-by Randy Dunlap <[email protected]>Cc Al Viro <[email protected]>Cc Dan Carpenter <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Cc Andrey Konovalov <[email protected]>Signed-off-by Hillf Danton <[email protected]>---
Quoted 7 lines
and it is certain that <[email protected]> is on the Cc list.
It will be resent if no one saw the message.
I didn't see it and I can't find it on lore.kernel.org/linux-pci/.
Signature · 1 line
~Randy
Quoted 46 lines · Hillf Danton
Quoted 9 lines
Quoted 3 lines
It will be resent if no one saw the message.
I didn't see it and I can't find it on lore.kernel.org/linux-pci/.
Respin, git send-email
works/jj/pci-epf-uaf.txt...
From: Hillf Danton <[email protected]>
To: Bjorn Helgaas <[email protected]>
Cc linux-pci <[email protected]>,LKML <[email protected]>,
Randy Dunlap <[email protected]>,
Al Viro <[email protected]>,
Dan Carpenter <[email protected]>,
Lorenzo Pieralisi <[email protected]>,
Kishon Vijay Abraham I <[email protected]>,
Andrey Konovalov <[email protected]>,
Hillf Danton <[email protected]>
Subject: [PATCH] PCI: endpoint: Fix uaf on unregistering driver
Date: Sat, 21 Sep 2019 09:58:28 +0800
Message-Id: <[email protected]>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Quoted 7 lines
Result: 250
And let me know you see it.
No, not seeing the patch in my Inbox nor on lore.kernel.org.
It's a mystery to me.
Signature · 1 line
~Randy
A message that is not in the archive (sent off-list or not yet received): c2cadd96-a6d5-45f9-9abc-4c89b4a8b056@VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com
Quoted 48 lines · Hillf Danton
Quoted 9 lines
Quoted 3 lines
It will be resent if no one saw the message.
I didn't see it and I can't find it on lore.kernel.org/linux-pci/.
Respin, git send-email
works/jj/pci-epf-uaf.txt...
From: Hillf Danton <[email protected]>
To: Bjorn Helgaas <[email protected]>
Cc linux-pci <[email protected]>,LKML <[email protected]>,
Randy Dunlap <[email protected]>,
Al Viro <[email protected]>,
Dan Carpenter <[email protected]>,
Lorenzo Pieralisi <[email protected]>,
Kishon Vijay Abraham I <[email protected]>,
Andrey Konovalov <[email protected]>,
Hillf Danton <[email protected]>
Subject: [PATCH] PCI: endpoint: Fix uaf on unregistering driver
Date: Sat, 21 Sep 2019 09:58:28 +0800
Message-Id: <[email protected]>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Quoted 5 lines
Result: 250
And let me know you see it.
I do not think any of your messages hit the vger mailing lists, avoid html.
I have not received any patch and they are not in the mailing list archives either.
Please check your email/SMTP set-up. I do not apply patches that are not on linux-pci@vger, worst case you can attach the patch to your reply and I can send it on your behalf but we must do this quickly.
Lorenzo
Quoted 4 lines
Thanks
Hillf