Memory corruption is unfortunately a very common root cause of bugs. Being able to debug them is a key skill. We'll now look at a few ways to go about this. Before diving into the details, remember that the following discussion is with respect to the SLUB (the unqueued allocator) implementation of the slab layer. This is the default on most Linux installations (we mentioned in Chapter 8, Kernel Memory Allocation for Module Authors – Part 1, under the Slab layer implementations within the kernel section, that current Linux kernels have three mutually exclusive implementations of the slab layer).
Also, our intention here is not to discuss in-depth kernel debug tools with respect to memory debugging—that is a large topic by itself that unfortunately lies beyond the scope of this book. Nevertheless, I will say that you would do well to gain familiarity with the powerful frameworks/tools that have been mentioned, particularly the...