Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

memory leak when placing interceptions on specific functions #9

Open
azulgrana13 opened this issue Aug 13, 2018 · 3 comments
Open

memory leak when placing interceptions on specific functions #9

azulgrana13 opened this issue Aug 13, 2018 · 3 comments

Comments

@azulgrana13
Copy link

azulgrana13 commented Aug 13, 2018

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);
}

ktf_memory_leak.txt

@knuto
Copy link
Contributor

knuto commented Aug 14, 2018

I think some information is missing here. There's no KTF_REGISTER_INTERCEPT operations in KTF?

@azulgrana13
Copy link
Author

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.

@alan-maguire
Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants