<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/mm/vmalloc.c, branch v3.2.38</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/mm/vmalloc.c?h=v3.2.38</id>
<link rel='self' href='https://git.amat.us/linux/atom/mm/vmalloc.c?h=v3.2.38'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-06-10T13:41:46Z</updated>
<entry>
<title>mm: fix faulty initialization in vmalloc_init()</title>
<updated>2012-06-10T13:41:46Z</updated>
<author>
<name>KyongHo</name>
<email>pullip.cho@samsung.com</email>
</author>
<published>2012-05-29T22:06:49Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=39083c6db7e18732e872fed0c2f2427de12a622a'/>
<id>urn:sha1:39083c6db7e18732e872fed0c2f2427de12a622a</id>
<content type='text'>
commit dbda591d920b4c7692725b13e3f68ecb251e9080 upstream.

The transfer of -&gt;flags causes some of the static mapping virtual
addresses to be prematurely freed (before the mapping is removed) because
VM_LAZY_FREE gets "set" if tmp-&gt;flags has VM_IOREMAP set.  This might
cause subsequent vmalloc/ioremap calls to fail because it might allocate
one of the freed virtual address ranges that aren't unmapped.

va-&gt;flags has different types of flags from tmp-&gt;flags.  If a region with
VM_IOREMAP set is registered with vm_area_add_early(), it will be removed
by __purge_vmap_area_lazy().

Fix vmalloc_init() to correctly initialize vmap_area for the given
vm_struct.

Also initialise va-&gt;vm.  If it is not set, find_vm_area() for the early
vm regions will always fail.

Signed-off-by: KyongHo Cho &lt;pullip.cho@samsung.com&gt;
Cc: "Olav Haugan" &lt;ohaugan@codeaurora.org&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: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>mm/vmalloc.c: change void* into explict vm_struct*</title>
<updated>2012-06-10T13:41:46Z</updated>
<author>
<name>Minchan Kim</name>
<email>minchan@kernel.org</email>
</author>
<published>2012-01-10T23:08:39Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=15db5b6a476408a1a4b165e1786874be5aa8e242'/>
<id>urn:sha1:15db5b6a476408a1a4b165e1786874be5aa8e242</id>
<content type='text'>
commit db1aecafef58b5dda39c4228debe2c845e4a27ab upstream.

vmap_area-&gt;private is void* but we don't use the field for various purpose
but use only for vm_struct.  So change it to a vm_struct* with naming to
improve for readability and type checking.

Signed-off-by: Minchan Kim &lt;minchan@kernel.org&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&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: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>mm/vmalloc.c: remove static declaration of va from __get_vm_area_node</title>
<updated>2011-12-20T18:25:04Z</updated>
<author>
<name>Kautuk Consul</name>
<email>consul.kautuk@gmail.com</email>
</author>
<published>2011-12-20T01:12:04Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=0006526d78e93c3684c806bf7cf3f67dfa49c3c8'/>
<id>urn:sha1:0006526d78e93c3684c806bf7cf3f67dfa49c3c8</id>
<content type='text'>
Static storage is not required for the struct vmap_area in
__get_vm_area_node.

Removing "static" to store this variable on the stack instead.

Signed-off-by: Kautuk Consul &lt;consul.kautuk@gmail.com&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&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>mm: vmalloc: check for page allocation failure before vmlist insertion</title>
<updated>2011-12-09T15:50:29Z</updated>
<author>
<name>Mel Gorman</name>
<email>mgorman@suse.de</email>
</author>
<published>2011-12-08T22:34:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1368edf0647ac112d8cfa6ce47257dc950c50f5c'/>
<id>urn:sha1:1368edf0647ac112d8cfa6ce47257dc950c50f5c</id>
<content type='text'>
Commit f5252e00 ("mm: avoid null pointer access in vm_struct via
/proc/vmallocinfo") adds newly allocated vm_structs to the vmlist after
it is fully initialised.  Unfortunately, it did not check that
__vmalloc_area_node() successfully populated the area.  In the event of
allocation failure, the vmalloc area is freed but the pointer to freed
memory is inserted into the vmlist leading to a a crash later in
get_vmalloc_info().

This patch adds a check for ____vmalloc_area_node() failure within
__vmalloc_node_range.  It does not use "goto fail" as in the previous
error path as a warning was already displayed by __vmalloc_area_node()
before it called vfree in its failure path.

Credit goes to Luciano Chavez for doing all the real work of identifying
exactly where the problem was.

Signed-off-by: Mel Gorman &lt;mgorman@suse.de&gt;
Reported-by: Luciano Chavez &lt;lnx1138@linux.vnet.ibm.com&gt;
Tested-by: Luciano Chavez &lt;lnx1138@linux.vnet.ibm.com&gt;
Reviewed-by: Rik van Riel &lt;riel@redhat.com&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;		[3.1.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>
<entry>
<title>xen: map foreign pages for shared rings by updating the PTEs directly</title>
<updated>2011-11-16T17:13:08Z</updated>
<author>
<name>David Vrabel</name>
<email>david.vrabel@citrix.com</email>
</author>
<published>2011-09-29T15:53:32Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=cd12909cb576d37311fe35868780e82d5007d0c8'/>
<id>urn:sha1:cd12909cb576d37311fe35868780e82d5007d0c8</id>
<content type='text'>
When mapping a foreign page with xenbus_map_ring_valloc() with the
GNTTABOP_map_grant_ref hypercall, set the GNTMAP_contains_pte flag and
pass a pointer to the PTE (in init_mm).

After the page is mapped, the usual fault mechanism can be used to
update additional MMs.  This allows the vmalloc_sync_all() to be
removed from alloc_vm_area().

Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
Acked-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
[v1: Squashed fix by Michal for no-mmu case]
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
</content>
</entry>
<entry>
<title>mm/vmalloc.c: report more vmalloc failures</title>
<updated>2011-11-01T00:30:48Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2011-11-01T00:08:48Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=de7d2b567d040e3b67fe7121945982f14343213d'/>
<id>urn:sha1:de7d2b567d040e3b67fe7121945982f14343213d</id>
<content type='text'>
Some vmalloc failure paths do not report OOM conditions.

Add warn_alloc_failed, which also does a dump_stack, to those failure
paths.

This allows more site specific vmalloc failure logging message printks to
be removed.

Signed-off-by: Joe Perches &lt;joe@perches.com&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>mm: neaten warn_alloc_failed</title>
<updated>2011-11-01T00:30:48Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2011-11-01T00:08:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3ee9a4f086716d792219c021e8509f91165a4128'/>
<id>urn:sha1:3ee9a4f086716d792219c021e8509f91165a4128</id>
<content type='text'>
Add __attribute__((format (printf...) to the function to validate format
and arguments.  Use vsprintf extension %pV to avoid any possible message
interleaving.  Coalesce format string.  Convert printks/pr_warning to
pr_warn.

[akpm@linux-foundation.org: use the __printf() macro]
Signed-off-by: Joe Perches &lt;joe@perches.com&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>mm: avoid null pointer access in vm_struct via /proc/vmallocinfo</title>
<updated>2011-11-01T00:30:47Z</updated>
<author>
<name>Mitsuo Hayasaka</name>
<email>mitsuo.hayasaka.hu@hitachi.com</email>
</author>
<published>2011-11-01T00:08:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f5252e009d5b87071a919221e4f6624184005368'/>
<id>urn:sha1:f5252e009d5b87071a919221e4f6624184005368</id>
<content type='text'>
The /proc/vmallocinfo shows information about vmalloc allocations in
vmlist that is a linklist of vm_struct.  It, however, may access pages
field of vm_struct where a page was not allocated.  This results in a null
pointer access and leads to a kernel panic.

Why this happens: In __vmalloc_node_range() called from vmalloc(), newly
allocated vm_struct is added to vmlist at __get_vm_area_node() and then,
some fields of vm_struct such as nr_pages and pages are set at
__vmalloc_area_node().  In other words, it is added to vmlist before it is
fully initialized.  At the same time, when the /proc/vmallocinfo is read,
it accesses the pages field of vm_struct according to the nr_pages field
at show_numa_info().  Thus, a null pointer access happens.

The patch adds the newly allocated vm_struct to the vmlist *after* it is
fully initialized.  So, it can avoid accessing the pages field with
unallocated page when show_numa_info() is called.

Signed-off-by: Mitsuo Hayasaka &lt;mitsuo.hayasaka.hu@hitachi.com&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Cc: Namhyung Kim &lt;namhyung@gmail.com&gt;
Cc: "Paul E. McKenney" &lt;paulmck@linux.vnet.ibm.com&gt;
Cc: Jeremy Fitzhardinge &lt;jeremy.fitzhardinge@citrix.com&gt;
Cc: &lt;stable@kernel.org&gt;
Cc: &lt;stable@vger.kernel.org&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>mm: sync vmalloc address space page tables in alloc_vm_area()</title>
<updated>2011-09-15T01:09:38Z</updated>
<author>
<name>David Vrabel</name>
<email>david.vrabel@citrix.com</email>
</author>
<published>2011-09-14T23:22:02Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=461ae488ecb125b140d7ea29ceeedbcce9327003'/>
<id>urn:sha1:461ae488ecb125b140d7ea29ceeedbcce9327003</id>
<content type='text'>
Xen backend drivers (e.g., blkback and netback) would sometimes fail to
map grant pages into the vmalloc address space allocated with
alloc_vm_area().  The GNTTABOP_map_grant_ref would fail because Xen could
not find the page (in the L2 table) containing the PTEs it needed to
update.

(XEN) mm.c:3846:d0 Could not find L1 PTE for address fbb42000

netback and blkback were making the hypercall from a kernel thread where
task-&gt;active_mm != &amp;init_mm and alloc_vm_area() was only updating the page
tables for init_mm.  The usual method of deferring the update to the page
tables of other processes (i.e., after taking a fault) doesn't work as a
fault cannot occur during the hypercall.

This would work on some systems depending on what else was using vmalloc.

Fix this by reverting ef691947d8a3 ("vmalloc: remove vmalloc_sync_all()
from alloc_vm_area()") and add a comment to explain why it's needed.

Signed-off-by: David Vrabel &lt;david.vrabel@citrix.com&gt;
Cc: Jeremy Fitzhardinge &lt;jeremy.fitzhardinge@citrix.com&gt;
Cc: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
Cc: Ian Campbell &lt;Ian.Campbell@citrix.com&gt;
Cc: Keir Fraser &lt;keir.xen@gmail.com&gt;
Cc: &lt;stable@kernel.org&gt;		[3.0.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>
<entry>
<title>mm: fix wrong vmap address calculations with odd NR_CPUS values</title>
<updated>2011-08-14T19:32:52Z</updated>
<author>
<name>Clemens Ladisch</name>
<email>clemens@ladisch.de</email>
</author>
<published>2011-06-21T20:09:50Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f982f91516fa4cfd9d20518833cd04ad714585be'/>
<id>urn:sha1:f982f91516fa4cfd9d20518833cd04ad714585be</id>
<content type='text'>
Commit db64fe02258f ("mm: rewrite vmap layer") introduced code that does
address calculations under the assumption that VMAP_BLOCK_SIZE is a
power of two.  However, this might not be true if CONFIG_NR_CPUS is not
set to a power of two.

Wrong vmap_block index/offset values could lead to memory corruption.
However, this has never been observed in practice (or never been
diagnosed correctly); what caught this was the BUG_ON in vb_alloc() that
checks for inconsistent vmap_block indices.

To fix this, ensure that VMAP_BLOCK_SIZE always is a power of two.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=31572
Reported-by: Pavel Kysilka &lt;goldenfish@linuxsoft.cz&gt;
Reported-by: Matias A. Fonzo &lt;selk@dragora.org&gt;
Signed-off-by: Clemens Ladisch &lt;clemens@ladisch.de&gt;
Signed-off-by: Stefan Richter &lt;stefanr@s5r6.in-berlin.de&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&gt;
Cc: Jeremy Fitzhardinge &lt;jeremy@goop.org&gt;
Cc: Krzysztof Helt &lt;krzysztof.h1@poczta.fm&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: 2.6.28+ &lt;stable@kernel.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
