Re: [TOMOYO 03/15](repost) Memory and pathname management functions.

From: Tetsuo Handa
Date: Wed Oct 03 2007 - 07:12:26 EST


Hello.

James Morris wrote:
> Would you please explain why you need another level of memory allocation?
>
> What does it do apart from let you check for memory leaks?

Difference between tmy_alloc() and kmalloc() are

tmy_alloc() allows administrator know "how much memory is used by TOMOYO Linux modules"
via /sys/kernel/security/tomoyo/meminfo interface.
This feature was requested by TOMOYO Linux users.
/proc/slabinfo can show how much memory is used by all modules,
but it cannot show how much memory is used by TOMOYO Linux modules.

tmy_alloc() can indicate memory-leaking bug and can avoid double-kfree() bug
by keeping the pointer returned by kmalloc() in a local "cache_list" list.

tmy_alloc() also keeps the size of memory allocated by kmalloc() in "cache_list" list
so that administrator can know "how much memory is used by TOMOYO Linux modules".
Calling ksize() after kmalloc() in tmy_alloc() and
calling ksize() before kfree() in tmy_free() might be better
if double-kfree-checks and memory-leaking-checks (i.e. "tmy_cachep") are unneeded.

Regards.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/