Skip to contentSkip to conversation

eventdev: fix eth dev ID truncation in telemetry

PATCH In review Sergei Iashin 2 participants 4 messages Mar 4 – Mar 24

lore
Share & tools
lore
#0 lore raw

cover eventdev: fix eth dev ID truncation in telemetry

This series fixes an out-of-bounds access in eventdev rx adapter telemetry handlers caused by eth dev ID truncation.

Patches:
- eventdev: fix eth dev ID truncation in telemetry
- mailmap: add Sergei Iashin

Sergei Iashin (2):
eventdev: fix eth dev ID truncation in telemetry
mailmap: add Sergei Iashin

 .mailmap                                |  1 +
 lib/eventdev/rte_event_eth_rx_adapter.c | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
Signature · 1 line
2.39.5
#1 lore raw

PATCH 1/2 eventdev: fix eth dev ID truncation in telemetry

eth_dev_id is declared as int in handle_rxa_get_queue_conf(), handle_rxa_get_queue_stats(), handle_rxa_queue_stats_reset(), and handle_rxa_instance_get(), but is implicitly narrowed to uint16_t when passed to rte_eth_dev_is_valid_port() via RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET().
A value like 65535 + N passes validation as N, but is then used as-is as an array index, causing out-of-bounds access and SIGSEGV.

To reproduce (requires telemetry enabled):
echo "/eventdev/rxa_queue_conf,0,65536,0" | \
socat - UNIX-CONNECT:/var/run/dpdk/vpp/dpdk_telemetry.v2,type=5

Result:
SIGSEGV at handle_rxa_get_queue_conf + 0x34a, faulting address 0x50

This patch changes eth_dev_id from int to uint16_t to avoid truncation.

Fixes 74b034ff8172 ("eventdev/eth_rx: fix parameters parsing memory leak")
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
lib/eventdev/rte_event_eth_rx_adapter.c +8 -4
index d564e14b72..2183adce6f 100644
@@ -3827,7 +3827,8 @@ handle_rxa_get_queue_conf(const char *cmd __rte_unused,
 {
 	uint8_t rx_adapter_id;
 	uint16_t rx_queue_id;
-	int eth_dev_id, ret = -1;
+	uint16_t eth_dev_id;
+	int ret = -1;
 	char *token, *l_params;
 	struct rte_event_eth_rx_adapter_queue_conf queue_conf;
 
@@ -3899,7 +3900,8 @@ handle_rxa_get_queue_stats(const char *cmd __rte_unused,
 {
 	uint8_t rx_adapter_id;
 	uint16_t rx_queue_id;
-	int eth_dev_id, ret = -1;
+	uint16_t eth_dev_id;
+	int ret = -1;
 	char *token, *l_params;
 	struct rte_event_eth_rx_adapter_queue_stats q_stats;
 
@@ -3970,7 +3972,8 @@ handle_rxa_queue_stats_reset(const char *cmd __rte_unused,
 {
 	uint8_t rx_adapter_id;
 	uint16_t rx_queue_id;
-	int eth_dev_id, ret = -1;
+	uint16_t eth_dev_id;
+	int ret = -1;
 	char *token, *l_params;
 
 	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
@@ -4031,7 +4034,8 @@ handle_rxa_instance_get(const char *cmd __rte_unused,
 {
 	uint8_t instance_id;
 	uint16_t rx_queue_id;
-	int eth_dev_id, ret = -1;
+	uint16_t eth_dev_id;
+	int ret = -1;
 	char *token, *l_params;
 
 	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
Signature · 1 line
2.39.5
#2 lore raw

PATCH 2/2 mailmap: add Sergei Iashin

In reply to Sergei Iashin

Add my name and email mapping to .mailmap

---
 .mailmap | 1 +
 1 file changed, 1 insertion(+)
.mailmap +1 -0
index 6c4c977dde..85db3c11af 100644
@@ -1936,3 +1936,4 @@ Zoltan Kiss <[email protected]> <[email protected]>
 Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]>
+Sergei Iashin <[email protected]>
Signature · 1 line
2.39.5
#3 lore raw

Re: [PATCH 2/2] mailmap: add Sergei Iashin

Quoted 13 lines · Sergei Iashin

Add my name and email mapping to .mailmap

---
 .mailmap | 1 +
 1 file changed, 1 insertion(+)
.mailmap +0 -0
index 6c4c977dde..85db3c11af 100644

.mailmap Zoltan Kiss <[email protected]> <[email protected]> · line 1939

Quoted 4 lines
.mailmap +1 -0
@@ -1936,3 +1936,4 @@ Zoltan Kiss <[email protected]> <[email protected]>
 Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]>
+Sergei Iashin <[email protected]>

Fixed the name order by making it as alphabetical
Squashed with 1/2 patch
Applied to dpdk-next-eventdev/for-main. Thanks

Quoted 3 lines

--
2.39.5