[compiler-rt] 23596fe - sanitizer_common: don't write into .rodata
Dmitry Vyukov via llvm-commits
llvm-commits at lists.llvm.org
Tue May 11 22:54:11 PDT 2021
Author: Dmitry Vyukov
Date: 2021-05-12T07:54:06+02:00
New Revision: 23596fece043fa04206dcd5b26b4ca832e6741db
URL: https://github.com/llvm/llvm-project/commit/23596fece043fa04206dcd5b26b4ca832e6741db
DIFF: https://github.com/llvm/llvm-project/commit/23596fece043fa04206dcd5b26b4ca832e6741db.diff
LOG: sanitizer_common: don't write into .rodata
setlocale interceptor imitates a write into result,
which may be located in .rodata section.
This is the only interceptor that tries to do this and
I think the intention was to initialize the range for msan.
So do that instead. Writing into .rodata shouldn't happen
(without crashing later on the actual write) and this
traps on my local tsan experiments.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D102161
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 39b494eb0f30..7867fccde390 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -3357,7 +3357,7 @@ INTERCEPTOR(char *, setlocale, int category, char *locale) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, locale, REAL(strlen)(locale) + 1);
char *res = REAL(setlocale)(category, locale);
if (res) {
- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
+ COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
unpoison_ctype_arrays(ctx);
}
return res;
More information about the llvm-commits
mailing list