Monday, February 23, 2015

"slabinfo -v" alternative command


As I discussed in my earlier post slub_debug: Detect Kernel heap memory corruption, "slabinfo -v" is a useful tool to detect kernel memory corruptions. Though slub_debug default kernel functionality helps to detect these same corruptions, it detects only when a memory chunk is allocated or freed. "slabinfo -v" can help find the corruptions more proactively by running it at command line or in cronjob for every "n" seconds.

Recently, I faced some crashes in slabinfo executable. In this post, I am sharing a tip to achieve "slabinfo -v" functionality without running the slabinfo executable. Execute the following
echo 1 | tee -a /sys/kernel/slab/*/validate > /dev/null

If you inspect the code in slabinfo.c (which one of friends did earlier & I did today), this is exactly what it does internally. Of course, investigating root cause and fixing the crashes in slabinfo.c is another thing which I need to purse. Meanwhile, I am using the above command as an alternative.

Hope this helps.

UA-48797665-1