memory leak when placing interceptions on specific functions
Hi, Running KTF on my system (ubuntu 16.04) I've encountered some function for which the mere placement of the probes causes memory leaks. The memory coverage output is attached For now the function which caused it are:
- register_oom_notifier
- unregister_oom_notifier
- file_open_root
The tests themselves are empty so I was able to isolate the problem:
KTF_RETURN_PROBE(register_oom_notifier, test_probe)
{
return 0;
}
TEST(test_suite, lol)
{
ASSERT_INT_EQ_GOTO(KTF_REGISTER_RETURN_PROBE(register_oom_notifier, test_probe),
0, done);
done:
KTF_UNREGISTER_RETURN_PROBE(register_oom_notifier, test_probe);
}
I think some information is missing here. There's no KTF_REGISTER_INTERCEPT operations in KTF?
Sorry about the mix-up, we added a few macros in our project for our own comfort and I've forgot about them. I've edited the original comment with the code behind our macros.
thanks for reporting this issue! I think I may see the problem. It looks like you've enabled per-module coverage, and we have code that avoids memory tracking for the ktf_cov_kmem_cache_alloc_handler (so that we don't end up tracking the memory we use to track memory!), but I think we need to explicitly exclude ktf_cov_kmalloc_entry_handler too. I'll try to reproduce and spin up a fix.