<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/git/stable/linux-stable.git/mm/vmalloc.c, branch linux-2.6.31.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<id>https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/atom?h=linux-2.6.31.y</id>
<link rel='self' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/atom?h=linux-2.6.31.y'/>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/'/>
<updated>2010-04-01T22:55:50+00:00</updated>
<entry>
<title>mm: replace various uses of num_physpages by totalram_pages</title>
<updated>2010-04-01T22:55:50+00:00</updated>
<author>
<name>Jan Beulich</name>
<email>JBeulich@novell.com</email>
</author>
<published>2009-09-22T00:03:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=236638ad883fec47a3db42d823a80483733143a5'/>
<id>urn:sha1:236638ad883fec47a3db42d823a80483733143a5</id>
<content type='text'>
commit 4481374ce88ba8f460c8b89f2572027bd27057d0 upstream.

Sizing of memory allocations shouldn't depend on the number of physical
pages found in a system, as that generally includes (perhaps a huge amount
of) non-RAM pages.  The amount of what actually is usable as storage
should instead be used as a basis here.

Some of the calculations (i.e.  those not intending to use high memory)
should likely even use (totalram_pages - totalhigh_pages).

Signed-off-by: Jan Beulich &lt;jbeulich@novell.com&gt;
Acked-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Acked-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Dave Airlie &lt;airlied@linux.ie&gt;
Cc: Kyle McMartin &lt;kyle@mcmartin.ca&gt;
Cc: Jeremy Fitzhardinge &lt;jeremy@goop.org&gt;
Cc: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Cc: Hugh Dickins &lt;hugh.dickins@tiscali.co.uk&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>vmalloc: remove BUG_ON due to racy counting of VM_LAZY_FREE</title>
<updated>2010-04-01T22:55:40+00:00</updated>
<author>
<name>Yongseok Koh</name>
<email>yongseok.koh@samsung.com</email>
</author>
<published>2010-01-19T08:33:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=120f90d1e9fda2948117e93eefc5caa6a6209b3c'/>
<id>urn:sha1:120f90d1e9fda2948117e93eefc5caa6a6209b3c</id>
<content type='text'>
commit 88f5004430babb836cfce886d5d54c82166f8ba4 upstream.

In free_unmap_area_noflush(), va-&gt;flags is marked as VM_LAZY_FREE first, and
then vmap_lazy_nr is increased atomically.

But, in __purge_vmap_area_lazy(), while traversing of vmap_are_list, nr
is counted by checking VM_LAZY_FREE is set to va-&gt;flags.  After counting
the variable nr, kernel reads vmap_lazy_nr atomically and checks a
BUG_ON condition whether nr is greater than vmap_lazy_nr to prevent
vmap_lazy_nr from being negative.

The problem is that, if interrupted right after marking VM_LAZY_FREE,
increment of vmap_lazy_nr can be delayed.  Consequently, BUG_ON
condition can be met because nr is counted more than vmap_lazy_nr.

It is highly probable when vmalloc/vfree are called frequently.  This
scenario have been verified by adding delay between marking VM_LAZY_FREE
and increasing vmap_lazy_nr in free_unmap_area_noflush().

Even the vmap_lazy_nr is for checking high watermark, it never be the
strict watermark.  Although the BUG_ON condition is to prevent
vmap_lazy_nr from being negative, vmap_lazy_nr is signed variable.  So,
it could go down to negative value temporarily.

Consequently, removing the BUG_ON condition is proper.

A possible BUG_ON message is like the below.

   kernel BUG at mm/vmalloc.c:517!
   invalid opcode: 0000 [#1] SMP
   EIP: 0060:[&lt;c04824a4&gt;] EFLAGS: 00010297 CPU: 3
   EIP is at __purge_vmap_area_lazy+0x144/0x150
   EAX: ee8a8818 EBX: c08e77d4 ECX: e7c7ae40 EDX: c08e77ec
   ESI: 000081fe EDI: e7c7ae60 EBP: e7c7ae64 ESP: e7c7ae3c
   DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
   Call Trace:
   [&lt;c0482ad9&gt;] free_unmap_vmap_area_noflush+0x69/0x70
   [&lt;c0482b02&gt;] remove_vm_area+0x22/0x70
   [&lt;c0482c15&gt;] __vunmap+0x45/0xe0
   [&lt;c04831ec&gt;] vmalloc+0x2c/0x30
   Code: 8d 59 e0 eb 04 66 90 89 cb 89 d0 e8 87 fe ff ff 8b 43 20 89 da 8d 48 e0 8d 43 20 3b 04 24 75 e7 fe 05 a8 a5 a3 c0 e9 78 ff ff ff &lt;0f&gt; 0b eb fe 90 8d b4 26 00 00 00 00 56 89 c6 b8 ac a5 a3 c0 31
   EIP: [&lt;c04824a4&gt;] __purge_vmap_area_lazy+0x144/0x150 SS:ESP 0068:e7c7ae3c

[ See also http://marc.info/?l=linux-kernel&amp;m=126335856228090&amp;w=2 ]

Signed-off-by: Yongseok Koh &lt;yongseok.koh@samsung.com&gt;
Reviewed-by: Minchan Kim &lt;minchan.kim@gmail.com&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Merge branch 'for-linus' of git://linux-arm.org/linux-2.6</title>
<updated>2009-06-11T21:15:57+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2009-06-11T21:15:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=512626a04e72aca60effe111fa0333ed0b195d21'/>
<id>urn:sha1:512626a04e72aca60effe111fa0333ed0b195d21</id>
<content type='text'>
* 'for-linus' of git://linux-arm.org/linux-2.6:
  kmemleak: Add the corresponding MAINTAINERS entry
  kmemleak: Simple testing module for kmemleak
  kmemleak: Enable the building of the memory leak detector
  kmemleak: Remove some of the kmemleak false positives
  kmemleak: Add modules support
  kmemleak: Add kmemleak_alloc callback from alloc_large_system_hash
  kmemleak: Add the vmalloc memory allocation/freeing hooks
  kmemleak: Add the slub memory allocation/freeing hooks
  kmemleak: Add the slob memory allocation/freeing hooks
  kmemleak: Add the slab memory allocation/freeing hooks
  kmemleak: Add documentation on the memory leak detector
  kmemleak: Add the base support

Manual conflict resolution (with the slab/earlyboot changes) in:
	drivers/char/vt.c
	init/main.c
	mm/slab.c
</content>
</entry>
<entry>
<title>vmalloc: use kzalloc() instead of alloc_bootmem()</title>
<updated>2009-06-11T16:17:05+00:00</updated>
<author>
<name>Pekka Enberg</name>
<email>penberg@cs.helsinki.fi</email>
</author>
<published>2009-05-25T12:01:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=43ebdac42f16037263b52a5aeedcd1bfa4a9bb29'/>
<id>urn:sha1:43ebdac42f16037263b52a5aeedcd1bfa4a9bb29</id>
<content type='text'>
We can call vmalloc_init() after kmem_cache_init() and use kzalloc() instead of
the bootmem allocator when initializing vmalloc data structures.

Acked-by: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Acked-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Acked-by: Nick Piggin &lt;npiggin@suse.de&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Yinghai Lu &lt;yinghai@kernel.org&gt;
Signed-off-by: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
</content>
</entry>
<entry>
<title>kmemleak: Add the vmalloc memory allocation/freeing hooks</title>
<updated>2009-06-11T16:03:30+00:00</updated>
<author>
<name>Catalin Marinas</name>
<email>catalin.marinas@arm.com</email>
</author>
<published>2009-06-11T12:23:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=89219d37a2377c44fde7bff0bf0623453c05329a'/>
<id>urn:sha1:89219d37a2377c44fde7bff0bf0623453c05329a</id>
<content type='text'>
This patch adds the callbacks to kmemleak_(alloc|free) functions from
vmalloc/vfree.

Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>alloc_vmap_area: fix memory leak</title>
<updated>2009-05-06T23:36:10+00:00</updated>
<author>
<name>Ralph Wuerthner</name>
<email>ralphw@linux.vnet.ibm.com</email>
</author>
<published>2009-05-06T23:02:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=2498ce42d3a4d1a498f1df4884da960087547db7'/>
<id>urn:sha1:2498ce42d3a4d1a498f1df4884da960087547db7</id>
<content type='text'>
If alloc_vmap_area() fails the allocated struct vmap_area has to be freed.

Signed-off-by: Ralph Wuerthner &lt;ralphw@linux.vnet.ibm.com&gt;
Reviewed-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Reviewed-by: Minchan Kim &lt;minchan.kim@gmail.com&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>vmap: remove needless lock and list in vmap</title>
<updated>2009-04-01T15:59:11+00:00</updated>
<author>
<name>MinChan Kim</name>
<email>minchan.kim@gmail.com</email>
</author>
<published>2009-03-31T22:19:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=d086817dc0d42f1be8db4138233d33e1dd16a956'/>
<id>urn:sha1:d086817dc0d42f1be8db4138233d33e1dd16a956</id>
<content type='text'>
vmap's dirty_list is unused.  It's for optimizing flushing.  but Nick
didn't write the code yet.  so, we don't need it until time as it is
needed.

This patch removes vmap_block's dirty_list and codes related to it.

Signed-off-by: MinChan Kim &lt;minchan.kim@gmail.com&gt;
Acked-by: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'x86/core' into core/percpu</title>
<updated>2009-03-04T01:29:19+00:00</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2009-03-04T01:29:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=91d75e209bd59695f0708d66964d928d45b3b2f3'/>
<id>urn:sha1:91d75e209bd59695f0708d66964d928d45b3b2f3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge branch 'x86/urgent' into x86/pat</title>
<updated>2009-03-01T11:47:58+00:00</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2009-03-01T11:47:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=55f2b78995826d549401bdf20abeac1832636bb6'/>
<id>urn:sha1:55f2b78995826d549401bdf20abeac1832636bb6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>mm: fix lazy vmap purging (use-after-free error)</title>
<updated>2009-02-28T00:26:21+00:00</updated>
<author>
<name>Vegard Nossum</name>
<email>vegard.nossum@gmail.com</email>
</author>
<published>2009-02-27T22:03:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=cbb766766f3f2f6d9326c561b1020590642c6e39'/>
<id>urn:sha1:cbb766766f3f2f6d9326c561b1020590642c6e39</id>
<content type='text'>
I just got this new warning from kmemcheck:

    WARNING: kmemcheck: Caught 32-bit read from freed memory (c7806a60)
    a06a80c7ecde70c1a04080c700000000a06709c1000000000000000000000000
     f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f
     ^

    Pid: 0, comm: swapper Not tainted (2.6.29-rc4 #230)
    EIP: 0060:[&lt;c1096df7&gt;] EFLAGS: 00000286 CPU: 0
    EIP is at __purge_vmap_area_lazy+0x117/0x140
    EAX: 00070f43 EBX: c7806a40 ECX: c1677080 EDX: 00027b66
    ESI: 00002001 EDI: c170df0c EBP: c170df00 ESP: c178830c
     DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
    CR0: 80050033 CR2: c7806b14 CR3: 01775000 CR4: 00000690
    DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
    DR6: 00004000 DR7: 00000000
     [&lt;c1096f3e&gt;] free_unmap_vmap_area_noflush+0x6e/0x70
     [&lt;c1096f6a&gt;] remove_vm_area+0x2a/0x70
     [&lt;c1097025&gt;] __vunmap+0x45/0xe0
     [&lt;c10970de&gt;] vunmap+0x1e/0x30
     [&lt;c1008ba5&gt;] text_poke+0x95/0x150
     [&lt;c1008ca9&gt;] alternatives_smp_unlock+0x49/0x60
     [&lt;c171ef47&gt;] alternative_instructions+0x11b/0x124
     [&lt;c171f991&gt;] check_bugs+0xbd/0xdc
     [&lt;c17148c5&gt;] start_kernel+0x2ed/0x360
     [&lt;c171409e&gt;] __init_begin+0x9e/0xa9
     [&lt;ffffffff&gt;] 0xffffffff

It happened here:

    $ addr2line -e vmlinux -i c1096df7
    mm/vmalloc.c:540

Code:

	list_for_each_entry(va, &amp;valist, purge_list)
		__free_vmap_area(va);

It's this instruction:

    mov    0x20(%ebx),%edx

Which corresponds to a dereference of va-&gt;purge_list.next:

    (gdb) p ((struct vmap_area *) 0)-&gt;purge_list.next
    Cannot access memory at address 0x20

It seems that we should use "safe" list traversal here, as the element
is freed inside the loop. Please verify that this is the right fix.

Acked-by: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Vegard Nossum &lt;vegard.nossum@gmail.com&gt;
Cc: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: "Paul E. McKenney" &lt;paulmck@linux.vnet.ibm.com&gt;
Cc: &lt;stable@kernel.org&gt;		[2.6.28.x]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
