[PATCH v3 03/19] net/xsc: add PCI device probe and remove
David Marchand
david.marchand at redhat.com
Wed Sep 18 09:28:56 CEST 2024
On Wed, Sep 18, 2024 at 8:10 AM WanRenyong <wanry at 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++) {
--
David Marchand
More information about the dev
mailing list