Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1702273 > unrolled thread
| Started by | Anton Vasilyev <vasilyev@ispras.ru> |
|---|---|
| First post | 2017-08-02 19:00 +0200 |
| Last post | 2017-08-03 09:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
net: thunderx: Buffer overwrite on bgx_probe Anton Vasilyev <vasilyev@ispras.ru> - 2017-08-02 19:00 +0200
Re: net: thunderx: Buffer overwrite on bgx_probe Sunil Kovvuri <sunil.kovvuri@gmail.com> - 2017-08-03 09:40 +0200
| From | Anton Vasilyev <vasilyev@ispras.ru> |
|---|---|
| Date | 2017-08-02 19:00 +0200 |
| Subject | net: thunderx: Buffer overwrite on bgx_probe |
| Message-ID | <ua5a2-3XB-21@gated-at.bofh.it> |
Hello.
While searching for memory errors in Linux kernel I've come across
drivers/net/ethernet/cavium/thunder/thunder_bgx.ko module.
I've found buffer overwrite at bgx_probe():
Consider device PCI_SUBSYS_DEVID_83XX_BGX.
max_bgx_per_node is set to 4 by set_max_bgx_per_node().
Then on branch:
pci_read_config_word(pdev, PCI_DEVICE_ID, &sdevid);
if (sdevid != PCI_DEVICE_ID_THUNDER_RGX) {
bgx->bgx_id = (pci_resource_start(pdev,
PCI_CFG_REG_BAR_NUM) >> 24) & BGX_ID_MASK;
bgx->bgx_id += nic_get_node_id(pdev) * max_bgx_per_node;
bgx->bgx_id could achieve value 3 + 3 * 4 = 15,
which lead to buffer overwrite on
bgx_vnic[bgx->bgx_id] = bgx;
Question: is it enough for fix to change bgx_vnic's size?
Found by Linux Driver Verification project (linuxtesting.org).
--
Anton Vasilyev
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: vasilyev@ispras.ru
[toc] | [next] | [standalone]
| From | Sunil Kovvuri <sunil.kovvuri@gmail.com> |
|---|---|
| Date | 2017-08-03 09:40 +0200 |
| Message-ID | <uaiTD-5ar-3@gated-at.bofh.it> |
| In reply to | #1702273 |
On Wed, Aug 2, 2017 at 10:29 PM, Anton Vasilyev <vasilyev@ispras.ru> wrote:
> Hello.
>
> While searching for memory errors in Linux kernel I've come across
> drivers/net/ethernet/cavium/thunder/thunder_bgx.ko module.
>
> I've found buffer overwrite at bgx_probe():
> Consider device PCI_SUBSYS_DEVID_83XX_BGX.
> max_bgx_per_node is set to 4 by set_max_bgx_per_node().
> Then on branch:
> pci_read_config_word(pdev, PCI_DEVICE_ID, &sdevid);
> if (sdevid != PCI_DEVICE_ID_THUNDER_RGX) {
> bgx->bgx_id = (pci_resource_start(pdev,
> PCI_CFG_REG_BAR_NUM) >> 24) & BGX_ID_MASK;
> bgx->bgx_id += nic_get_node_id(pdev) * max_bgx_per_node;
>
> bgx->bgx_id could achieve value 3 + 3 * 4 = 15,
No, this will never be the case, the maximum no of NUMA nodes supported
on these platforms is 2, so the bgx_id will never go beyond 7.
And the platform 83XX taken as an example deosn't support NUMA, it's only
88XX which supports NUMA and maximum no of BGX supported on that is only 2.
> which lead to buffer overwrite on
> bgx_vnic[bgx->bgx_id] = bgx;
>
> Question: is it enough for fix to change bgx_vnic's size?
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> --
> Anton Vasilyev
> Linux Verification Center, ISPRAS
> web: http://linuxtesting.org
> e-mail: vasilyev@ispras.ru
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thanks,
Sunil.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web