| 332 | MALLOC_AND_FREE)); |
| 333 | |
| 334 | void DangerousOperationThread(DangerousOp op, CountDownLatch* l) { |
| 335 | while (l->count()) { |
| 336 | switch (op) { |
| 337 | case DLOPEN_AND_CLOSE: { |
| 338 | // Check races against dlopen/dlclose. |
| 339 | void* v = dlopen("libc.so.6", RTLD_LAZY); |
| 340 | CHECK(v); |
| 341 | dlclose(v); |
| 342 | break; |
| 343 | } |
| 344 | |
| 345 | case DL_ITERATE_PHDR: { |
| 346 | // Check for races against dl_iterate_phdr. |
| 347 | dl_iterate_phdr(&DoNothingDlCallback, nullptr); |
| 348 | break; |
| 349 | } |
| 350 | |
| 351 | case GET_STACK_TRACE: { |
| 352 | // Check for reentrancy issues |
| 353 | GetStackTrace(); |
| 354 | break; |
| 355 | } |
| 356 | |
| 357 | case MALLOC_AND_FREE: { |
| 358 | // Check large allocations in tcmalloc. |
| 359 | volatile char* x = new char[1024 * 1024 * 2]; |
| 360 | delete[] x; |
| 361 | break; |
| 362 | } |
| 363 | default: |
| 364 | LOG(FATAL) << "unknown op"; |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | // Starts a thread performing dangerous operations and then gathers |
| 370 | // its stack trace in a loop trying to trigger races. |
no test coverage detected