Skip to content

buffer-overflow in tests/net/tx_timestamp #8715

@aescolar

Description

@aescolar

tests/net/tx_timestamp segfaults when built for native_posix without COVERAGE (in some host platforms)
Running it with the address sanitizer reveals a buffer overflow in tests/net/tx_timestamp/src/main.c:326

zephyr/zephyr.exe 
WARNING: Using a test - not safe - entropy source
[net/ethernet] [DBG] ethernet_init: (0x080866a0): Initializing Ethernet L2 0x08082c34 for iface 0x08082b80
[net/ethernet] [DBG] ethernet_init: (0x080866a0): Initializing Ethernet L2 0x08082c48 for iface 0x08082ba0
[net/ethernet] [DBG] ethernet_init: (0x080866a0): Initializing Ethernet L2 0x08082c5c for iface 0x08082bc0
***** Booting Zephyr OS v1.9.0-5811-gd0fa634 *****
Running test suite net_tx_timestamp_test
===================================================================
starting test - address_setup
Interface 0x08082b80 (Ethernet) [0]
Interface 0x08082ba0 (Ethernet) [1]
Interface 0x08082bc0 (Ethernet) [2]
=================================================================
==31532==ERROR: AddressSanitizer: global-buffer-overflow on address 0x08080b48 at pc 0x080499f4 bp 0xf23fa158 sp 0xf23fa14c
WRITE of size 4 at 0x08080b48 thread T8
    #0 0x80499f3 in iface_cb [..]/tests/net/tx_timestamp/src/main.c:326

0x08080b48 is located 56 bytes to the left of global variable 'entropy_driver' defined in '[..]/subsys/random/rand32_entropy_device.c:11:17' (0x8080b80) of size 4
0x08080b48 is located 0 bytes to the right of global variable 'eth_interfaces' defined in '[..]/tests/net/tx_timestamp/src/main.c:58:23' (0x8080b40) of size 8
SUMMARY: AddressSanitizer: global-buffer-overflow /scratch/alpi/Zephyr/aescolar-ot/tests/net/tx_timestamp/src/main.c:326 in iface_cb

The segfault matches this overflow. (crash when trying to call the entropy driver)

Metadata

Metadata

Assignees

Labels

area: Networkingarea: TestsIssues related to a particular existing or missing test

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions