All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] coroutine: use QEMU_DEFINE_STATIC_CO_TLS()
@ 2022-03-07 15:38 Stefan Hajnoczi
  2022-03-07 15:38 ` [PATCH 1/3] coroutine-ucontext: " Stefan Hajnoczi
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2022-03-07 15:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Stefan Weil, Stefan Hajnoczi

The coroutine implementation uses __thread variables internally. Compiler
optimizations may cache Thread-Local Storage values across
qemu_coroutine_yield(), leading to stale values being used after the coroutine
is re-entered from another thread.

Kevin pointed out that the coroutine implementation itself is vulnerable to
this problem. As a follow-up to my coroutine TLS patch series I'm sending these
patches to convert __thread variables to the new "qemu/coroutine-tls.h" macros
so they are safe.

Stefan Hajnoczi (3):
  coroutine-ucontext: use QEMU_DEFINE_STATIC_CO_TLS()
  coroutine: use QEMU_DEFINE_STATIC_CO_TLS()
  coroutine-win32: use QEMU_DEFINE_STATIC_CO_TLS()

 util/coroutine-ucontext.c | 38 +++++++++++++++++++++++-------------
 util/coroutine-win32.c    | 18 ++++++++++++-----
 util/qemu-coroutine.c     | 41 +++++++++++++++++++++++----------------
 3 files changed, 61 insertions(+), 36 deletions(-)

-- 
2.35.1




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

end of thread, other threads:[~2022-05-03 11:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 15:38 [PATCH 0/3] coroutine: use QEMU_DEFINE_STATIC_CO_TLS() Stefan Hajnoczi
2022-03-07 15:38 ` [PATCH 1/3] coroutine-ucontext: " Stefan Hajnoczi
2022-03-07 15:38 ` [PATCH 2/3] coroutine: " Stefan Hajnoczi
2022-03-07 15:38 ` [PATCH 3/3] coroutine-win32: " Stefan Hajnoczi
2022-03-07 16:03 ` [PATCH 0/3] coroutine: " Philippe Mathieu-Daudé
2022-03-16 13:28 ` Stefan Hajnoczi
2022-05-03 10:48 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.