brintos

brintos / llvm-project-archived public Read only

0
0
Text · 533 B · e95f4c8 Raw
23 lines · c
1// RUN: %clang_hwasan %s -o %t && %env_hwasan_opts=random_tags=1 %run %t2 3#include <pthread.h>4#include <sanitizer/hwasan_interface.h>5#include <stdio.h>6#include <stdlib.h>7#include <string.h>8 9void *ThreadFn(void *) {10  strerror_l(-1, 0);11  __hwasan_enable_allocator_tagging();12  // This will trigger memory deallocation in __strerror_thread_freeres,13  // at a point when HwasanThread is already gone.14  return NULL;15}16 17int main() {18  pthread_t t;19  pthread_create(&t, NULL, ThreadFn, NULL);20  pthread_join(t, NULL);21  return 0;22}23