Skip to content
Success

Changes

Summary

  1. Fix TSan shadow stack popping on some C stubs (#14213) (details)
Commit 25b6cc979dee394b5fb7e1eac24c2ad33317907b by noreply
Fix TSan shadow stack popping on some C stubs (#14213)

Until now, when an exception was raised from C and TSan was enabled, the
runtime would unwind the (real) stack and pop on TSan's shadow stack at
every frame, until the stack pointer was at a higher address than the
c_stack_link. This is incorrect: the correct condition is to stop when
the stack pointer is no longer between the c_stack_link and the stack
pointer's value before unwinding. This is because unwinding beyond the
c_stack_link means going back to an OCaml stack, which is on the heap,
and may be stored at an arbitrary address, higher or lower than the C
stack.

This change also makes the code clearer by using a for loop and
improving comments.

Co-authored-by: Gabriel Scherer <gabriel.scherer@gmail.com>
The file was modifiedruntime/tsan.c (diff)
The file was modifiedChanges (diff)