Unsafe memory access in testpmd

Ruifeng Wang Ruifeng.Wang at arm.com
Mon Oct 17 10:03:13 CEST 2022


> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Friday, October 14, 2022 7:39 AM
> To: Ruifeng Wang <Ruifeng.Wang at arm.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli at arm.com>
> Cc: dev at dpdk.org
> Subject: Unsafe memory access in testpmd
> 
> Noticed that test-pmd is using a signal handler to exit.
> And that signal handle clears a flag "f_quit".
> But that variable is updated without atomic and is not volatile.
> 
> Simple fix to use atomic, would fix that part.
> But the signal_handler is calling a bunch of functions that are not safe in a signal
> handler.
> 
> The signal handler in testpmd should only be doing atomic update of f_quit.  All the
> cleanup logic needs to be moved to a place where thread is an safe state, like after
> exiting the forwarding loop in main thread.
Agree. 

> 
> The problem is that testpmd has grown in complexity and not sure if this won't break other
> things.
We can propose patches. Review and testing from the community are expected to cover as many cases as possible.


More information about the dev mailing list