binder: Fix memory corruption via page aliasing
authorChristopher Lais <chris+android@zenthought.org>
Sat, 1 May 2010 20:51:48 +0000 (15:51 -0500)
committerColin Cross <ccross@android.com>
Thu, 30 Sep 2010 00:49:34 +0000 (17:49 -0700)
commit9f69ebbf404cf49f9275c1310f1be8f303c87c9b
tree9cd2d9e8d9b3d27fee00402ac4674132d66e3801
parent28633d10f9a9a0b9c315d244f2402c53375f77db
binder: Fix memory corruption via page aliasing

binder_deferred_release was not unmapping the page from the buffer
before freeing it, causing memory corruption.  This only happened
when page(s) had not been freed by binder_update_page_range, which
properly unmaps the pages.

This only happens on architectures with VIPT aliasing.

To reproduce, create a program which opens, mmaps, munmaps, then closes
the binder very quickly.  This should leave a page allocated when the
binder is released.  When binder_deferrred_release is called on the
close, the page will remain mapped to the address in the linear
proc->buffer.  Later, we may map the same physical page to a different
virtual address that has different coloring, and this may cause
aliasing to occur.

PAGE_POISONING will greatly increase your chances of noticing any
problems.

Change-Id: I6941bf212881b8bf846bdfda43d3609c7ae4892e

Signed-off-by: Christopher Lais <chris+android@zenthought.org>
drivers/staging/android/binder.c