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

Stephen Hemminger stephen at networkplumber.org
Tue Jul 29 23:34:20 CEST 2025


On Tue, 29 Jul 2025 01:42:29 -0400
Khadem Ullah <14pwcse1224 at uetpeshawar.edu.pk> wrote:

> Hi Stephen,
> 
> Many Thanks for the feedback.
> I have addressed all the comments on the patch, I have removed the unnecessary check in ethdev, the only one check in rte_ethdev seems to be a neccessary one, as without it, it can still generate segfault while secondary exists after primary.
> 
> Best regards,
> Khadem

Did a bunch more testing, and the problem is much deeper than your initial observation.

If primary process exits, the data structures all over secondary process are complete
garbage. Lots of use after free, linked lists that point to freed data ...

The root cause is that when secondary process starts, it requests current device
state (buses, devices, etc) from primary. When primary process exits it removes
all devices; but there is no mechanism to tell secondary!

For now, the only thing I can think of is to have the secondary process monitor
in testpmd do an immediate exit, no cleanups.


More information about the stable mailing list