DPDK patches and discussions
 help / color / mirror / Atom feed
* Unsafe memory access in testpmd
@ 2022-10-13 23:39 Stephen Hemminger
  2022-10-17  8:03 ` Ruifeng Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2022-10-13 23:39 UTC (permalink / raw)
  To: : Ruifeng Wang, Honnappa Nagarahalli; +Cc: dev

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.

The problem is that testpmd has grown in complexity and not
sure if this won't break other things.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Unsafe memory access in testpmd
  2022-10-13 23:39 Unsafe memory access in testpmd Stephen Hemminger
@ 2022-10-17  8:03 ` Ruifeng Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Ruifeng Wang @ 2022-10-17  8:03 UTC (permalink / raw)
  To: Stephen Hemminger, Honnappa Nagarahalli; +Cc: dev, nd

> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Friday, October 14, 2022 7:39 AM
> To: Ruifeng Wang <Ruifeng.Wang@arm.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>
> Cc: dev@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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-17  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13 23:39 Unsafe memory access in testpmd Stephen Hemminger
2022-10-17  8:03 ` Ruifeng Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).