<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/android, branch v5.1</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.1</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.1'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-03-21T05:51:32Z</updated>
<entry>
<title>binder: fix race between munmap() and direct reclaim</title>
<updated>2019-03-21T05:51:32Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@android.com</email>
</author>
<published>2019-03-01T23:06:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5cec2d2e5839f9c0fec319c523a911e0a7fd299f'/>
<id>urn:sha1:5cec2d2e5839f9c0fec319c523a911e0a7fd299f</id>
<content type='text'>
An munmap() on a binder device causes binder_vma_close() to be called
which clears the alloc-&gt;vma pointer.

If direct reclaim causes binder_alloc_free_page() to be called, there
is a race where alloc-&gt;vma is read into a local vma pointer and then
used later after the mm-&gt;mmap_sem is acquired. This can result in
calling zap_page_range() with an invalid vma which manifests as a
use-after-free in zap_page_range().

The fix is to check alloc-&gt;vma after acquiring the mmap_sem (which we
were acquiring anyway) and skip zap_page_range() if it has changed
to NULL.

Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Reviewed-by: Joel Fernandes (Google) &lt;joel@joelfernandes.org&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: fix BUG_ON found by selinux-testsuite</title>
<updated>2019-03-21T05:50:47Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@android.com</email>
</author>
<published>2019-03-20T22:35:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5997da82145bb7c9a56d834894cb81f81f219344'/>
<id>urn:sha1:5997da82145bb7c9a56d834894cb81f81f219344</id>
<content type='text'>
The selinux-testsuite found an issue resulting in a BUG_ON()
where a conditional relied on a size_t going negative when
checking the validity of a buffer offset.

Fixes: 7a67a39320df ("binder: add function to copy binder object from buffer")
Reported-by: Paul Moore &lt;paul@paul-moore.com&gt;
Tested-by: Paul Moore &lt;paul@paul-moore.com&gt;
Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: reduce mmap_sem write-side lock</title>
<updated>2019-02-19T13:50:11Z</updated>
<author>
<name>Minchan Kim</name>
<email>minchan@kernel.org</email>
</author>
<published>2019-02-18T08:11:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3013bf62b67aef921bc2e9ba10e639a022002d02'/>
<id>urn:sha1:3013bf62b67aef921bc2e9ba10e639a022002d02</id>
<content type='text'>
binder has used write-side mmap_sem semaphore to release memory
mapped at address space of the process. However, right lock to
release pages is down_read, not down_write because page table lock
already protects the race for parallel freeing.

Please do not use mmap_sem write-side lock which is well known
contented lock.

Cc: Todd Kjos &lt;tkjos@google.com&gt;
Cc: Martijn Coenen &lt;maco@android.com&gt;
Cc: Arve Hjønnevåg &lt;arve@android.com&gt;
Signed-off-by: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: fix handling of misaligned binder object</title>
<updated>2019-02-15T07:49:20Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@android.com</email>
</author>
<published>2019-02-14T23:22:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=26528be6720bb40bc8844e97ee73a37e530e9c5e'/>
<id>urn:sha1:26528be6720bb40bc8844e97ee73a37e530e9c5e</id>
<content type='text'>
Fixes crash found by syzbot:
kernel BUG at drivers/android/binder_alloc.c:LINE! (2)

Reported-and-tested-by: syzbot+55de1eb4975dec156d8f@syzkaller.appspotmail.com
Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: fix sparse issue in binder_alloc_selftest.c</title>
<updated>2019-02-14T07:13:56Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@android.com</email>
</author>
<published>2019-02-13T19:48:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=36f30937922ce75390c73f99e650e4f2eb56b0e6'/>
<id>urn:sha1:36f30937922ce75390c73f99e650e4f2eb56b0e6</id>
<content type='text'>
Fixes sparse issues reported by the kbuild test robot running
on https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
char-misc-testing: bde4a19fc04f5 ("binder: use userspace pointer as base
of buffer space")

Error output (drivers/android/binder_alloc_selftest.c):
sparse: warning: incorrect type in assignment (different address spaces)
sparse:    expected void *page_addr
sparse:    got void [noderef] &lt;asn:1&gt; *user_data
sparse: error: subtraction of different types can't work

Fixed by adding necessary "__user" tags.

Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: use userspace pointer as base of buffer space</title>
<updated>2019-02-12T09:43:57Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@android.com</email>
</author>
<published>2019-02-08T18:35:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bde4a19fc04f5f46298c86b1acb7a4af1d5f138d'/>
<id>urn:sha1:bde4a19fc04f5f46298c86b1acb7a4af1d5f138d</id>
<content type='text'>
Now that alloc-&gt;buffer points to the userspace vm_area
rename buffer-&gt;data to buffer-&gt;user_data and rename
local pointers that hold user addresses. Also use the
"__user" tag to annotate all user pointers so sparse
can flag cases where user pointer vaues  are copied to
kernel pointers. Refactor code to use offsets instead
of user pointers.

Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: remove user_buffer_offset</title>
<updated>2019-02-12T09:43:57Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@android.com</email>
</author>
<published>2019-02-08T18:35:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c41358a5f5217abd7c051e8d42397e5b80f3b3ed'/>
<id>urn:sha1:c41358a5f5217abd7c051e8d42397e5b80f3b3ed</id>
<content type='text'>
Remove user_buffer_offset since there is no kernel
buffer pointer anymore.

Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: remove kernel vm_area for buffer space</title>
<updated>2019-02-12T09:43:57Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@android.com</email>
</author>
<published>2019-02-08T18:35:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=880211667b203dd32724f3be224c44c0400aa0a6'/>
<id>urn:sha1:880211667b203dd32724f3be224c44c0400aa0a6</id>
<content type='text'>
Remove the kernel's vm_area and the code that maps
buffer pages into it.

Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: avoid kernel vm_area for buffer fixups</title>
<updated>2019-02-12T09:43:57Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@android.com</email>
</author>
<published>2019-02-08T18:35:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=db6b0b810bf945d1991917ffce0e93383101f2fa'/>
<id>urn:sha1:db6b0b810bf945d1991917ffce0e93383101f2fa</id>
<content type='text'>
Refactor the functions to validate and fixup struct
binder_buffer pointer objects to avoid using vm_area
pointers. Instead copy to/from kernel space using
binder_alloc_copy_to_buffer() and
binder_alloc_copy_from_buffer(). The following
functions were refactored:

	refactor binder_validate_ptr()
	binder_validate_fixup()
	binder_fixup_parent()

Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: add function to copy binder object from buffer</title>
<updated>2019-02-12T09:43:57Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@android.com</email>
</author>
<published>2019-02-08T18:35:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7a67a39320dfba4b36d3be5dae4581194e650316'/>
<id>urn:sha1:7a67a39320dfba4b36d3be5dae4581194e650316</id>
<content type='text'>
When creating or tearing down a transaction, the binder driver
examines objects in the buffer and takes appropriate action.
To do this without needing to dereference pointers into the
buffer, the local copies of the objects are needed. This patch
introduces a function to validate and copy binder objects
from the buffer to a local structure.

Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
