DPDK patches and discussions
 help / color / mirror / Atom feed
From: "WanRenyong" <wanry@yunsilicon.com>
To: "David Marchand" <david.marchand@redhat.com>
Cc: <dev@dpdk.org>, <ferruh.yigit@amd.com>
Subject: Re: [PATCH v3 03/19] net/xsc: add PCI device probe and remove
Date: Wed, 18 Sep 2024 15:50:04 +0800	[thread overview]
Message-ID: <422e5a24-c7c1-4cf1-b40b-e49ef93c5a2c@yunsilicon.com> (raw)
In-Reply-To: <CAJFAV8zohdKq-5SxtHiu6+0=Ow5njR394g2MCur9kkG3TDGsow@mail.gmail.com>

On 2024/9/18 15:28, David Marchand wrote:
> On Wed, Sep 18, 2024 at 8:10 AM WanRenyong <wanry@yunsilicon.com> wrote:
>> +static const struct rte_pci_id xsc_ethdev_pci_id_map[] = {
>> +       { RTE_PCI_DEVICE(XSC_PCI_VENDOR_ID, XSC_PCI_DEV_ID_MS) },
> You need to null terminate this array with something like:
>          { .vendor_id = 0, /* sentinel */ },
>
> Otherwise the bus pci code may read a next symbol or data present in
> the .data section.
>
> ASan caught this issue when running the unit tests:
>
> ==70261==ERROR: AddressSanitizer: global-buffer-overflow on address
> 0x7f8e46bf45f0 at pc 0x7f8e56be523b bp 0x7ffe2ef88ca0 sp
> 0x7ffe2ef88c98
> READ of size 2 at 0x7f8e46bf45f0 thread T0
>      #0 0x7f8e56be523a in rte_pci_match
> /home/runner/work/dpdk/dpdk/build/../drivers/bus/pci/pci_common.c:178:47
>      #1 0x7f8e56be523a in rte_pci_probe_one_driver
> /home/runner/work/dpdk/dpdk/build/../drivers/bus/pci/pci_common.c:223:7
>      #2 0x7f8e56be523a in pci_probe_all_drivers
> /home/runner/work/dpdk/dpdk/build/../drivers/bus/pci/pci_common.c:391:8
>      #3 0x7f8e56be3297 in pci_probe
> /home/runner/work/dpdk/dpdk/build/../drivers/bus/pci/pci_common.c:418:9
>      #4 0x7f8e56fe9ea8 in rte_bus_probe
> /home/runner/work/dpdk/dpdk/build/../lib/eal/common/eal_common_bus.c:78:9
>      #5 0x7f8e570580d1 in rte_eal_init
> /home/runner/work/dpdk/dpdk/build/../lib/eal/linux/eal.c:1288:6
>      #6 0x5573a597d65d in main
> /home/runner/work/dpdk/dpdk/build/../app/test/test.c:145:9
>      #7 0x7f8e55829d8f in __libc_start_call_main
> csu/../sysdeps/nptl/libc_start_call_main.h:58:16
>      #8 0x7f8e55829e3f in __libc_start_main csu/../csu/libc-start.c:392:3
>      #9 0x5573a58bf114 in _start
> (/home/runner/work/dpdk/dpdk/build/app/dpdk-test+0x1e9114) (BuildId:
> 8d4741d712c15395a67005124e1f908d96acf7ff)
>
>
> 172 int
> 173 rte_pci_match(const struct rte_pci_driver *pci_drv,
> 174               const struct rte_pci_device *pci_dev)
> 175 {
> 176         const struct rte_pci_id *id_table;
> 177
> 178         for (id_table = pci_drv->id_table; id_table->vendor_id !=
> 0;
> 179              id_table++) {
>
>

Thanks for review, will fix it in the next version.

-- 
Thanks,
WanRenyong

      reply	other threads:[~2024-09-18  7:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18  6:09 WanRenyong
2024-09-18  7:28 ` David Marchand
2024-09-18  7:50   ` WanRenyong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=422e5a24-c7c1-4cf1-b40b-e49ef93c5a2c@yunsilicon.com \
    --to=wanry@yunsilicon.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).