Open alexei37 opened 7 years ago
TBB developers seem to concur that this is a false positive: here is their response in the 01org/tbb repository's issue tracker (x-referenced above):
alexey-katranov commented 15 hours ago
I suppose it is a false positive because a pointer to a task is not a pointer to the first byte of allocated memory. You can see in scheduler.cpp:322 that a task pointer is shifted to the right on the task_prefix_reservation_size
number of bytes. Therefore, when we calculate a prefix pointer in task.h:904 we shift to the left safely (sizeof(task_prefix)<=task_prefix_reservation_size
scheduler_common.h:163)
Please confirm that this is indeed the case (time permitting).
Yes, a custom allocator that pads can result in problems tracking which addresses are addressable. The typical solution is to annotate the allocator so that the tool knows which range of memory it allocated. That feature is not yet present in Dr. Memory (https://github.com/DynamoRIO/drmemory/issues/107). Do your custom allocators already have Valgrind annotations? If so the plan is for Dr. Memory to support those.
Thanks for your response!
As the issue is with a third-party library (TBB), i.e. the custom allocators are in their code, I've readdressed your question to them (in this thread).
As far as I know, Valgrind does not raise the discussed issue. Moreover, Intel TBB library does not have any Valgrind annotations at all. You can contribute the required annotations but I cannot promise if they will become a part of the Intel TBB library because it will be the first example and they are not required for Valgrind.
How Dr. Memory detect the issue? Does it have some knowledge about source code or does it capture user-defined operator new
? Can Intel TBB runtime help somehow not to detect the issue?
"Assertion !p || prefix().context == p->prefix().context failed on line 797 of file ..........include\tbb\task.h Detailed description: The tasks must be in the same context" this leads to crash.
I understand how to suppress results but are there some options to completely ignore TBB custom allocations so that it won't crash with lots of false memory leaks?
Even when used on a toy example (from https://software.intel.com/en-us/node/506153):
one gets the following report with UNADDRESSABLE ACCESS beyond heap bounds errors:
Error #1: UNADDRESSABLE ACCESS beyond heap bounds: writing 0x0000002c74de08c5-0x0000002c74de08c6 1 byte(s)
0 tbb::task::task [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\task.h:569]
1 tbb::interface9::internal::flag_task::flag_task [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\partitioner.h:130]
2 tbb::interface9::internal::allocate_sibling [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\parallel_for.h:117]
3 tbb::interface9::internal::start_for<>::offer_work [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\parallel_for.h:106]
4 tbb::interface9::internal::partition_type_base<>::execute<> [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\partitioner.h:251]
5 tbb::interface9::internal::start_for<>::execute [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\parallel_for.h:127]
6 tbb.dll!tbb::internal::custom_scheduler<>::local_wait_for_all [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\externalprojects\source\ep-tbb\src\tbb\custom_scheduler.h:501]
7 tbb.dll!tbb::internal::generic_scheduler::local_spawn_root_and_wait [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\externalprojects\source\ep-tbb\src\tbb\scheduler.cpp:676]
8 tbb.dll!tbb::internal::generic_scheduler::spawn_root_and_wait [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\externalprojects\source\ep-tbb\src\tbb\scheduler.cpp:684]
9 tbb::task::spawn_root_and_wait [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\task.h:749]
10 tbb::interface9::internal::start_for<>::run [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\parallel_for.h:90]
11 tbb::parallel_for<> [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\parallel_for.h:186]
12 ParallelAverage [c:\users\akovalyov\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp:30]
13 main [c:\users\akovalyov\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp:39]
Note: @0:00:00.992 in thread 25840 Note: next higher malloc: 0x0000002c74de08d0-0x0000002c74de08d0 Note: instruction: mov $0x01 -> 0x2d(%rax)
Error #2: UNADDRESSABLE ACCESS beyond heap bounds: reading 0x0000002c74de0898-0x0000002c74de08a0 8 byte(s)
0 tbb::task::set_parent [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\task.h:797]
1 tbb::interface9::internal::allocate_sibling [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\parallel_for.h:118]
2 tbb::interface9::internal::start_for<>::offer_work [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\parallel_for.h:106]
3 tbb::interface9::internal::partition_type_base<>::execute<> [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\partitioner.h:251]
4 tbb::interface9::internal::start_for<>::execute [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\parallel_for.h:127]
5 tbb.dll!tbb::internal::custom_scheduler<>::local_wait_for_all [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\externalprojects\source\ep-tbb\src\tbb\custom_scheduler.h:501]
6 tbb.dll!tbb::internal::generic_scheduler::local_spawn_root_and_wait [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\externalprojects\source\ep-tbb\src\tbb\scheduler.cpp:676]
7 tbb.dll!tbb::internal::generic_scheduler::spawn_root_and_wait [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\externalprojects\source\ep-tbb\src\tbb\scheduler.cpp:684]
8 tbb::task::spawn_root_and_wait [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\task.h:749]
9 tbb::interface9::internal::start_for<>::run [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\parallel_for.h:90]
10 tbb::parallel_for<> [f:\projects\matsdk_vs2015_64bit\branchmain\binaries\m\thirdparty\install\tbb-2017_u5-msvc14u3-x64\include\tbb\parallel_for.h:186]
11 ParallelAverage [c:\users\akovalyov\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp:30]
12 main [c:\users\akovalyov\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp:39]
Note: @0:00:01.012 in thread 25840 Note: prev lower malloc: 0x0000002c74de0680-0x0000002c74de0888 Note: instruction: mov (%rax) -> %rax
FINAL SUMMARY:
DUPLICATE ERROR COUNTS:
SUPPRESSIONS USED:
ERRORS FOUND: 2 unique, 2 total unaddressable access(es) 0 unique, 0 total invalid heap argument(s) 0 unique, 0 total warning(s) ERRORS IGNORED: Details: <...>\results.txt