Dr. Memory is a new open-source tool for finding memory errors - similar to Memcheck (Valgrind) but with Windows support.It is not working properly enough to be used on the memory waterfall yet, but we're trying to help it grow up and fulfill our memory error detection needs for Chromium. We've set up a couple of Dr. Memory bots, you can check them out on the FYI waterfall. If you want to try Dr. Memory on your machine, please do the following:
OK, I've found a real bugGreat! Please file a crbug and add the Stability-DrMemory label. drmemory_light vs drmemory_fullLight: only searches for unaddressable accesses like OOB or use-after-frees, adds moderate execution slowdown Full: also searches for uninitialized reads and memory leaks but adds a large slowdown. More on the "full" mode: If you're familiar with the Valgrind guts you probably know that tools like Valgrind and Dr. Memory need to intercept and handle all system calls to know precisely what data is uninitialized, what is read and so on. In contrast to the open-source Linux kernel with just a hundred system calls or so, on Windows we have an open-ended problem of handling undocumented system calls. We're trying hard to do that but we haven't finished yet. So, before diving into the "full mode" reports and going to file many bugs, you need to know a few things:
Suppressing error reports from the botsTODO(rnk): When the DrMemory bots have moved to the chromium.memory.fyi waterfall, this information will be moved into the memory sheriff page. timurrrr: most of this info sounds DrMemory-specific, do we really want to put it onto the "common" page? The DrMemory suppression file is at tools/valgrind/drmemory/suppressions[_full].txt. Generally speaking, suppressions in these files are maintained in exactly the same way as those for all of the other memory tools we use for Chromium, except that DrMemory uses a slightly different suppression format. When the bot generates a report, follow the link to the bot's stdio and search for "hash=#" to find the report quickly. You should see something similar to: UNADDRESSABLE ACCESS: reading 0x00000000-0x00000004 4 byte(s) # 0 TestingProfile::FinishInit [chrome\test\base\testing_profile.cc:211] # 1 TestingProfile::TestingProfile [chrome\test\base\testing_profile.cc:164] # 2 BrowserAboutHandlerTest_WillHandleBrowserAboutURL_Test::TestBody [chrome\browser\browser_about_handler_unittest.cc:110] # 3 testing::Test::Run [testing\gtest\src\gtest.cc:2162] Note: @0:00:08.656 in thread 1900
Note: instruction: mov (%ebx) -> %esi
Suppression (error hash=#30459DB8320B1FA3#):
{
UNADDRESSABLE ACCESS
name=<insert_a_suppression_name_here>
*!TestingProfile::FinishInit
*!TestingProfile::TestingProfile
*!BrowserAboutHandlerTest_WillHandleBrowserAboutURL_Test::TestBody
*!testing::Test::Run
}As a starting point, you can copy the suppression (the portion between the curly brackets not including the brackets) into the suppressions.txt file and then widen it so it covers any similar reports on other bots. Each frame from the stack trace is of the form "<module>!<function>". For functions from Chrome, we generally link the code statically into many different binaries, so we always use a wildcard for the module. As in the other tool suppression formats, '*' is a single frame variable-width wildcard, '?' is a single-character wildcard, and '...' will match any number of frames. DrMemory has support for a handful of other pattern matching mechanisms. Once you have your suppression, you can test that it suppresses the existing reports using tools/valgrind/waterfall.sh as you would with the other memory tools. Running Chromium under Dr. Memory on a given set of URLsFirst, put the list of URLs into tools\valgrind\reliability\url_list.txt, one URL per line without the http:// prefix. You can also put in the local URLs like file://c:\mypath\repro.htm Then, run tools\valgrind\chrome_tests.bat -t reliability --tool drmemory --tool_flags="-no_check_uninitialized -no_count_leaks" If you're searching for some stability/security bugs, you may consider running Chromium in the single process mode to increase the probability of the report by applying this patch: Index: tools/valgrind/chrome_tests.py Running your custom command line under Dr. MemorySometimes you may need to run your own program or your own custom command line under Dr. Memory. For example, if you want to prefix your own "chrome.exe --my-flags" command with Dr. Memory, do the following:tools\valgrind\drmemory.bat myapp.exe --my-flags # don't forget to increase the timeoutsIf the command line runs Chrome, you may consider increasing the timeouts by appending --ui-test-action-timeout=120000 --ui-test-action-max-timeout=280000 --ui-test-terminate-timeout=120000 to the commandline. Random notes for the curious ones You can find the Dr. Memory suppression file for Chrome at tools\valgrind\drmemory\suppressions[_full].txt The report files are parsed and re-formatted to be more familiar for Valgrind users (see tools\valgrind\drmemory_analyze.py). Feedback?Drop drmemory-team@ a message |
