[compiler-rt] [TSan] Fix potentially problematic shadow end calculations (PR #144648)

Kunqiu Chen via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 18 00:14:22 PDT 2025


Camsyn wrote:

If it is not appropriate to add a new utility function in `tsan_platform.h`, we can follow the example of `MemoryRangeSet` or `MemoryResetRange`, and
- add an assertion to guarantee `addr_end % kShadowCell == 0`; or 
- use `MemToShadow(RoundUpTo(addr_end, kShadowCell))` instead of `MemToShadow(addr_end, kShadowCell)`

for shadow end computation. 
However, due to the `DCHECK(IsAppMemImpl::Apply<Mapping>(x))` for `MemToShadow(x)`, it still throws an unreasonable error for `MemToShadow(AppMem::end)`, which should be a valid shadow end.


https://github.com/llvm/llvm-project/pull/144648


More information about the llvm-commits mailing list