forked from OSchip/llvm-project
msan: clean up and enable format string checking
Depends on D107981. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D107982
This commit is contained in:
parent
123c58ea26
commit
d26d5a0a3d
|
@ -40,9 +40,6 @@ endif()
|
|||
# Prevent clang from generating libc calls.
|
||||
append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS)
|
||||
|
||||
# Too many existing bugs, needs cleanup.
|
||||
append_list_if(COMPILER_RT_HAS_WNO_FORMAT -Wno-format MSAN_RTL_CFLAGS)
|
||||
|
||||
set(MSAN_RUNTIME_LIBRARIES)
|
||||
|
||||
# Static runtime library.
|
||||
|
|
|
@ -604,7 +604,7 @@ void __msan_set_alloca_origin4(void *a, uptr size, char *descr, uptr pc) {
|
|||
id = Origin::CreateStackOrigin(idx).raw_id();
|
||||
*id_ptr = id;
|
||||
if (print)
|
||||
Printf("First time: idx=%d id=%d %s %p \n", idx, id, descr + 4, pc);
|
||||
Printf("First time: idx=%d id=%d %s 0x%zx \n", idx, id, descr + 4, pc);
|
||||
}
|
||||
if (print)
|
||||
Printf("__msan_set_alloca_origin: descr=%s id=%x\n", descr + 4, id);
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace __msan {
|
|||
void ReportMapRange(const char *descr, uptr beg, uptr size) {
|
||||
if (size > 0) {
|
||||
uptr end = beg + size - 1;
|
||||
VPrintf(1, "%s : %p - %p\n", descr, beg, end);
|
||||
VPrintf(1, "%s : 0x%zx - 0x%zx\n", descr, beg, end);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ static bool CheckMemoryRangeAvailability(uptr beg, uptr size) {
|
|||
if (size > 0) {
|
||||
uptr end = beg + size - 1;
|
||||
if (!MemoryRangeIsAvailable(beg, end)) {
|
||||
Printf("FATAL: Memory range %p - %p is not available.\n", beg, end);
|
||||
Printf("FATAL: Memory range 0x%zx - 0x%zx is not available.\n", beg, end);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ static bool ProtectMemoryRange(uptr beg, uptr size, const char *name) {
|
|||
}
|
||||
if ((uptr)addr != beg) {
|
||||
uptr end = beg + size - 1;
|
||||
Printf("FATAL: Cannot protect memory range %p - %p (%s).\n", beg, end,
|
||||
name);
|
||||
Printf("FATAL: Cannot protect memory range 0x%zx - 0x%zx (%s).\n", beg,
|
||||
end, name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ bool InitShadow(bool init_origins) {
|
|||
|
||||
if (!MEM_IS_APP(&__msan_init)) {
|
||||
Printf("FATAL: Code %p is out of application range. Non-PIE build?\n",
|
||||
(uptr)&__msan_init);
|
||||
&__msan_init);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -201,13 +201,15 @@ void DescribeMemoryRange(const void *x, uptr size) {
|
|||
|
||||
Decorator d;
|
||||
Printf("%s", d.Warning());
|
||||
Printf("Shadow map of [%p, %p), %zu bytes:\n", start, end, end - start);
|
||||
Printf("Shadow map of [%p, %p), %zu bytes:\n",
|
||||
reinterpret_cast<void *>(start), reinterpret_cast<void *>(end),
|
||||
end - start);
|
||||
Printf("%s", d.Default());
|
||||
while (s < e) {
|
||||
// Line start.
|
||||
if (pos % 16 == 0) {
|
||||
for (int i = 0; i < 4; ++i) origin_ids[i] = -1;
|
||||
Printf("%p:", s);
|
||||
Printf("%p:", reinterpret_cast<void *>(s));
|
||||
}
|
||||
// Group start.
|
||||
if (pos % 4 == 0) {
|
||||
|
|
Loading…
Reference in New Issue