Alexander Markov
f37db8487f
[vm] Double check if thread interrupts are enabled after thread is interrupted
...
Thread interrupts can be disabled after thread interrupter decided to
interrupt a thread but before thread actually receives and handles
a signal.
This may cause a data race accessing a Sample between profiler which
initializes and adds a Sample and the main thread using
Profiler::sample_block_buffer() in the profiler unit tests.
This is a possible fix for the following benign TSAN error:
WARNING: ThreadSanitizer: data race (pid=5824)
Write of size 4 at 0x7f53e8e53a98 by thread T6:
#0 dart::Sample::set_thread_task(dart::Thread::TaskKind) out/ReleaseTSANX64/../../runtime/vm/profiler.h:325:12 (run_vm_tests+0x292cab2)
#1 dart::SetupSample(dart::Thread*, bool, unsigned long) out/ReleaseTSANX64/../../runtime/vm/profiler.cc:1226:11 (run_vm_tests+0x292cab2)
#2 dart::Profiler::SampleThread(dart::Thread*, dart::InterruptedThreadState const&) out/ReleaseTSANX64/../../runtime/vm/profiler.cc:1381:7 (run_vm_tests+0x292cab2)
#3 dart::ThreadInterrupterLinux::ThreadInterruptSignalHandler(int, siginfo_t*, void*) out/ReleaseTSANX64/../../runtime/vm/thread_interrupter_linux.cc:44:5 (run_vm_tests+0x2a064b0)
#4 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, int, __sanitizer::__sanitizer_siginfo*, void*) ../staging/llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:2122:5 (run_vm_tests+0x1fc057f)
#5 dart::Mutex::Unlock() out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:367:16 (run_vm_tests+0x2924b89)
Previous read of size 4 at 0x7f53e8e53a98 by main thread:
#0 dart::Sample::head_sample() const out/ReleaseTSANX64/../../runtime/vm/profiler.h:350:59 (run_vm_tests+0x22c70e7)
#1 dart::SampleBuffer::VisitSamples(dart::SampleVisitor*) out/ReleaseTSANX64/../../runtime/vm/profiler.h:589:20 (run_vm_tests+0x22c70e7)
#2 dart::SampleBlockBuffer::VisitSamples(dart::SampleVisitor*) out/ReleaseTSANX64/../../runtime/vm/profiler.h:752:18 (run_vm_tests+0x22c70e7)
#3 dart::Dart_TestHelperProfiler_GetSourceReport(dart::Thread*) out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2241:26 (run_vm_tests+0x22c70e7)
#4 dart::Dart_TestProfiler_GetSourceReport() out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2206:1 (run_vm_tests+0x22c70e7)
#5 dart::TestCase::Run() out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:53:3 (run_vm_tests+0x203fe6c)
--- Re-run this test:
python3 tools/test.py -n vm-tsan-linux-release-x64 vm/cc/Profiler_GetSourceReport
Also, this change is a possible fix for https://github.com/dart-lang/sdk/issues/44089 .
TEST=ci
Change-Id: I8ad87c340580325cbd6e22b5f068e1e33b0a7d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409460
Reviewed-by: Ryan Macnak <rmacnak@google.com >
Commit-Queue: Alexander Markov <alexmarkov@google.com >
2025-02-12 14:48:28 -08:00
..
2025-02-12 08:03:12 -08:00
2024-07-23 10:43:43 +00:00
2025-02-10 09:38:42 -08:00
2023-04-17 15:58:28 +00:00
2024-03-25 10:35:49 +00:00
2024-11-05 13:50:08 +00:00
2024-11-29 20:28:45 +00:00
2023-04-20 17:42:06 +00:00
2023-06-06 02:07:58 +00:00
2023-04-10 18:15:12 +00:00
2023-05-24 08:42:14 +00:00
2023-07-03 12:29:15 +00:00
2025-02-03 16:02:38 -08:00
2024-06-18 09:10:00 +00:00
2023-09-05 21:47:59 +00:00
2024-12-04 14:36:46 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2024-08-28 08:52:19 +00:00
2024-11-13 20:20:19 +00:00
2023-04-12 22:18:54 +00:00
2024-04-17 19:14:41 +00:00
2024-07-26 19:26:11 +00:00
2025-02-03 12:55:53 -08:00
2024-04-11 17:55:26 +00:00
2023-04-10 18:15:12 +00:00
2024-04-19 08:10:18 +00:00
2024-04-19 08:10:18 +00:00
2024-11-08 04:36:23 +00:00
2024-12-09 15:19:43 +00:00
2024-09-11 14:18:06 +00:00
2024-10-08 17:28:49 +00:00
2023-12-15 15:25:29 +00:00
2025-01-15 08:13:52 -08:00
2025-01-15 08:13:52 -08:00
2024-08-15 14:09:52 +00:00
2024-10-24 03:24:08 +00:00
2024-06-10 20:38:30 +00:00
2024-03-13 14:33:48 +00:00
2023-06-28 11:48:26 +00:00
2023-04-10 18:15:12 +00:00
2023-10-12 16:16:21 +00:00
2024-08-26 20:35:18 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2024-11-05 22:16:59 +00:00
2023-11-28 13:15:56 +00:00
2024-01-09 20:28:55 +00:00
2023-04-10 18:15:12 +00:00
2024-12-04 14:36:46 +00:00
2024-11-12 20:28:50 +00:00
2024-09-09 13:44:04 +00:00
2023-11-30 16:42:28 +00:00
2024-08-29 16:45:00 +00:00
2024-09-12 15:15:08 +00:00
2024-09-12 15:15:08 +00:00
2024-10-28 17:08:39 +00:00
2024-11-13 00:57:46 +00:00
2024-08-29 16:45:00 +00:00
2023-09-04 14:38:27 +00:00
2023-11-28 13:15:56 +00:00
2023-06-23 20:35:00 +00:00
2024-02-15 23:08:48 +00:00
2023-09-12 16:22:19 +00:00
2023-06-23 20:35:00 +00:00
2023-06-23 20:35:00 +00:00
2023-06-23 20:35:00 +00:00
2024-03-14 21:48:59 +00:00
2023-05-22 16:43:04 +00:00
2023-04-10 21:38:57 +00:00
2023-04-10 21:38:57 +00:00
2023-04-10 21:38:57 +00:00
2024-03-15 19:26:13 +00:00
2024-12-04 14:36:46 +00:00
2025-02-11 20:09:11 -08:00
2025-02-11 20:09:11 -08:00
2024-08-14 17:09:07 +00:00
2023-07-26 21:53:49 +00:00
2024-04-17 19:14:41 +00:00
2024-12-03 23:24:48 +00:00
2025-01-27 06:46:05 -08:00
2025-01-27 06:46:05 -08:00
2025-02-03 12:55:53 -08:00
2024-12-09 23:02:48 +00:00
2023-04-12 22:18:54 +00:00
2024-08-19 21:46:26 +00:00
2024-01-22 16:07:39 +00:00
2024-12-04 14:36:46 +00:00
2024-10-08 17:23:43 +00:00
2024-08-19 21:46:26 +00:00
2023-04-10 18:15:12 +00:00
2024-11-15 17:33:11 +00:00
2024-11-15 17:33:11 +00:00
2023-11-07 16:13:11 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2024-10-02 19:39:00 +00:00
2023-05-31 08:06:08 +00:00
2024-11-19 17:49:09 +00:00
2024-09-11 12:51:23 +00:00
2024-12-04 14:36:46 +00:00
2024-11-15 16:46:03 +00:00
2024-11-15 16:46:03 +00:00
2024-11-19 08:54:03 +00:00
2024-11-19 08:54:03 +00:00
2023-12-15 15:25:29 +00:00
2023-12-15 15:25:29 +00:00
2024-04-17 19:14:41 +00:00
2024-06-20 17:08:10 +00:00
2024-06-20 17:08:10 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2025-01-08 00:26:40 -08:00
2023-04-10 18:15:12 +00:00
2025-01-08 00:26:40 -08:00
2025-01-08 00:26:40 -08:00
2023-10-20 19:45:49 +00:00
2024-08-15 14:09:52 +00:00
2024-10-28 22:41:39 +00:00
2024-04-17 19:14:41 +00:00
2023-04-10 18:15:12 +00:00
2023-06-23 20:35:00 +00:00
2023-06-23 20:35:00 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2024-04-17 19:14:41 +00:00
2024-04-17 19:14:41 +00:00
2024-06-27 18:29:58 +00:00
2024-10-02 19:39:00 +00:00
2024-08-27 19:03:02 +00:00
2023-11-28 13:15:56 +00:00
2023-04-12 22:18:54 +00:00
2023-11-28 13:15:56 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-11-28 13:15:56 +00:00
2023-04-12 22:18:54 +00:00
2024-04-17 19:14:41 +00:00
2023-04-12 22:18:54 +00:00
2024-12-13 06:29:44 -08:00
2024-09-09 13:44:04 +00:00
2024-12-04 14:36:46 +00:00
2024-12-19 11:03:59 -08:00
2024-10-07 22:29:49 +00:00
2024-12-04 14:36:46 +00:00
2025-02-11 20:09:11 -08:00
2025-02-11 20:09:11 -08:00
2024-08-28 16:41:50 +00:00
2024-08-28 16:41:50 +00:00
2024-12-04 14:36:46 +00:00
2024-03-20 20:08:13 +00:00
2023-04-17 15:58:28 +00:00
2024-04-17 19:14:41 +00:00
2024-12-18 06:10:31 -08:00
2025-01-02 14:27:39 -08:00
2024-06-10 20:38:30 +00:00
2025-01-15 08:13:52 -08:00
2025-01-15 08:13:52 -08:00
2024-04-17 19:14:41 +00:00
2024-04-17 19:14:41 +00:00
2024-08-19 14:04:47 +00:00
2024-08-19 14:04:47 +00:00
2023-04-10 18:15:12 +00:00
2023-04-20 17:42:06 +00:00
2023-04-10 18:15:12 +00:00
2023-06-29 08:04:20 +00:00
2023-06-29 08:04:20 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2024-09-12 15:16:12 +00:00
2024-09-12 15:16:12 +00:00
2024-09-12 15:16:12 +00:00
2024-08-19 21:46:26 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-07-26 21:53:49 +00:00
2025-01-22 07:48:37 -08:00
2025-01-22 07:48:37 -08:00
2023-04-10 18:15:12 +00:00
2024-12-02 18:13:44 +00:00
2025-01-23 07:20:19 -08:00
2024-08-19 21:46:26 +00:00
2024-08-14 17:09:07 +00:00
2023-09-20 16:08:51 +00:00
2024-09-18 21:07:59 +00:00
2024-09-18 21:07:59 +00:00
2024-05-16 16:33:52 +00:00
2025-01-16 07:47:51 -08:00
2024-05-02 16:36:20 +00:00
2024-10-16 21:25:17 +00:00
2023-04-10 18:15:12 +00:00
2024-12-10 21:48:58 +00:00
2023-12-14 22:48:49 +00:00
2024-09-25 17:28:44 +00:00
2024-08-28 16:41:50 +00:00
2024-08-28 16:41:50 +00:00
2024-10-07 22:29:49 +00:00
2024-08-15 14:09:52 +00:00
2024-08-19 14:04:47 +00:00
2024-12-18 14:04:01 -08:00
2025-01-08 00:26:40 -08:00
2025-02-12 10:38:48 -08:00
2025-02-04 08:13:29 -08:00
2024-11-11 17:47:40 +00:00
2024-11-11 17:47:40 +00:00
2024-11-11 17:47:40 +00:00
2024-04-19 08:10:18 +00:00
2023-04-10 18:15:12 +00:00
2024-09-24 22:41:40 +00:00
2024-08-07 12:59:35 +00:00
2024-09-24 22:41:40 +00:00
2024-08-07 12:59:35 +00:00
2024-09-24 22:41:40 +00:00
2024-08-07 12:59:35 +00:00
2024-09-24 22:41:40 +00:00
2024-08-07 12:59:35 +00:00
2024-09-24 22:41:40 +00:00
2024-08-07 12:59:35 +00:00
2024-09-24 22:41:40 +00:00
2024-08-07 12:59:35 +00:00
2024-10-08 20:36:14 +00:00
2024-09-24 22:41:40 +00:00
2025-01-16 07:47:51 -08:00
2024-04-19 08:10:18 +00:00
2024-04-19 08:10:18 +00:00
2024-12-18 09:30:10 -08:00
2023-08-04 11:07:46 +00:00
2024-04-15 11:10:23 +00:00
2024-04-15 11:10:23 +00:00
2023-12-15 16:48:37 +00:00
2024-09-12 15:16:12 +00:00
2023-08-09 06:01:55 +00:00
2025-02-11 20:09:11 -08:00
2025-02-11 20:09:11 -08:00
2023-04-10 18:15:12 +00:00
2024-05-02 16:36:20 +00:00
2024-04-17 19:14:41 +00:00
2024-12-04 14:36:46 +00:00
2025-02-12 14:48:28 -08:00
2024-06-12 20:22:41 +00:00
2024-04-17 19:14:41 +00:00
2024-04-17 19:14:41 +00:00
2024-08-07 12:59:35 +00:00
2023-08-01 15:50:11 +00:00
2024-08-15 14:09:52 +00:00
2024-10-16 21:25:17 +00:00
2024-10-28 22:41:39 +00:00
2023-04-12 22:18:54 +00:00
2025-02-04 08:13:29 -08:00
2024-06-06 10:56:12 +00:00
2024-08-15 14:09:52 +00:00
2023-04-12 22:18:54 +00:00
2024-10-16 21:25:17 +00:00
2025-02-10 09:38:42 -08:00
2024-08-15 14:09:52 +00:00
2023-04-10 18:15:12 +00:00
2024-12-18 09:30:10 -08:00
2024-12-18 09:30:10 -08:00
2024-08-29 14:48:58 +00:00
2024-12-04 14:36:46 +00:00
2024-06-10 20:38:30 +00:00
2024-12-04 14:36:46 +00:00
2025-01-08 14:51:12 -08:00
2024-09-25 17:28:44 +00:00
2023-09-27 15:11:05 +00:00
2023-06-23 17:01:58 +00:00
2023-09-27 15:11:05 +00:00
2024-11-27 18:04:59 +00:00
2024-11-26 19:24:31 +00:00
2024-11-26 19:24:31 +00:00
2024-11-26 19:24:31 +00:00
2024-11-26 19:24:31 +00:00
2024-11-26 19:24:31 +00:00
2024-11-26 19:24:31 +00:00
2023-07-11 15:13:58 +00:00
2023-04-12 22:18:54 +00:00
2024-12-04 14:36:46 +00:00
2023-04-10 18:15:12 +00:00
2024-04-12 15:42:47 +00:00
2024-08-28 16:41:50 +00:00
2024-06-17 10:47:58 +00:00
2024-03-05 21:48:00 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2024-08-15 14:09:52 +00:00
2023-04-12 22:18:54 +00:00
2024-12-04 14:36:46 +00:00
2023-04-12 22:18:54 +00:00
2024-08-15 14:09:52 +00:00
2024-08-15 14:09:52 +00:00
2024-09-09 13:44:04 +00:00
2024-08-15 14:09:52 +00:00
2024-10-08 13:56:45 +00:00
2024-10-08 13:56:45 +00:00
2024-09-23 23:36:48 +00:00
2024-04-17 19:14:41 +00:00
2025-02-04 08:13:29 -08:00
2024-08-26 22:14:39 +00:00
2024-04-19 19:46:47 +00:00
2024-08-15 14:09:52 +00:00
2023-04-12 22:18:54 +00:00
2024-08-07 16:39:10 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-10-09 17:23:23 +00:00
2023-09-27 15:11:05 +00:00
2023-09-27 15:11:05 +00:00
2024-09-12 15:16:12 +00:00
2024-09-24 22:41:40 +00:00
2024-09-12 15:16:12 +00:00
2025-02-10 09:38:42 -08:00
2025-02-10 09:38:42 -08:00
2024-12-17 13:30:50 -08:00
2024-04-17 19:14:41 +00:00
2023-04-10 18:15:12 +00:00
2024-04-17 19:14:41 +00:00
2024-11-12 20:28:50 +00:00
2025-02-11 09:39:20 -08:00
2025-02-11 09:39:20 -08:00
2023-04-10 18:15:12 +00:00
2024-04-17 19:14:41 +00:00
2023-04-10 18:15:12 +00:00
2024-01-25 08:23:51 +00:00
2023-07-10 20:33:33 +00:00
2024-12-10 22:28:49 +00:00
2024-12-10 22:28:49 +00:00
2024-04-17 19:14:41 +00:00
2023-09-27 16:23:38 +00:00
2024-09-20 14:47:49 +00:00
2025-01-08 00:26:40 -08:00
2024-11-12 20:28:50 +00:00
2023-04-17 16:26:35 +00:00
2023-04-12 22:18:54 +00:00
2024-03-20 20:08:13 +00:00
2024-10-28 17:08:39 +00:00
2024-11-12 20:28:50 +00:00
2024-02-23 04:13:39 +00:00
2024-04-17 19:14:41 +00:00
2023-05-11 03:14:27 +00:00
2023-10-31 19:39:51 +00:00
2024-04-17 19:14:41 +00:00
2024-06-14 23:24:19 +00:00
2024-06-14 23:24:19 +00:00
2024-08-07 12:59:35 +00:00
2023-06-23 20:35:00 +00:00
2024-01-09 12:36:55 +00:00
2024-02-16 01:05:49 +00:00
2023-11-03 07:36:25 +00:00
2024-02-16 01:05:49 +00:00
2024-01-09 12:36:55 +00:00
2024-01-09 12:36:55 +00:00
2024-05-07 17:04:29 +00:00
2024-12-20 11:30:51 -08:00
2023-06-07 19:01:51 +00:00
2024-08-07 12:59:35 +00:00
2024-04-17 19:14:41 +00:00