google / kernel-sanitizers

Linux Kernel Sanitizers, fast bug-detectors for the Linux kernel
https://google.github.io/kernel-sanitizers/
436 stars 87 forks source link

Use a single inline function for sampled allocations #87

Closed ramosian-glider closed 4 years ago

ramosian-glider commented 4 years ago

Use a per-CPU sample counter, adding a single load and a branch to the fast path. kmalloc() requires some plumbing - we pass the requested size via _RET_IP_ now. This might be a bit questionable, but ends up being almost non-intrusive.