<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/android/binder.c, branch v5.19</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.19</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.19'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2022-06-06T00:14:03Z</updated>
<entry>
<title>Merge tag 'pull-work.fd-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs</title>
<updated>2022-06-06T00:14:03Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-06-06T00:14:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6684cf42906ff5f44580e16a1f898e89c19aabd5'/>
<id>urn:sha1:6684cf42906ff5f44580e16a1f898e89c19aabd5</id>
<content type='text'>
Pull file descriptor fix from Al Viro:
 "Fix for breakage in #work.fd this window"

* tag 'pull-work.fd-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  fix the breakage in close_fd_get_file() calling conventions change
</content>
</entry>
<entry>
<title>fix the breakage in close_fd_get_file() calling conventions change</title>
<updated>2022-06-05T19:03:03Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2022-06-05T18:01:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=40a1926022d128057376d35167128a7c74e3dca4'/>
<id>urn:sha1:40a1926022d128057376d35167128a7c74e3dca4</id>
<content type='text'>
It used to grab an extra reference to struct file rather than
just transferring to caller the one it had removed from descriptor
table.  New variant doesn't, and callers need to be adjusted.

Reported-and-tested-by: syzbot+47dd250f527cb7bebf24@syzkaller.appspotmail.com
Fixes: 6319194ec57b ("Unify the primitives for file descriptor closing")
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>Merge tag 'pull-18-rc1-work.fd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs</title>
<updated>2022-06-05T01:52:00Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-06-05T01:52:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dbe0ee46614016146c1b3e1fc063b44333bb2401'/>
<id>urn:sha1:dbe0ee46614016146c1b3e1fc063b44333bb2401</id>
<content type='text'>
Pull file descriptor updates from Al Viro.

 - Descriptor handling cleanups

* tag 'pull-18-rc1-work.fd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  Unify the primitives for file descriptor closing
  fs: remove fget_many and fput_many interface
  io_uring_enter(): don't leave f.flags uninitialized
</content>
</entry>
<entry>
<title>binder: fix atomic sleep when get extended error</title>
<updated>2022-05-19T16:41:33Z</updated>
<author>
<name>Schspa Shi</name>
<email>schspa@gmail.com</email>
</author>
<published>2022-05-18T01:17:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=aed86f8add0e3f63a033861f247c9ae956b72c92'/>
<id>urn:sha1:aed86f8add0e3f63a033861f247c9ae956b72c92</id>
<content type='text'>
binder_inner_proc_lock(thread-&gt;proc) is a spin lock, copy_to_user can't
be called with in this lock.

Copy it as a local variable to fix it.

Fixes: bd32889e841c ("binder: add BINDER_GET_EXTENDED_ERROR ioctl")
Reported-by: syzbot+46fff6434a7f968ecb39@syzkaller.appspotmail.com
Reviewed-by: Carlos Llamas &lt;cmllamas@google.com&gt;
Signed-off-by: Schspa Shi &lt;schspa@gmail.com&gt;
Link: https://lore.kernel.org/r/20220518011754.49348-1-schspa@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: fix potential UAF of target_{proc,thread}</title>
<updated>2022-05-19T16:41:26Z</updated>
<author>
<name>Carlos Llamas</name>
<email>cmllamas@google.com</email>
</author>
<published>2022-05-17T18:58:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dafa5e9ab8b5b31d64c0ded188d95f8bb6be9746'/>
<id>urn:sha1:dafa5e9ab8b5b31d64c0ded188d95f8bb6be9746</id>
<content type='text'>
Commit 9474be34a727 ("binder: add failed transaction logging info")
dereferences target_{proc,thread} after they have been potentially
freed by binder_proc_dec_tmpref() and binder_thread_dec_tmpref().

This patch delays the release of the two references after their last
usage. Fixes the following two errors reported by smatch:

  drivers/android/binder.c:3562 binder_transaction() error: dereferencing freed memory 'target_proc'
  drivers/android/binder.c:3563 binder_transaction() error: dereferencing freed memory 'target_thread'

Fixes: 9474be34a727 ("binder: add failed transaction logging info")
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Carlos Llamas &lt;cmllamas@google.com&gt;
Link: https://lore.kernel.org/r/20220517185817.598872-1-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: fix printk format for commands</title>
<updated>2022-05-19T16:41:11Z</updated>
<author>
<name>Carlos Llamas</name>
<email>cmllamas@google.com</email>
</author>
<published>2022-05-09T23:19:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=da4864962d768b33e3bc31cd233270af6226686d'/>
<id>urn:sha1:da4864962d768b33e3bc31cd233270af6226686d</id>
<content type='text'>
Make sure we use unsigned format specifier %u for binder commands as
most of them are encoded above INT_MAX. This prevents negative values
when logging them as in the following case:

[  211.895781] binder: 8668:8668 BR_REPLY 258949 0:0, cmd -2143260157 size 0-0 ptr 0000006e766a8000-0000006e766a8000

Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Acked-by: Christian Brauner (Microsoft) &lt;brauner@kernel.org&gt;
Signed-off-by: Carlos Llamas &lt;cmllamas@google.com&gt;
Link: https://lore.kernel.org/r/20220509231901.3852573-1-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Unify the primitives for file descriptor closing</title>
<updated>2022-05-14T22:49:01Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2022-05-12T21:08:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6319194ec57b0452dcda4589d24c4e7db299c5bf'/>
<id>urn:sha1:6319194ec57b0452dcda4589d24c4e7db299c5bf</id>
<content type='text'>
Currently we have 3 primitives for removing an opened file from descriptor
table - pick_file(), __close_fd_get_file() and close_fd_get_file().  Their
calling conventions are rather odd and there's a code duplication for no
good reason.  They can be unified -

1) have __range_close() cap max_fd in the very beginning; that way
we don't need separate way for pick_file() to report being past the end
of descriptor table.

2) make {__,}close_fd_get_file() return file (or NULL) directly, rather
than returning it via struct file ** argument.  Don't bother with
(bogus) return value - nobody wants that -ENOENT.

3) make pick_file() return NULL on unopened descriptor - the only caller
that used to care about the distinction between descriptor past the end
of descriptor table and finding NULL in descriptor table doesn't give
a damn after (1).

4) lift -&gt;files_lock out of pick_file()

That actually simplifies the callers, as well as the primitives themselves.
Code duplication is also gone...

Reviewed-by: Christian Brauner (Microsoft) &lt;brauner@kernel.org&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>binder: additional transaction error logs</title>
<updated>2022-05-09T13:43:24Z</updated>
<author>
<name>Carlos Llamas</name>
<email>cmllamas@google.com</email>
</author>
<published>2022-04-29T23:56:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a15dac8b228677daf8ad7f9855d38734ffa0e7d9'/>
<id>urn:sha1:a15dac8b228677daf8ad7f9855d38734ffa0e7d9</id>
<content type='text'>
Log readable and specific error messages whenever a transaction failure
happens. This will ensure better context is given to regular users about
these unique error cases, without having to decode a cryptic log.

Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Acked-by: Christian Brauner (Microsoft) &lt;brauner@kernel.org&gt;
Signed-off-by: Carlos Llamas &lt;cmllamas@google.com&gt;
Link: https://lore.kernel.org/r/20220429235644.697372-6-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: convert logging macros into functions</title>
<updated>2022-05-09T13:43:24Z</updated>
<author>
<name>Carlos Llamas</name>
<email>cmllamas@google.com</email>
</author>
<published>2022-04-29T23:56:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=06a3494ef61a9c67a5be068a74bc5d3ab9d72a4c'/>
<id>urn:sha1:06a3494ef61a9c67a5be068a74bc5d3ab9d72a4c</id>
<content type='text'>
Converting binder_debug() and binder_user_error() macros into functions
reduces the overall object size by 16936 bytes when cross-compiled with
aarch64-linux-gnu-gcc 11.2.0:

$ size drivers/android/binder.o.{old,new}
   text	   data	    bss	    dec	    hex	filename
  77935	   6168	  20264	 104367	  197af	drivers/android/binder.o.old
  65551	   1616	  20264	  87431	  15587	drivers/android/binder.o.new

This is particularly beneficial to functions binder_transaction() and
binder_thread_write() which repeatedly use these macros and are both
part of the critical path for all binder transactions.

$ nm --size vmlinux.{old,new} |grep ' binder_transaction$'
0000000000002f60 t binder_transaction
0000000000002358 t binder_transaction

$ nm --size vmlinux.{old,new} |grep binder_thread_write
0000000000001c54 t binder_thread_write
00000000000014a8 t binder_thread_write

Acked-by: Christian Brauner (Microsoft) &lt;brauner@kernel.org&gt;
Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Carlos Llamas &lt;cmllamas@google.com&gt;
Link: https://lore.kernel.org/r/20220429235644.697372-5-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: add BINDER_GET_EXTENDED_ERROR ioctl</title>
<updated>2022-05-09T13:43:24Z</updated>
<author>
<name>Carlos Llamas</name>
<email>cmllamas@google.com</email>
</author>
<published>2022-04-29T23:56:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bd32889e841c12533d09a1bd02bba932baa9ed8f'/>
<id>urn:sha1:bd32889e841c12533d09a1bd02bba932baa9ed8f</id>
<content type='text'>
Provide a userspace mechanism to pull precise error information upon
failed operations. Extending the current error codes returned by the
interfaces allows userspace to better determine the course of action.
This could be for instance, retrying a failed transaction at a later
point and thus offloading the error handling from the driver.

Acked-by: Christian Brauner (Microsoft) &lt;brauner@kernel.org&gt;
Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Carlos Llamas &lt;cmllamas@google.com&gt;
Link: https://lore.kernel.org/r/20220429235644.697372-3-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
