forked from OSchip/llvm-project
[hwasan] report failing thread for invalid free.
Reviewed By: hctim Differential Revision: https://reviews.llvm.org/D107270
This commit is contained in:
parent
d3a0a65bf0
commit
150395c2bc
|
@ -560,8 +560,14 @@ void ReportInvalidFree(StackTrace *stack, uptr tagged_addr) {
|
||||||
Printf("%s", d.Error());
|
Printf("%s", d.Error());
|
||||||
uptr pc = stack->size ? stack->trace[0] : 0;
|
uptr pc = stack->size ? stack->trace[0] : 0;
|
||||||
const char *bug_type = "invalid-free";
|
const char *bug_type = "invalid-free";
|
||||||
Report("ERROR: %s: %s on address %p at pc %p\n", SanitizerToolName, bug_type,
|
const Thread *thread = GetCurrentThread();
|
||||||
untagged_addr, pc);
|
if (thread) {
|
||||||
|
Report("ERROR: %s: %s on address %p at pc %p on thread T%zd\n",
|
||||||
|
SanitizerToolName, bug_type, untagged_addr, pc, thread->unique_id());
|
||||||
|
} else {
|
||||||
|
Report("ERROR: %s: %s on address %p at pc %p on unknown thread\n",
|
||||||
|
SanitizerToolName, bug_type, untagged_addr, pc);
|
||||||
|
}
|
||||||
Printf("%s", d.Access());
|
Printf("%s", d.Access());
|
||||||
Printf("tags: %02x/%02x (ptr/mem)\n", ptr_tag, mem_tag);
|
Printf("tags: %02x/%02x (ptr/mem)\n", ptr_tag, mem_tag);
|
||||||
Printf("%s", d.Default());
|
Printf("%s", d.Default());
|
||||||
|
|
|
@ -11,7 +11,7 @@ int main() {
|
||||||
char * volatile x = (char*)malloc(40);
|
char * volatile x = (char*)malloc(40);
|
||||||
free(x);
|
free(x);
|
||||||
free(x);
|
free(x);
|
||||||
// CHECK: ERROR: HWAddressSanitizer: invalid-free on address
|
// CHECK: ERROR: HWAddressSanitizer: invalid-free on address {{.*}} at pc {{.*}} on thread T{{[0-9]+}}
|
||||||
// CHECK: tags: [[PTR_TAG:..]]/[[MEM_TAG:..]] (ptr/mem)
|
// CHECK: tags: [[PTR_TAG:..]]/[[MEM_TAG:..]] (ptr/mem)
|
||||||
// CHECK: freed by thread {{.*}} here:
|
// CHECK: freed by thread {{.*}} here:
|
||||||
// CHECK: previously allocated here:
|
// CHECK: previously allocated here:
|
||||||
|
|
Loading…
Reference in New Issue