Commit b2dc1ec
check: add kmemleak support to blktests
Running blktests can also help uncover kernel memory leaks when the
kernel is built with CONFIG_DEBUG_KMEMLEAK. However, until now the
blktests framework had no way to automatically detect or report such
leaks. Users typically had to manually setup kmemleak and trigger
scans after running tests[1][2].
This change integrates kmemleak support directly into the blktests
framework. Before running each test, the framework checks for the
presence of /sys/kernel/debug/kmemleak to determine whether kmemleak
is enabled for the running kernel. If available, before running a test,
any existing kmemleak reports are cleared to avoid false positives
from previous tests. After the test completes, the framework explicitly
triggers a kmemleak scan. If memory leaks are detected, they are written
to a per-test file at, "results/.../.../<test>.kmemleak" and the
corresponding test is marked as FAIL. Users can then inspect the
<test>.kmemleak file to analyze the reported leaks.
With this enhancement, blktests can automatically detect kernel memory
leaks (if kerel is configured with CONFIG_DEBUG_KMEMLEAK support) on
a per-test basis, removing the need for manual kmemleak setup and scans.
This should make it easier and faster to identify memory leaks
introduced by individual tests.
[1] https://lore.kernel.org/all/CAHj4cs8oJFvz=daCvjHM5dYCNQH4UXwSySPPU4v-WHce_kZXZA@mail.gmail.com/
[2] https://lore.kernel.org/all/CAHj4cs9wv3SdPo+N01Fw2SHBYDs9tj2M_e1-GdQOkRy=DsBB1w@mail.gmail.com/
Signed-off-by: Nilay Shroff <[email protected]>
Reviewed-by: Daniel Wagner <[email protected]>
Reviewed-by: Yi Zhang <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
[Shin'ichiro: replaced indent spaces with tabs]
Signed-off-by: Shin'ichiro Kawasaki <[email protected]>1 parent 7c3ad92 commit b2dc1ec
1 file changed
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
186 | 216 | | |
187 | 217 | | |
188 | 218 | | |
| |||
377 | 407 | | |
378 | 408 | | |
379 | 409 | | |
| 410 | + | |
| 411 | + | |
380 | 412 | | |
381 | 413 | | |
382 | 414 | | |
| |||
414 | 446 | | |
415 | 447 | | |
416 | 448 | | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
417 | 452 | | |
418 | 453 | | |
419 | 454 | | |
| |||
451 | 486 | | |
452 | 487 | | |
453 | 488 | | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
454 | 501 | | |
455 | 502 | | |
456 | 503 | | |
| |||
0 commit comments