http://kerneltrap.org/node/15912kmemcheck Aiming For Mainline InclusionApril 4, 2008 - 10:41am
"I skipped the public announcements for versions 5 and 6, but here is 7 :)," noted Vegard Nossum, announcing the latest release of his kmemcheck patch, currently applying against the 2.6.25-rc8 kernel. Vegard noted he is now hoping to get the patch merged into the mainline kernel during the upcoming 2.6.26 merge window. He described the patch:
Among the changes compared to earlier releases, v7 has undergone a lot of cleanup, some preparation has begun for an x86_64 port, error reporting stability has been improved, boot time and run time options have been added, and there have been several bug fixes. Related links:valgrind --tool=memcheck butApril 4, 2008 - 2:11pm
valgrind --tool=memcheck YesApril 4, 2008 - 5:25pm
My understanding is that it's like Rational (now IBM)'s Purify, but for the kernel. It uses the memory protection hardware to catch all accesses to dynamically allocated memory, and use them to determine which reads access bytes that have not yet been written to. Note that it differs from Purify in that it apparently only tracks dynamic allocations, and not stack or static allocations. (Yes, I realize that stack is a special case of dynamic.) I believe Purify tracks all memory accesses. This limitation seems reasonable, since nearly all the really interesting structures are dynamically allocated via kmalloc(). It's also different from valgrind (which someone else mentioned), in that valgrind actually simulates code, rather than just running it and (ab)using the memory protection hardware to catch issues. That's why valgrind is so slow. :-) Hmm... it might be amusing to try to run User Mode Linux under valgrind. That could be a hoot. "Hmm... it might be amusingApril 4, 2008 - 8:29pm
"Hmm... it might be amusing to try to run User Mode Linux under valgrind. That could be a hoot." Indeed. Though, I'd expect a world of pain :-O UML under valgrind is starting to work...April 7, 2008 - 2:24pm
See http://bitwagon.com/valgrind+uml/ Nifty!April 7, 2008 - 3:42pm
I figured it ought to be possible, but I wasn't sure how much of UML's coziness with the host kernel might get in the way. Very nice! LWN articleApril 10, 2008 - 11:02pm
http://lwn.net/Articles/260068/ Side note: Purify and valgrind are actually two very different things: - Purify instruments the executable code with special instructions around every memory access - this means that your actual executable is changed, so it can (usually) only be used when your developing the code. And I don't know how well purify works with things like shared system libraries and so on. - valgrind can take any executable, even optimized or shared system library code and effectively executes it in a virtual machine, and tracks the state of every piece of memory. Ah, okApril 12, 2008 - 12:24am
So, we basically have three separate pieces of technology here: Purify instruments, valgrind simulates, and kmemcheck uses protection faults. I was under the (mistaken) impression that Purify worked like kmemcheck, using protection faults to track memory access patterns rather than actually instrumenting the executable. Instrumenting the executable seems more problematic in general, but it works. On that count, Purify sounds a lot like Pin. Thanks for the clarification. |

What is it for?
What is this for?
Is it something that are to be used by kernel developers in order to find bugs in the Linux kernel?