linux/mm
Michael Hennerich 4016a1390d mm/nommu.c: return 0 from kobjsize with invalid objects
Don't perform kobjsize operations on objects the kernel doesn't manage.

On Blackfin, drivers can get dma coherent memory by calling a function
dma_alloc_coherent(). We do this in nommu by configuring a chunk of uncached
memory at the top of memory.

Since we don't want the kernel to use the uncached memory, we lie to the
kernel, and tell it that it's max memory is between 0, and the start of the
uncached dma coherent section.

this all works well, until this memory gets exposed into userspace (with a
frame buffer), when you look at the process's maps, it shows the framebuf:

root:/proc> cat maps
[snip]
03f0ef00-03f34700 rw-p 00000000 1f:00 192        /dev/fb0
root:/proc>

This is outside the "normal" range for the kernel. When the kernel tries to
find the size of this object (when you run ps), it dies in nommu.c in
kobjsize.

BUG_ON(page->index >= MAX_ORDER);

since the page we are referring to is outside what the kernel thinks is it's
max valid memory.

root:~> while [ 1 ]; ps > /dev/null; done
kernel BUG at mm/nommu.c:119!
Kernel panic - not syncing: BUG!

We fixed this by adding a check to reject out of range object pointers as it
already does that for NULL pointers.

Signed-off-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:26 -07:00
..
Kconfig
Makefile
allocpercpu.c
backing-dev.c
bootmem.c memory hotplug: make alloc_bootmem_section() 2008-04-28 08:58:25 -07:00
bounce.c
dmapool.c
fadvise.c xip: support non-struct page backed memory 2008-04-28 08:58:23 -07:00
filemap.c
filemap_xip.c xip: support non-struct page backed memory 2008-04-28 08:58:23 -07:00
fremap.c
highmem.c
hugetlb.c hugetlbfs: common code update for s390 2008-04-28 08:58:25 -07:00
internal.h memory hotplug: free memmaps allocated by bootmem 2008-04-28 08:58:26 -07:00
maccess.c
madvise.c xip: support non-struct page backed memory 2008-04-28 08:58:23 -07:00
memcontrol.c
memory.c
memory_hotplug.c memory hotplug: free memmaps allocated by bootmem 2008-04-28 08:58:26 -07:00
mempolicy.c mempolicy: use struct mempolicy pointer in shmem_sb_info 2008-04-28 08:58:25 -07:00
mempool.c
migrate.c
mincore.c
mlock.c
mmap.c mempolicy: rename mpol_copy to mpol_dup 2008-04-28 08:58:23 -07:00
mmzone.c
mprotect.c
mremap.c
msync.c
nommu.c mm/nommu.c: return 0 from kobjsize with invalid objects 2008-04-28 08:58:26 -07:00
oom_kill.c oom_kill: remove unused parameter in badness() 2008-04-28 08:58:26 -07:00
page-writeback.c
page_alloc.c mm/page_alloc.c: remove hand-coded get_order() 2008-04-28 08:58:26 -07:00
page_io.c
page_isolation.c
pagewalk.c
pdflush.c
prio_tree.c
quicklist.c
readahead.c
rmap.c
shmem.c mempolicy: use struct mempolicy pointer in shmem_sb_info 2008-04-28 08:58:25 -07:00
shmem_acl.c
slab.c
slob.c
slub.c
sparse-vmemmap.c
sparse.c memory hotplug: free memmaps allocated by bootmem 2008-04-28 08:58:26 -07:00
swap.c
swap_state.c
swapfile.c
thrash.c
tiny-shmem.c
truncate.c
util.c
vmalloc.c
vmscan.c
vmstat.c vmstats: add cond_resched() to refresh_cpu_vm_stats() 2008-04-28 08:58:26 -07:00