lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 30 Mar 2011 14:22:00 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Daniel Baluta <dbaluta@...acom.com>
Cc:	Maxin John <maxin.john@...il.com>,
	naveen yadav <yad.naveen@...il.com>, linux-mips@...ux-mips.org,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	Catalin Marinas <catalin.marinas@....com>
Subject: Re: kmemleak for MIPS

Le mercredi 30 mars 2011 à 14:24 +0300, Daniel Baluta a écrit :
> We have:
> 
> > UDP hash table entries: 128 (order: 0, 4096 bytes)
> > CONFIG_BASE_SMALL=0
> 
> udp_table_init looks like:
> 
>         if (!CONFIG_BASE_SMALL)
>                 table->hash = alloc_large_system_hash(name, .. &table->mask);
>         /*
>          * Make sure hash table has the minimum size
>          */
> 
> Since CONFIG_BASE_SMALL is 0, we are allocating the hash using
> alloc_large_system
> Then:
>         if (CONFIG_BASE_SMALL || table->mask < UDP_HTABLE_SIZE_MIN - 1) {
>                 table->hash = kmalloc();
> 
> table->mask is 127, and UDP_HTABLE_SIZE_MIN is 256, so we are allocating again
> table->hash without freeing already allocated memory.
> 
> We could free table->hash, before allocating the memory with kmalloc.
> I don't fully understand the condition table->mask < UDP_HTABLE_SIZE_MIN - 1.
> 
> Eric?

There is nothing special. UDP algo needs a minimum hash table that
alloc_large_system_hash() was not able to provide (???)

As you spotted, there is no free_large-system_hash(), so we 'leak' the
small hash table.

If machine has not enough memory to provide such a small hash table, I
suggest using CONFIG_BASE_SMALL, since :

#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256)



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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ