<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/android, branch v5.4</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.4</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-10-17T12:58:44Z</updated>
<entry>
<title>binder: Don't modify VMA bounds in -&gt;mmap handler</title>
<updated>2019-10-17T12:58:44Z</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2019-10-16T15:01:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=45d02f79b539073b76077836871de6b674e36eb4'/>
<id>urn:sha1:45d02f79b539073b76077836871de6b674e36eb4</id>
<content type='text'>
binder_mmap() tries to prevent the creation of overly big binder mappings
by silently truncating the size of the VMA to 4MiB. However, this violates
the API contract of mmap(). If userspace attempts to create a large binder
VMA, and later attempts to unmap that VMA, it will call munmap() on a range
beyond the end of the VMA, which may have been allocated to another VMA in
the meantime. This can lead to userspace memory corruption.

The following sequence of calls leads to a segfault without this commit:

int main(void) {
  int binder_fd = open("/dev/binder", O_RDWR);
  if (binder_fd == -1) err(1, "open binder");
  void *binder_mapping = mmap(NULL, 0x800000UL, PROT_READ, MAP_SHARED,
                              binder_fd, 0);
  if (binder_mapping == MAP_FAILED) err(1, "mmap binder");
  void *data_mapping = mmap(NULL, 0x400000UL, PROT_READ|PROT_WRITE,
                            MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
  if (data_mapping == MAP_FAILED) err(1, "mmap data");
  munmap(binder_mapping, 0x800000UL);
  *(char*)data_mapping = 1;
  return 0;
}

Cc: stable@vger.kernel.org
Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Link: https://lore.kernel.org/r/20191016150119.154756-1-jannh@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: Fix comment headers on binder_alloc_prepare_to_free()</title>
<updated>2019-10-10T12:39:23Z</updated>
<author>
<name>Joel Fernandes (Google)</name>
<email>joel@joelfernandes.org</email>
</author>
<published>2019-09-30T20:12:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5dc54a06f6e575f146492661129d24f3b50d17bb'/>
<id>urn:sha1:5dc54a06f6e575f146492661129d24f3b50d17bb</id>
<content type='text'>
binder_alloc_buffer_lookup() doesn't exist and is named
"binder_alloc_prepare_to_free()". Correct the code comments to reflect
this.

Signed-off-by: Joel Fernandes (Google) &lt;joel@joelfernandes.org&gt;
Reviewed-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Link: https://lore.kernel.org/r/20190930201250.139554-1-joel@joelfernandes.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: prevent UAF read in print_binder_transaction_log_entry()</title>
<updated>2019-10-10T12:39:22Z</updated>
<author>
<name>Christian Brauner</name>
<email>christian.brauner@ubuntu.com</email>
</author>
<published>2019-10-08T13:01:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=51d8a7eca67784b155a07aeab4bfb9f63ebaaf9e'/>
<id>urn:sha1:51d8a7eca67784b155a07aeab4bfb9f63ebaaf9e</id>
<content type='text'>
When a binder transaction is initiated on a binder device coming from a
binderfs instance, a pointer to the name of the binder device is stashed
in the binder_transaction_log_entry's context_name member. Later on it
is used to print the name in print_binder_transaction_log_entry(). By
the time print_binder_transaction_log_entry() accesses context_name
binderfs_evict_inode() might have already freed the associated memory
thereby causing a UAF. Do the simple thing and prevent this by copying
the name of the binder device instead of stashing a pointer to it.

Reported-by: Jann Horn &lt;jannh@google.com&gt;
Fixes: 03e2e07e3814 ("binder: Make transaction_log available in binderfs")
Link: https://lore.kernel.org/r/CAG48ez14Q0-F8LqsvcNbyR2o6gPW8SHXsm4u5jmD9MpsteM2Tw@mail.gmail.com
Signed-off-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Reviewed-by: Joel Fernandes (Google) &lt;joel@joelfernandes.org&gt;
Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Reviewed-by: Hridya Valsaraju &lt;hridya@google.com&gt;
Link: https://lore.kernel.org/r/20191008130159.10161-1-christian.brauner@ubuntu.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: Add binder_proc logging to binderfs</title>
<updated>2019-09-04T11:31:26Z</updated>
<author>
<name>Hridya Valsaraju</name>
<email>hridya@google.com</email>
</author>
<published>2019-09-03T16:16:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4feb80faf428a02d407a9ea1952004af01308765'/>
<id>urn:sha1:4feb80faf428a02d407a9ea1952004af01308765</id>
<content type='text'>
Currently /sys/kernel/debug/binder/proc contains
the debug data for every binder_proc instance.
This patch makes this information also available
in a binderfs instance mounted with a mount option
"stats=global" in addition to debugfs. The patch does
not affect the presence of the file in debugfs.

If a binderfs instance is mounted at path /dev/binderfs,
this file would be present at /dev/binderfs/binder_logs/proc.
This change provides an alternate way to access this file when debugfs
is not mounted.

Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Hridya Valsaraju &lt;hridya@google.com&gt;
Link: https://lore.kernel.org/r/20190903161655.107408-5-hridya@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: Make transaction_log available in binderfs</title>
<updated>2019-09-04T11:31:22Z</updated>
<author>
<name>Hridya Valsaraju</name>
<email>hridya@google.com</email>
</author>
<published>2019-09-03T16:16:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=03e2e07e38147917482d595ad3cf193212ded8ac'/>
<id>urn:sha1:03e2e07e38147917482d595ad3cf193212ded8ac</id>
<content type='text'>
Currently, the binder transaction log files 'transaction_log'
and 'failed_transaction_log' live in debugfs at the following locations:

/sys/kernel/debug/binder/failed_transaction_log
/sys/kernel/debug/binder/transaction_log

This patch makes these files also available in a binderfs instance
mounted with the mount option "stats=global".
It does not affect the presence of these files in debugfs.
If a binderfs instance is mounted at path /dev/binderfs, the location of
these files will be as follows:

/dev/binderfs/binder_logs/failed_transaction_log
/dev/binderfs/binder_logs/transaction_log

This change provides an alternate option to access these files when
debugfs is not mounted.

Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Hridya Valsaraju &lt;hridya@google.com&gt;
Link: https://lore.kernel.org/r/20190903161655.107408-4-hridya@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: Add stats, state and transactions files</title>
<updated>2019-09-04T11:31:18Z</updated>
<author>
<name>Hridya Valsaraju</name>
<email>hridya@google.com</email>
</author>
<published>2019-09-03T16:16:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0e13e452dafc009049a9a5a4153e2f9e51b23915'/>
<id>urn:sha1:0e13e452dafc009049a9a5a4153e2f9e51b23915</id>
<content type='text'>
The following binder stat files currently live in debugfs.

/sys/kernel/debug/binder/state
/sys/kernel/debug/binder/stats
/sys/kernel/debug/binder/transactions

This patch makes these files available in a binderfs instance
mounted with the mount option 'stats=global'. For example, if a binderfs
instance is mounted at path /dev/binderfs, the above files will be
available at the following locations:

/dev/binderfs/binder_logs/state
/dev/binderfs/binder_logs/stats
/dev/binderfs/binder_logs/transactions

This provides a way to access them even when debugfs is not mounted.

Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Hridya Valsaraju &lt;hridya@google.com&gt;
Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Link: https://lore.kernel.org/r/20190903161655.107408-3-hridya@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: add a mount option to show global stats</title>
<updated>2019-09-04T11:31:13Z</updated>
<author>
<name>Hridya Valsaraju</name>
<email>hridya@google.com</email>
</author>
<published>2019-09-03T16:16:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f00834518ed3194b866f5f3d63b71e0ed7f6bc00'/>
<id>urn:sha1:f00834518ed3194b866f5f3d63b71e0ed7f6bc00</id>
<content type='text'>
Currently, all binder state and statistics live in debugfs.
We need this information even when debugfs is not mounted.
This patch adds the mount option 'stats' to enable a binderfs
instance to have binder debug information present in the same.
'stats=global' will enable the global binder statistics. In
the future, 'stats=local' will enable binder statistics local
to the binderfs instance. The two modes 'global' and 'local'
will be mutually exclusive. 'stats=global' option is only available
for a binderfs instance mounted in the initial user namespace.
An attempt to use the option to mount a binderfs instance in
another user namespace will return an EPERM error.

Signed-off-by: Hridya Valsaraju &lt;hridya@google.com&gt;
Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Link: https://lore.kernel.org/r/20190903161655.107408-2-hridya@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: Add default binder devices through binderfs when configured</title>
<updated>2019-09-04T11:17:35Z</updated>
<author>
<name>Hridya Valsaraju</name>
<email>hridya@google.com</email>
</author>
<published>2019-09-04T11:07:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ca2864c6e8965c37df97f11e6f99e83e09806b1c'/>
<id>urn:sha1:ca2864c6e8965c37df97f11e6f99e83e09806b1c</id>
<content type='text'>
Currently, since each binderfs instance needs its own
private binder devices, every time a binderfs instance is
mounted, all the default binder devices need to be created
via the BINDER_CTL_ADD IOCTL. This patch aims to
add a solution to automatically create the default binder
devices for each binderfs instance that gets mounted.
To achieve this goal, when CONFIG_ANDROID_BINDERFS is set,
the default binder devices specified by CONFIG_ANDROID_BINDER_DEVICES
are created in each binderfs instance instead of global devices
being created by the binder driver.

Co-developed-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Hridya Valsaraju &lt;hridya@google.com&gt;
Reviewed-by: Joel Fernandes (Google) &lt;joel@joelfernandes.org&gt;
Link: https://lore.kernel.org/r/20190808222727.132744-2-hridya@google.com
Link: https://lore.kernel.org/r/20190904110704.8606-2-christian.brauner@ubuntu.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: Validate the default binderfs device names.</title>
<updated>2019-09-04T11:17:35Z</updated>
<author>
<name>Hridya Valsaraju</name>
<email>hridya@google.com</email>
</author>
<published>2019-09-04T11:07:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=028fb5822b76bc2e095b5c145d7bd263878d9e27'/>
<id>urn:sha1:028fb5822b76bc2e095b5c145d7bd263878d9e27</id>
<content type='text'>
Length of a binderfs device name cannot exceed BINDERFS_MAX_NAME.
This patch adds a check in binderfs_init() to ensure the same
for the default binder devices that will be created in every
binderfs instance.

Co-developed-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Hridya Valsaraju &lt;hridya@google.com&gt;
Reviewed-by: Joel Fernandes (Google) &lt;joel@joelfernandes.org&gt;
Link: https://lore.kernel.org/r/20190808222727.132744-3-hridya@google.com
Link: https://lore.kernel.org/r/20190904110704.8606-3-christian.brauner@ubuntu.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: prevent transactions to context manager from its own process.</title>
<updated>2019-07-24T09:02:28Z</updated>
<author>
<name>Hridya Valsaraju</name>
<email>hridya@google.com</email>
</author>
<published>2019-07-15T19:18:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=49ed96943a8e0c62cc5a9b0a6cfc88be87d1fcec'/>
<id>urn:sha1:49ed96943a8e0c62cc5a9b0a6cfc88be87d1fcec</id>
<content type='text'>
Currently, a transaction to context manager from its own process
is prevented by checking if its binder_proc struct is the same as
that of the sender. However, this would not catch cases where the
process opens the binder device again and uses the new fd to send
a transaction to the context manager.

Reported-by: syzbot+8b3c354d33c4ac78bfad@syzkaller.appspotmail.com
Signed-off-by: Hridya Valsaraju &lt;hridya@google.com&gt;
Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Link: https://lore.kernel.org/r/20190715191804.112933-1-hridya@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
