Skip to contentSkip to conversation

eal: return error on devargs truncation in hotplug MP messages

PATCH Superseded Long Li 3 participants 11 messages Mar 25 – Jun 29 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

Long Li

author
#0 lore raw

PATCH 1/2 eal: return error on devargs truncation in hotplug MP messages

The EAL hotplug multi-process messaging uses a fixed-size buffer (EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments. When devargs exceeds this limit, strlcpy silently truncates the string. This causes secondary processes to receive incomplete devargs during hotplug re-add, leading to failed port re-initialization.

For example, a MANA PCI device with 6 mac= arguments:

mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06

produces a 131-byte devargs string that gets silently truncated to 127 bytes, losing the last MAC address.

Return -E2BIG from rte_dev_probe() and rte_dev_remove() when devargs would be truncated, instead of silently corrupting data.

---
 lib/eal/common/eal_common_dev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
lib/eal/common/eal_common_dev.c +11 -0
index 7185de0cb9..de24d14d28 100644
@@ -250,6 +250,11 @@ rte_dev_probe(const char *devargs)
 
 	memset(&req, 0, sizeof(req));
 	req.t = EAL_DEV_REQ_TYPE_ATTACH;
+	if (strlen(devargs) >= EAL_DEV_MP_DEV_ARGS_MAX_LEN) {
+		EAL_LOG(ERR, "devargs truncated (len %zu, max %d)",
+			strlen(devargs), EAL_DEV_MP_DEV_ARGS_MAX_LEN);
+		return -E2BIG;
+	}
 	strlcpy(req.devargs, devargs, EAL_DEV_MP_DEV_ARGS_MAX_LEN);
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
@@ -397,6 +402,12 @@ rte_dev_remove(struct rte_device *dev)
 
 	memset(&req, 0, sizeof(req));
 	req.t = EAL_DEV_REQ_TYPE_DETACH;
+	if (strlen(devargs) >= EAL_DEV_MP_DEV_ARGS_MAX_LEN) {
+		EAL_LOG(ERR, "devargs truncated (len %zu, max %d)",
+			strlen(devargs), EAL_DEV_MP_DEV_ARGS_MAX_LEN);
+		free(devargs);
+		return -E2BIG;
+	}
 	strlcpy(req.devargs, devargs, EAL_DEV_MP_DEV_ARGS_MAX_LEN);
 	free(devargs);
 
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 eal: add meson options for hotplug MP message buffer sizes

Add meson build options to allow increasing the multi-process hotplug message buffer limits at build time for deployments with many NICs:
- 'dev_mp_devargs_max_len' (default 128): max device args length
- 'mp_max_param_len' (default 256): max MP IPC message param length

Example: meson setup build -Ddev_mp_devargs_max_len=256 -Dmp_max_param_len=512

Guard the existing #defines with #ifndef so the meson-generated values from rte_build_config.h take precedence when overridden.

Add a static_assert to ensure eal_dev_mp_req fits within the MP message param buffer, catching misconfiguration at compile time.

Note: all primary and secondary processes must be built with the same values, as these sizes affect shared IPC message struct layouts.

---
 config/meson.build          | 2 ++
 lib/eal/common/hotplug_mp.h | 6 ++++++
 lib/eal/include/rte_eal.h   | 2 ++
 meson_options.txt           | 4 ++++
 4 files changed, 14 insertions(+)
config/meson.build +2 -0
index 9ba7b9a338..d0c117dbc9 100644
@@ -385,6 +385,8 @@ dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet'))
 dpdk_conf.set('RTE_ENABLE_STDATOMIC', get_option('enable_stdatomic'))
 dpdk_conf.set('RTE_ENABLE_TRACE_FP', get_option('enable_trace_fp'))
 dpdk_conf.set('RTE_PKTMBUF_HEADROOM', get_option('pkt_mbuf_headroom'))
+dpdk_conf.set('RTE_MP_MAX_PARAM_LEN', get_option('mp_max_param_len'))
+dpdk_conf.set('EAL_DEV_MP_DEV_ARGS_MAX_LEN', get_option('dev_mp_devargs_max_len'))
 # values which have defaults which may be overridden
 dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64)
 dpdk_conf.set('RTE_DRIVER_MEMPOOL_BUCKET_SIZE_KB', 64)
lib/eal/common/hotplug_mp.h +6 -0
index 7221284286..df8f987ea6 100644
@@ -6,13 +6,16 @@
 #define _HOTPLUG_MP_H_
 
 #include "rte_dev.h"
+#include "rte_eal.h"
 
 #define EAL_DEV_MP_ACTION_REQUEST      "eal_dev_mp_request"
 #define EAL_DEV_MP_ACTION_RESPONSE     "eal_dev_mp_response"
 
 #define EAL_DEV_MP_DEV_NAME_MAX_LEN RTE_DEV_NAME_MAX_LEN
 #define EAL_DEV_MP_BUS_NAME_MAX_LEN 32
+#ifndef EAL_DEV_MP_DEV_ARGS_MAX_LEN
 #define EAL_DEV_MP_DEV_ARGS_MAX_LEN 128
+#endif
 
 enum eal_dev_req_type {
 	EAL_DEV_REQ_TYPE_ATTACH,
@@ -27,6 +30,9 @@ struct eal_dev_mp_req {
 	int result;
 };
 
+static_assert(sizeof(struct eal_dev_mp_req) <= RTE_MP_MAX_PARAM_LEN,
+	"eal_dev_mp_req exceeds RTE_MP_MAX_PARAM_LEN, increase mp_max_param_len");
+
 /**
  * Register all mp action callbacks for hotplug.
  *
lib/eal/include/rte_eal.h +2 -0
index 7241f3be5d..aef431a88a 100644
@@ -158,7 +158,9 @@ bool rte_mp_disable(void);
 
 #define RTE_MP_MAX_FD_NUM	253  /* The max amount of fds (see SCM_MAX_FD) */
 #define RTE_MP_MAX_NAME_LEN	64   /* The max length of action name */
+#ifndef RTE_MP_MAX_PARAM_LEN
 #define RTE_MP_MAX_PARAM_LEN	256  /* The max length of param */
+#endif
 struct rte_mp_msg {
 	char name[RTE_MP_MAX_NAME_LEN];
 	int len_param;
meson_options.txt +4 -0
index e28d24054c..c6d07a3308 100644
@@ -48,6 +48,10 @@ option('mbuf_refcnt_atomic', type: 'boolean', value: true, description:
        'Atomically access the mbuf refcnt.')
 option('platform', type: 'string', value: 'native', description:
        'Platform to build, either "native", "generic" or a SoC. Please refer to the Linux build guide for more information.')
+option('mp_max_param_len', type: 'integer', value: 256, description:
+       'Maximum length of parameters in multi-process IPC messages.')
+option('dev_mp_devargs_max_len', type: 'integer', value: 128, description:
+       'Maximum length of device arguments in multi-process hotplug messages.')
 option('pkt_mbuf_headroom', type: 'integer', value: 128, description:
        'Default data offset (in bytes) in a packet buffer to leave room for additional headers.')
 option('enable_stdatomic', type: 'boolean', value: false, description:
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 2/2] eal: add meson options for hotplug MP message buffer sizes

Quoted 10 lines · On Tue, 24 Mar 2026 18:45:06 -0700 Long Li <[email protected]> wrote:

Add meson build options to allow increasing the multi-process hotplug message buffer limits at build time for deployments with many NICs:
- 'dev_mp_devargs_max_len' (default 128): max device args length
- 'mp_max_param_len' (default 256): max MP IPC message param length

Example: meson setup build -Ddev_mp_devargs_max_len=256 -Dmp_max_param_len=512

Guard the existing #defines with #ifndef so the meson-generated values from rte_build_config.h take precedence when overridden.

Quoted 7 lines

Add a static_assert to ensure eal_dev_mp_req fits within the MP message param buffer, catching misconfiguration at compile time.

Note: all primary and secondary processes must be built with the same values, as these sizes affect shared IPC message struct layouts.

The whole mp API needs some work on sizing.
Ideally the message would be variable size and not include all the file descriptors if not needed.

Even better it should be TLV encoded instead of fixed structure. But doing this probably has to wait until 26.11.

author
#3 lore raw

RE: [EXTERNAL] Re: [PATCH 2/2] eal: add meson options for hotplug MP message buffer sizes

Quoted 24 lines
Quoted 11 lines · On Tue, 24 Mar 2026 18:45:06 -0700 Long Li <[email protected]> wrote:

Add meson build options to allow increasing the multi-process hotplug message buffer limits at build time for deployments with many NICs:
- 'dev_mp_devargs_max_len' (default 128): max device args length
- 'mp_max_param_len' (default 256): max MP IPC message param length

Example: meson setup build -Ddev_mp_devargs_max_len=256 -Dmp_max_param_len=512

Guard the existing #defines with #ifndef so the meson-generated values from rte_build_config.h take precedence when overridden.

Quoted 7 lines

Add a static_assert to ensure eal_dev_mp_req fits within the MP message param buffer, catching misconfiguration at compile time.

Note: all primary and secondary processes must be built with the same values, as these sizes affect shared IPC message struct layouts.

Quoted 6 lines

The whole mp API needs some work on sizing.
Ideally the message would be variable size and not include all the file descriptors if not needed.

Even better it should be TLV encoded instead of fixed structure. But doing this probably has to wait until 26.11.

Will work on it.

Can you take the 1st patch in the series?
eal: return error on devargs truncation in hotplug MP messages.

Thanks,
Long

#4 lore raw
In reply to Long Li
Quoted 14 lines · Long Li

The EAL hotplug multi-process messaging uses a fixed-size buffer (EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments. When devargs exceeds this limit, strlcpy silently truncates the string. This causes secondary processes to receive incomplete devargs during hotplug re-add, leading to failed port re-initialization.

For example, a MANA PCI device with 6 mac= arguments:

mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06

Quoted 7 lines

produces a 131-byte devargs string that gets silently truncated to 127 bytes, losing the last MAC address.

Return -E2BIG from rte_dev_probe() and rte_dev_remove() when devargs would be truncated, instead of silently corrupting data.

Worth a Fixes: tag and Cc: stable.

Quoted 9 lines
---
 lib/eal/common/eal_common_dev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
lib/eal/common/eal_common_dev.c +0 -0
index 7185de0cb9..de24d14d28 100644

lib/eal/common/eal_common_dev.c rte_dev_probe(const char *devargs) · line 258

Quoted 9 lines
lib/eal/common/eal_common_dev.c +5 -0
@@ -250,6 +250,11 @@ rte_dev_probe(const char *devargs)
 
        memset(&req, 0, sizeof(req));
        req.t = EAL_DEV_REQ_TYPE_ATTACH;
+       if (strlen(devargs) >= EAL_DEV_MP_DEV_ARGS_MAX_LEN) {
+               EAL_LOG(ERR, "devargs truncated (len %zu, max %d)",
+                       strlen(devargs), EAL_DEV_MP_DEV_ARGS_MAX_LEN);
+               return -E2BIG;
+       }
        strlcpy(req.devargs, devargs, EAL_DEV_MP_DEV_ARGS_MAX_LEN);

Please move the check before the memset().

Quoted 5 lines
lib/eal/common/eal_common_dev.c +0 -0
        if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
@@ -397,6 +402,12 @@ rte_dev_remove(struct rte_device *dev)
 
        memset(&req, 0, sizeof(req));

lib/eal/common/eal_common_dev.c rte_dev_remove(struct rte_device *dev) · line 413

Quoted 10 lines
lib/eal/common/eal_common_dev.c +6 -0
        req.t = EAL_DEV_REQ_TYPE_DETACH;
+       if (strlen(devargs) >= EAL_DEV_MP_DEV_ARGS_MAX_LEN) {
+               EAL_LOG(ERR, "devargs truncated (len %zu, max %d)",
+                       strlen(devargs), EAL_DEV_MP_DEV_ARGS_MAX_LEN);
+               free(devargs);
+               return -E2BIG;
+       }
        strlcpy(req.devargs, devargs, EAL_DEV_MP_DEV_ARGS_MAX_LEN);
        free(devargs);
 

Why do we need to validate devargs on cleanup? Its length should have been validated during probe.

Signature · 1 line
David Marchand
author
#5 lore raw
Quoted 62 lines · Long Li
Quoted 13 lines

The EAL hotplug multi-process messaging uses a fixed-size buffer (EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments. When devargs exceeds this limit, strlcpy silently truncates the string. This causes secondary processes to receive incomplete devargs during hotplug re-add, leading to failed port re-initialization.

For example, a MANA PCI device with 6 mac= arguments:

mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06

Quoted 7 lines

produces a 131-byte devargs string that gets silently truncated to 127 bytes, losing the last MAC address.

Return -E2BIG from rte_dev_probe() and rte_dev_remove() when devargs would be truncated, instead of silently corrupting data.

Worth a Fixes: tag and Cc: stable.

Quoted 6 lines
---
 lib/eal/common/eal_common_dev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
(quoted diff) +0 -0

b/lib/eal/common/eal_common_dev.c index 7185de0cb9..de24d14d28

100644

lib/eal/common/eal_common_dev.c rte_dev_probe(const char *devargs) · line 258

Quoted 12 lines
lib/eal/common/eal_common_dev.c +5 -0
@@ -250,6 +250,11 @@ rte_dev_probe(const char *devargs)
 
        memset(&req, 0, sizeof(req));
        req.t = EAL_DEV_REQ_TYPE_ATTACH;
+       if (strlen(devargs) >= EAL_DEV_MP_DEV_ARGS_MAX_LEN) {
+               EAL_LOG(ERR, "devargs truncated (len %zu, max %d)",
+                       strlen(devargs), EAL_DEV_MP_DEV_ARGS_MAX_LEN);
+               return -E2BIG;
+       }
        strlcpy(req.devargs, devargs, EAL_DEV_MP_DEV_ARGS_MAX_LEN);

Please move the check before the memset().

Quoted 5 lines
lib/eal/common/eal_common_dev.c +1 -0
        if (rte_eal_process_type() != RTE_PROC_PRIMARY) { @@ -397,6
+402,12 @@ rte_dev_remove(struct rte_device *dev)
 

lib/eal/common/eal_common_dev.c rte_dev_remove(struct rte_device *dev) · line 412

Quoted 10 lines
lib/eal/common/eal_common_dev.c +6 -0
        memset(&req, 0, sizeof(req));
        req.t = EAL_DEV_REQ_TYPE_DETACH;
+       if (strlen(devargs) >= EAL_DEV_MP_DEV_ARGS_MAX_LEN) {
+               EAL_LOG(ERR, "devargs truncated (len %zu, max %d)",
+                       strlen(devargs), EAL_DEV_MP_DEV_ARGS_MAX_LEN);
+               free(devargs);
+               return -E2BIG;
+       }
        strlcpy(req.devargs, devargs, EAL_DEV_MP_DEV_ARGS_MAX_LEN);
        free(devargs);
Quoted 6 lines

Why do we need to validate devargs on cleanup? Its length should have been validated during probe.

--
David Marchand

I have sent v2 with all the comments addressed.

Thanks,

Long

author
#6 lore raw

PATCH v2 1/1 eal: return error on devargs truncation in hotplug MP messages

In reply to Long Li

The EAL hotplug multi-process messaging uses a fixed-size buffer (EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments. When devargs exceeds this limit, strlcpy silently truncates the string. This causes secondary processes to receive incomplete devargs during hotplug re-add, leading to failed port re-initialization.

For example, a MANA PCI device with 6 mac= arguments:

mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06

produces a 131-byte devargs string that gets silently truncated to 127 bytes, losing the last MAC address.

Return -E2BIG from rte_dev_probe() when devargs would be truncated, instead of silently corrupting data. rte_dev_remove() does not need the same check because the length was already validated at probe time.

Fixes 244d5130719c ("eal: enable hotplug on multi-process")

---
v2:
- Added Fixes: tag and Cc: [email protected].
- Moved the length check before memset() in rte_dev_probe().
- Removed the redundant length check from rte_dev_remove(); devargs length is already validated at probe time.
- Dropped the [2/2] meson-options patch from this series; it will be sent separately.

 lib/eal/common/eal_common_dev.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/eal/common/eal_common_dev.c +6 -0
index 48b631532a..f3fc4d585e 100644
@@ -271,6 +271,12 @@ rte_dev_probe(const char *devargs)
 	struct rte_device *dev;
 	int ret;
 
+	if (strlen(devargs) >= EAL_DEV_MP_DEV_ARGS_MAX_LEN) {
+		EAL_LOG(ERR, "devargs truncated (len %zu, max %d)",
+			strlen(devargs), EAL_DEV_MP_DEV_ARGS_MAX_LEN);
+		return -E2BIG;
+	}
+
 	memset(&req, 0, sizeof(req));
 	req.t = EAL_DEV_REQ_TYPE_ATTACH;
 	strlcpy(req.devargs, devargs, EAL_DEV_MP_DEV_ARGS_MAX_LEN);
Signature · 1 line
2.43.0
#7 lore raw
Quoted 17 lines · Long Li

The EAL hotplug multi-process messaging uses a fixed-size buffer (EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments. When devargs exceeds this limit, strlcpy silently truncates the string. This causes secondary processes to receive incomplete devargs during hotplug re-add, leading to failed port re-initialization.

For example, a MANA PCI device with 6 mac= arguments:

mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06

produces a 131-byte devargs string that gets silently truncated to 127 bytes, losing the last MAC address.

Quoted 8 lines

Return -E2BIG from rte_dev_probe() when devargs would be truncated, instead of silently corrupting data. rte_dev_remove() does not need the same check because the length was already validated at probe time.

Fixes 244d5130719c ("eal: enable hotplug on multi-process")

Re-reading the function, I have one concern about the fix.

I agree there is a bug with multiprocess.
But this change here also imposes a limit to 128 that was not there before, even if multiprocess is disabled.
It may not be a big problem, but we are calling the the multi process machinerie when unneeded (it ends up with a ENOTSUP).

I sent a small patch on this topic, could you have a look please?

https://inbox.dpdk.org/dev/[email protected]/

Signature · 1 line
David Marchand
author
#8 lore raw
Quoted 29 lines · Long Li
Quoted 16 lines

The EAL hotplug multi-process messaging uses a fixed-size buffer (EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments. When devargs exceeds this limit, strlcpy silently truncates the string. This causes secondary processes to receive incomplete devargs during hotplug re-add, leading to failed port re-initialization.

For example, a MANA PCI device with 6 mac= arguments:

mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06

produces a 131-byte devargs string that gets silently truncated to 127 bytes, losing the last MAC address.

Quoted 8 lines

Return -E2BIG from rte_dev_probe() when devargs would be truncated, instead of silently corrupting data. rte_dev_remove() does not need the same check because the length was already validated at probe time.

Fixes 244d5130719c ("eal: enable hotplug on multi-process")

Re-reading the function, I have one concern about the fix.

Quoted 7 lines

I agree there is a bug with multiprocess.
But this change here also imposes a limit to 128 that was not there before, even if multiprocess is disabled.
It may not be a big problem, but we are calling the the multi process machinerie when unneeded (it ends up with a ENOTSUP).

I sent a small patch on this topic, could you have a look please?

Thank you. I sent a review comment. This patch looks good.

I'll modify this patch to have the length check inside if (do_mp) block.

Long

Quoted 13 lines

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Finbox.
dpdk.org%2Fdev%2F20260625072254.4190227-1- david.marchand%40redhat.com%2F&data=05%7C02%7Clongli%40microsoft.c om%7Cf1cf337c1f014cc8b83b08ded28ab9d4%7C72f988bf86f141af91ab2d7cd 011db47%7C1%7C0%7C639179690431011725%7CUnknown%7CTWFpbGZsb3 d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOI joiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=7otoCpQbXZvcj5tSD QAJ77sdfu8U%2BgPwZZyYeTC%2F2lw%3D&reserved=0

--
David Marchand

#9 lore raw
Quoted 36 lines · Long Li
Quoted 36 lines · Long Li
Quoted 16 lines

The EAL hotplug multi-process messaging uses a fixed-size buffer (EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments. When devargs exceeds this limit, strlcpy silently truncates the string. This causes secondary processes to receive incomplete devargs during hotplug re-add, leading to failed port re-initialization.

For example, a MANA PCI device with 6 mac= arguments:

mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06

produces a 131-byte devargs string that gets silently truncated to 127 bytes, losing the last MAC address.

Quoted 8 lines

Return -E2BIG from rte_dev_probe() when devargs would be truncated, instead of silently corrupting data. rte_dev_remove() does not need the same check because the length was already validated at probe time.

Fixes 244d5130719c ("eal: enable hotplug on multi-process")

Re-reading the function, I have one concern about the fix.

I agree there is a bug with multiprocess.
But this change here also imposes a limit to 128 that was not there before, even if multiprocess is disabled.
It may not be a big problem, but we are calling the the multi process machinerie when unneeded (it ends up with a ENOTSUP).

Quoted 5 lines
Quoted 1 line

I sent a small patch on this topic, could you have a look please?

Thank you. I sent a review comment. This patch looks good.

I'll modify this patch to have the length check inside if (do_mp) block.

I did it directly.

With this adjustment:

Signature · 1 line
David Marchand
#10 lore raw
In reply to Long Li
Quoted 17 lines · Long Li

The EAL hotplug multi-process messaging uses a fixed-size buffer (EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments. When devargs exceeds this limit, strlcpy silently truncates the string. This causes secondary processes to receive incomplete devargs during hotplug re-add, leading to failed port re-initialization.

For example, a MANA PCI device with 6 mac= arguments:

mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06

produces a 131-byte devargs string that gets silently truncated to 127 bytes, losing the last MAC address.

Quoted 8 lines

Return -E2BIG from rte_dev_probe() when devargs would be truncated, instead of silently corrupting data. rte_dev_remove() does not need the same check because the length was already validated at probe time.

Fixes 244d5130719c ("eal: enable hotplug on multi-process")

Applied, thanks for the fix.

Signature · 1 line
David Marchand