Issue 19 in kedr: allocations via kzalloc_node() are not properly tracked

5 views
Skip to first unread message

ke...@googlecode.com

unread,
Aug 12, 2014, 9:44:11 AM8/12/14
to eugene....@gmail.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 19 by bciph...@gmail.com: allocations via kzalloc_node() are not
properly tracked
http://code.google.com/p/kedr/issues/detail?id=19

I don't have a more recent system handy to test, but on my CentOS 6.3
2.6.32-358.23.2.el6.x86_64 system I observed the following behaviour with
the leak checker:

'Unallocated frees' were reported on memory allocated by kzalloc_node()
which had matching calls to kfree(). Likewise the 'Allocations' were
reported as being much lower. Changing all allocations to kzalloc()
instead resolved all counts.

-Brett Ciphery

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

ke...@googlecode.com

unread,
Aug 12, 2014, 9:58:26 AM8/12/14
to eugene....@gmail.com

Comment #1 on issue 19 by bciph...@gmail.com: allocations via
kzalloc_node() are not properly tracked
http://code.google.com/p/kedr/issues/detail?id=19

Tried kedr-0.5.tar.bz2 as well as hg checkout as of August 11, 2014.

ke...@googlecode.com

unread,
Aug 13, 2014, 3:11:38 AM8/13/14
to eugene....@gmail.com
Updates:
Status: Accepted
Owner: euspec...@gmail.com

Comment #2 on issue 19 by euspec...@gmail.com: allocations via
kzalloc_node() are not properly tracked
http://code.google.com/p/kedr/issues/detail?id=19

Hm, kzalloc_node() is usually a wrapper around
kmalloc_node/__kmalloc_node/kmem_cache_alloc_node_notrace/kmem_cache_alloc_node
all of which should be handled. May be some particular case is missing.
I'll take a look.

Please post the following info here:
# The output of cmake when you configure KEDR (it shows which functions
KEDR will be able to handle on the current kernel).
# The output of `readelf -sW <.ko_file_of_your_module> | grep UND | less`
(when your module uses kzalloc_node). This will show which kernel functions
your module imports.

ke...@googlecode.com

unread,
Aug 13, 2014, 3:12:48 AM8/13/14
to eugene....@gmail.com

Comment #3 on issue 19 by euspec...@gmail.com: allocations via
kzalloc_node() are not properly tracked
http://code.google.com/p/kedr/issues/detail?id=19

... without '| less', of course.

ke...@googlecode.com

unread,
Aug 13, 2014, 9:55:45 AM8/13/14
to eugene....@gmail.com

Comment #4 on issue 19 by bciph...@gmail.com: allocations via
kzalloc_node() are not properly tracked
http://code.google.com/p/kedr/issues/detail?id=19

Attached -- much appreciated.

You mentioned kmem_cache_alloc_node_notrace but I do see that it's
importing kmem_cache_alloc_node_trace, which KEDR configuration couldn't
find.

Attachments:
cmake.log 10.7 KB
readelf-ko.log 10.0 KB

ke...@googlecode.com

unread,
Aug 18, 2014, 12:29:46 PM8/18/14
to eugene....@gmail.com

Comment #5 on issue 19 by euspec...@gmail.com: allocations via
kzalloc_node() are not properly tracked
http://code.google.com/p/kedr/issues/detail?id=19

Thanks for the info. Yes, you are right, this must be it.

I reproduced the problem on my CentOS 6 box. Working on a fix...

ke...@googlecode.com

unread,
Aug 18, 2014, 1:43:41 PM8/18/14
to eugene....@gmail.com

Comment #6 on issue 19 by euspec...@gmail.com: allocations via
kzalloc_node() are not properly tracked
http://code.google.com/p/kedr/issues/detail?id=19

I think I got it.

'#include <linux/version.h>' was missing
from 'sources/cmake/kmodule_sources/check_unreliable_functions/kmem_cache_alloc_node_trace.c',
which is used to check if the function is present. It failed and KEDR
assumed 'kmem_cache_alloc_node_trace' is not available. Other systems I
tested might have #included that header via others so the problem went
unnoticed.

I fixed that in the repository:
http://code.google.com/p/kedr/source/detail?r=8760efeaec94888e6b85a88a8c76901a7d102607

Please try the latest revision from there or add '#include
<linux/version.h>' to that file manually and check if everything works OK
on your system too.

ke...@googlecode.com

unread,
Aug 19, 2014, 8:58:49 AM8/19/14
to eugene....@gmail.com

Comment #7 on issue 19 by bciph...@gmail.com: allocations via
kzalloc_node() are not properly tracked
http://code.google.com/p/kedr/issues/detail?id=19

Yep, the latest hg clone seems to work. I'm seeing one possible leak now
on a different resource which only reveals itself on this latest kedr, or
if I use the older 0.5 and switch all of my kzalloc_node()'s to kzalloc()
(otherwise it's masked). I thought I recalled having a clean run doing
this before, but, no doubt it's a real module problem.

Bug as described is fixed, thanks!

ke...@googlecode.com

unread,
Aug 19, 2014, 9:11:26 AM8/19/14
to eugene....@gmail.com
Updates:
Status: Fixed

Comment #8 on issue 19 by euspec...@gmail.com: allocations via
kzalloc_node() are not properly tracked
http://code.google.com/p/kedr/issues/detail?id=19

(No comment was entered for this change.)
Reply all
Reply to author
Forward
0 new messages