[all-commits] [llvm/llvm-project] a67283: tsan: fix XMM register corruption in hacky call
Dmitry Vyukov via All-commits
all-commits at lists.llvm.org
Fri Nov 12 03:54:14 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a6728382c6de6211499ab83d708655947c8ce052
https://github.com/llvm/llvm-project/commit/a6728382c6de6211499ab83d708655947c8ce052
Author: Dmitry Vyukov <dvyukov at google.com>
Date: 2021-11-12 (Fri, 12 Nov 2021)
Changed paths:
M compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S
A compiler-rt/test/sanitizer_common/TestCases/frexp.cpp
Log Message:
-----------
tsan: fix XMM register corruption in hacky call
The compiler does not recognize HACKY_CALL as a call
(we intentionally hide it from the compiler so that it can
compile non-leaf functions as leaf functions).
To compensate for that hacky call thunk saves and restores
all caller-saved registers. However, it saves only
general-purposes registers and does not save XMM registers.
This is a latent bug that was masked up until a recent "NFC" commit
d736002e90 ("tsan: move memory access functions to a separate file"),
which allowed more inlining and exposed the 10-year bug.
Save and restore caller-saved XMM registers (all) as well.
Currently the bug manifests as e.g. frexp interceptor messes the
return value and the added test fails with:
i=8177 y=0.000000 exp=4
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D113742
More information about the All-commits
mailing list