[PATCH v2] lib/ethdev: fix segfault in secondary process by validating dev_private pointer

Stephen Hemminger stephen at networkplumber.org
Wed Jul 23 16:21:08 CEST 2025


On Wed, 23 Jul 2025 00:50:22 -0400
Khadem Ullah <14pwcse1224 at uetpeshawar.edu.pk> wrote:

> In secondary processes, directly accessing 'dev->data->dev_private' can
> cause a segmentation fault if the primary process has exited or if the
> shared memory is no longer accessible.
> 
> This patch adds a safety check using rte_mem_virt2phy(), with an
> unlikely() branch hint to minimize performance impact in the fast path.
> This ensures 'dev_private' is still valid before accessing it.
> 
> Fixes: bdad90d12ec8 ("ethdev: change device info get callback to return int")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Khadem Ullah <14pwcse1224 at uetpeshawar.edu.pk>
> ---

No still a band-aid solution, and it is depending on side effects.

Is your secondary process monitoring for primary process exiting?

If it is, then lets fix the monitoring path.


More information about the dev mailing list