forked from OSchip/llvm-project
tsan: fix signal_longjmp test in debug mode
In debug mode tsan checks that user accesses access user memory. NULL is not user memory. So the test fails. Allocate real inaccessible memory for the test. llvm-svn: 218069
This commit is contained in:
parent
dfd8c74a98
commit
c0ae07e98c
|
@ -7,6 +7,7 @@
|
|||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
sigjmp_buf fault_jmp;
|
||||
volatile int fault_expected;
|
||||
|
@ -45,9 +46,12 @@ int main() {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
MUST_FAULT(((volatile int *volatile)0)[0] = 0);
|
||||
MUST_FAULT(((volatile int *volatile)0)[1] = 1);
|
||||
MUST_FAULT(((volatile int *volatile)0)[3] = 1);
|
||||
void *mem = mmap(0, 4096, PROT_NONE, MAP_PRIVATE | MAP_ANON,
|
||||
-1, 0);
|
||||
|
||||
MUST_FAULT(((volatile int *volatile)mem)[0] = 0);
|
||||
MUST_FAULT(((volatile int *volatile)mem)[1] = 1);
|
||||
MUST_FAULT(((volatile int *volatile)mem)[3] = 1);
|
||||
|
||||
// Ensure that tsan does not think that we are
|
||||
// in a signal handler.
|
||||
|
@ -55,6 +59,8 @@ int main() {
|
|||
((volatile int*)p)[1] = 1;
|
||||
free((void*)p);
|
||||
|
||||
munmap(p, 4096);
|
||||
|
||||
fprintf(stderr, "DONE\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue