[msan] Print both shadow and user address

before:
00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00
Shadow map of [0x211000000005, 0x21100000012e), 297 bytes:
now:
0x2f60d213ac10[0x7f60d213ac10]  00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00
Shadow map [0x211000000005, 0x21100000012e) of [0x711000000005, 0x711000000135), 297 bytes:

Differential Revision: https://reviews.llvm.org/D111261
This commit is contained in:
Vitaly Buka 2021-10-06 13:10:35 -07:00
parent 4281946390
commit ef85ea9a4f
7 changed files with 18 additions and 14 deletions

View file

@ -515,6 +515,7 @@ void __msan_dump_shadow(const void *x, uptr size) {
}
unsigned char *s = (unsigned char*)MEM_TO_SHADOW(x);
Printf("%p[%p] ", s, x);
for (uptr i = 0; i < size; i++)
Printf("%x%x ", s[i] >> 4, s[i] & 0xf);
Printf("\n");

View file

@ -201,15 +201,18 @@ void DescribeMemoryRange(const void *x, uptr size) {
Decorator d;
Printf("%s", d.Warning());
Printf("Shadow map of [%p, %p), %zu bytes:\n",
uptr start_x = reinterpret_cast<uptr>(x);
Printf("Shadow map [%p, %p) of [%p, %p), %zu bytes:\n",
reinterpret_cast<void *>(start), reinterpret_cast<void *>(end),
end - start);
reinterpret_cast<void *>(start_x),
reinterpret_cast<void *>(start_x + end - start), 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:", reinterpret_cast<void *>(s));
Printf("%p[%p]:", reinterpret_cast<void *>(s),
reinterpret_cast<void *>(start_x - start + s));
}
// Group start.
if (pos % 4 == 0) {

View file

@ -16,7 +16,7 @@ int main(void) {
#ifdef POSITIVE
__msan_check_mem_is_initialized(p + 5, 20);
// CHECK: Uninitialized bytes in __msan_check_mem_is_initialized at offset 5 inside [0x{{.*}}, 20)
// CHECK-VERBOSE: Shadow map of [0x{{.*}}, 0x{{.*}}), 20 bytes:
// CHECK-VERBOSE: Shadow map [0x{{.*}}, 0x{{.*}}) of [0x{{.*}}, 0x{{.*}}), 20 bytes:
// CHECK-VERBOSE: 0x{{.*}}: ..000000 0000ffff 00000000 00000000
// CHECK-VERBOSE: 0x{{.*}}: 00000000 00...... ........ ........

View file

@ -18,5 +18,5 @@ int main(void) {
return 0;
}
// CHECK: ff ff ff ff ff
// CHECK: 00 00 00
// CHECK: 0x{{[0-9a-f]+}}[0x{{[0-9a-f]+}}] ff ff ff ff ff
// CHECK: 0x{{[0-9a-f]+}}[0x{{[0-9a-f]+}}] 00 00 00

View file

@ -52,7 +52,7 @@ int main(void) {
return 0;
}
// CHECK: Shadow map of [{{.*}}), 297 bytes:
// CHECK: Shadow map [0x{{.*}}, 0x{{.*}}) of [0x{{.*}}, 0x{{.*}}), 297 bytes:
// CHECK-NO-ORIGINS: 0x{{.*}}: ..00ffff 00000000 ffffffff ffffffff
// CHECK-NO-ORIGINS: 0x{{.*}}: ffffffff ffffffff ffffffff ffffffff

View file

@ -22,28 +22,28 @@ int main(void) {
return 0;
}
// CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 1 bytes:
// CHECK: Shadow map [0x{{.*}}, 0x{{.*}}) of [0x{{.*}}, 0x{{.*}}), 1 bytes:
// CHECK-NO-ORIGINS: 0x{{.*}}: ff...... ........ ........ ........
// CHECK-ORIGINS: 0x{{.*}}: ff...... ........ ........ ........ |A . . .|
// CHECK-ORIGINS: Origin A (origin_id {{.*}}):
// CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 1 bytes:
// CHECK: Shadow map [0x{{.*}}, 0x{{.*}}) of [0x{{.*}}, 0x{{.*}}), 1 bytes:
// CHECK-NO-ORIGINS: 0x{{.*}}: ..ff.... ........ ........ ........
// CHECK-ORIGINS: 0x{{.*}}: ..ff.... ........ ........ ........ |A . . .|
// CHECK-ORIGINS: Origin A (origin_id {{.*}}):
// CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 1 bytes:
// CHECK: Shadow map [0x{{.*}}, 0x{{.*}}) of [0x{{.*}}, 0x{{.*}}), 1 bytes:
// CHECK-NO-ORIGINS: 0x{{.*}}: ......ff ........ ........ ........
// CHECK-ORIGINS: 0x{{.*}}: ......ff ........ ........ ........ |A . . .|
// CHECK-ORIGINS: Origin A (origin_id {{.*}}):
// CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 1 bytes:
// CHECK: Shadow map [0x{{.*}}, 0x{{.*}}) of [0x{{.*}}, 0x{{.*}}), 1 bytes:
// CHECK-NO-ORIGINS: 0x{{.*}}: ......ff ........ ........ ........
// CHECK-ORIGINS: 0x{{.*}}: ......ff ........ ........ ........ |A . . .|
// CHECK-ORIGINS: Origin A (origin_id {{.*}}):
// CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 0 bytes:
// CHECK: Shadow map [0x{{.*}}, 0x{{.*}}) of [0x{{.*}}, 0x{{.*}}), 0 bytes:
// CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 3 bytes:
// CHECK: Shadow map [0x{{.*}}, 0x{{.*}}) of [0x{{.*}}, 0x{{.*}}), 3 bytes:
// CHECK-NO-ORIGINS: 0x{{.*}}: 000000.. ........ ........ ........
// CHECK-ORIGINS: 0x{{.*}}: 000000.. ........ ........ ........ |. . . .|

View file

@ -12,5 +12,5 @@ int main(void) {
return 0;
}
// CHECK: Shadow map of [{{.*}}), 4 bytes:
// CHECK: Shadow map [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}) of [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}), 4 bytes:
// CHECK: 0x{{.*}}: 77654321 ........ ........ ........