<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/uapi/linux/android, branch v5.15.197</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.15.197</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.15.197'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2021-09-14T06:46:08Z</updated>
<entry>
<title>binder: fix freeze race</title>
<updated>2021-09-14T06:46:08Z</updated>
<author>
<name>Li Li</name>
<email>dualli@google.com</email>
</author>
<published>2021-09-10T16:42:10Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b564171ade70570b7f335fa8ed17adb28409e3ac'/>
<id>urn:sha1:b564171ade70570b7f335fa8ed17adb28409e3ac</id>
<content type='text'>
Currently cgroup freezer is used to freeze the application threads, and
BINDER_FREEZE is used to freeze the corresponding binder interface.
There's already a mechanism in ioctl(BINDER_FREEZE) to wait for any
existing transactions to drain out before actually freezing the binder
interface.

But freezing an app requires 2 steps, freezing the binder interface with
ioctl(BINDER_FREEZE) and then freezing the application main threads with
cgroupfs. This is not an atomic operation. The following race issue
might happen.

1) Binder interface is frozen by ioctl(BINDER_FREEZE);
2) Main thread A initiates a new sync binder transaction to process B;
3) Main thread A is frozen by "echo 1 &gt; cgroup.freeze";
4) The response from process B reaches the frozen thread, which will
unexpectedly fail.

This patch provides a mechanism to check if there's any new pending
transaction happening between ioctl(BINDER_FREEZE) and freezing the
main thread. If there's any, the main thread freezing operation can
be rolled back to finish the pending transaction.

Furthermore, the response might reach the binder driver before the
rollback actually happens. That will still cause failed transaction.

As the other process doesn't wait for another response of the response,
the response transaction failure can be fixed by treating the response
transaction like an oneway/async one, allowing it to reach the frozen
thread. And it will be consumed when the thread gets unfrozen later.

NOTE: This patch reuses the existing definition of struct
binder_frozen_status_info but expands the bit assignments of __u32
member sync_recv.

To ensure backward compatibility, bit 0 of sync_recv still indicates
there's an outstanding sync binder transaction. This patch adds new
information to bit 1 of sync_recv, indicating the binder transaction
happens exactly when there's a race.

If an existing userspace app runs on a new kernel, a sync binder call
will set bit 0 of sync_recv so ioctl(BINDER_GET_FROZEN_INFO) still
return the expected value (true). The app just doesn't check bit 1
intentionally so it doesn't have the ability to tell if there's a race.
This behavior is aligned with what happens on an old kernel which
doesn't set bit 1 at all.

A new userspace app can 1) check bit 0 to know if there's a sync binder
transaction happened when being frozen - same as before; and 2) check
bit 1 to know if that sync binder transaction happened exactly when
there's a race - a new information for rollback decision.

the same time, confirmed the pending transactions succeeded.

Fixes: 432ff1e91694 ("binder: BINDER_FREEZE ioctl")
Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Li Li &lt;dualli@google.com&gt;
Test: stress test with apps being frozen and initiating binder calls at
Link: https://lore.kernel.org/r/20210910164210.2282716-2-dualli@chromium.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: tell userspace to dump current backtrace when detected oneway spamming</title>
<updated>2021-04-10T08:52:04Z</updated>
<author>
<name>Hang Lu</name>
<email>hangl@codeaurora.org</email>
</author>
<published>2021-04-09T09:40:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a7dc1e6f99df59799ab0128d9c4e47bbeceb934d'/>
<id>urn:sha1:a7dc1e6f99df59799ab0128d9c4e47bbeceb934d</id>
<content type='text'>
When async binder buffer got exhausted, some normal oneway transactions
will also be discarded and may cause system or application failures. By
that time, the binder debug information we dump may not be relevant to
the root cause. And this issue is difficult to debug if without the
backtrace of the thread sending spam.

This change will send BR_ONEWAY_SPAM_SUSPECT to userspace when oneway
spamming is detected, request to dump current backtrace. Oneway spamming
will be reported only once when exceeding the threshold (target process
dips below 80% of its oneway space, and current process is responsible for
either more than 50 transactions, or more than 50% of the oneway space).
And the detection will restart when the async buffer has returned to a
healthy state.

Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Hang Lu &lt;hangl@codeaurora.org&gt;
Link: https://lore.kernel.org/r/1617961246-4502-3-git-send-email-hangl@codeaurora.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: BINDER_GET_FROZEN_INFO ioctl</title>
<updated>2021-03-24T07:26:31Z</updated>
<author>
<name>Marco Ballesio</name>
<email>balejs@google.com</email>
</author>
<published>2021-03-16T01:16:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ae28c1be1e54f2eda1c8b4469c4652e8a24056ed'/>
<id>urn:sha1:ae28c1be1e54f2eda1c8b4469c4652e8a24056ed</id>
<content type='text'>
User space needs to know if binder transactions occurred to frozen
processes. Introduce a new BINDER_GET_FROZEN ioctl and keep track of
transactions occurring to frozen proceses.

Signed-off-by: Marco Ballesio &lt;balejs@google.com&gt;
Signed-off-by: Li Li &lt;dualli@google.com&gt;
Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Link: https://lore.kernel.org/r/20210316011630.1121213-4-dualli@chromium.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: BINDER_FREEZE ioctl</title>
<updated>2021-03-24T07:26:31Z</updated>
<author>
<name>Marco Ballesio</name>
<email>balejs@google.com</email>
</author>
<published>2021-03-16T01:16:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=432ff1e91694e4c55a5bf6bc0574f4c254970232'/>
<id>urn:sha1:432ff1e91694e4c55a5bf6bc0574f4c254970232</id>
<content type='text'>
Frozen tasks can't process binder transactions, so a way is required to
inform transmitting ends of communication failures due to the frozen
state of their receiving counterparts. Additionally, races are possible
between transitions to frozen state and binder transactions enqueued to
a specific process.

Implement BINDER_FREEZE ioctl for user space to inform the binder driver
about the intention to freeze or unfreeze a process. When the ioctl is
called, block the caller until any pending binder transactions toward
the target process are flushed. Return an error to transactions to
processes marked as frozen.

Co-developed-by: Todd Kjos &lt;tkjos@google.com&gt;
Acked-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Marco Ballesio &lt;balejs@google.com&gt;
Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Signed-off-by: Li Li &lt;dualli@google.com&gt;
Link: https://lore.kernel.org/r/20210316011630.1121213-2-dualli@chromium.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: add flag to clear buffer on txn complete</title>
<updated>2020-12-09T14:41:21Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@google.com</email>
</author>
<published>2020-11-20T23:37:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0f966cba95c78029f491b433ea95ff38f414a761'/>
<id>urn:sha1:0f966cba95c78029f491b433ea95ff38f414a761</id>
<content type='text'>
Add a per-transaction flag to indicate that the buffer
must be cleared when the transaction is complete to
prevent copies of sensitive data from being preserved
in memory.

Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Link: https://lore.kernel.org/r/20201120233743.3617529-1-tkjos@google.com
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>android: binder.h: drop a duplicated word</title>
<updated>2020-07-23T07:35:36Z</updated>
<author>
<name>Randy Dunlap</name>
<email>rdunlap@infradead.org</email>
</author>
<published>2020-07-19T00:27:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1859f4ebcf2dfe2e878a3805700036fdc4e01e2c'/>
<id>urn:sha1:1859f4ebcf2dfe2e878a3805700036fdc4e01e2c</id>
<content type='text'>
Drop the repeated word "the" in a comment.

Cc: Arve Hjønnevåg &lt;arve@android.com&gt;
Cc: Todd Kjos &lt;tkjos@android.com&gt;
Cc: Martijn Coenen &lt;maco@android.com&gt;
Cc: Joel Fernandes &lt;joel@joelfernandes.org&gt;
Cc: Hridya Valsaraju &lt;hridya@google.com&gt;
Cc: Suren Baghdasaryan &lt;surenb@google.com&gt;
Cc: devel@driverdev.osuosl.org
Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Link: https://lore.kernel.org/r/20200719002738.20210-1-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge 5.0-rc4 into char-misc-next</title>
<updated>2019-01-28T07:13:52Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2019-01-28T07:13:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=fdddcfd9c93c6db006004fa5ba7fd9380e721c3f'/>
<id>urn:sha1:fdddcfd9c93c6db006004fa5ba7fd9380e721c3f</id>
<content type='text'>
We need the char-misc fixes in here as well.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binder: create node flag to request sender's security context</title>
<updated>2019-01-22T12:55:08Z</updated>
<author>
<name>Todd Kjos</name>
<email>tkjos@android.com</email>
</author>
<published>2019-01-14T17:10:21Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ec74136ded792deed80780a2f8baf3521eeb72f9'/>
<id>urn:sha1:ec74136ded792deed80780a2f8baf3521eeb72f9</id>
<content type='text'>
To allow servers to verify client identity, allow a node
flag to be set that causes the sender's security context
to be delivered with the transaction. The BR_TRANSACTION
command is extended in BR_TRANSACTION_SEC_CTX to
contain a pointer to the security context string.

Signed-off-by: Todd Kjos &lt;tkjos@google.com&gt;
Reviewed-by: Joel Fernandes (Google) &lt;joel@joelfernandes.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binderfs: use __u32 for device numbers</title>
<updated>2019-01-22T11:13:17Z</updated>
<author>
<name>Christian Brauner</name>
<email>christian@brauner.io</email>
</author>
<published>2019-01-21T11:01:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7d0174065f4903fb0ce0bab3d5047284faa7226d'/>
<id>urn:sha1:7d0174065f4903fb0ce0bab3d5047284faa7226d</id>
<content type='text'>
We allow more then 255 binderfs binder devices to be created since there
are workloads that require more than that. If we use __u8 we'll overflow
after 255. So let's use a __u32.
Note that there's no released kernel with binderfs out there so this is
not a regression.

Signed-off-by: Christian Brauner &lt;christian@brauner.io&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binderfs: use correct include guards in header</title>
<updated>2019-01-22T11:13:17Z</updated>
<author>
<name>Christian Brauner</name>
<email>christian@brauner.io</email>
</author>
<published>2019-01-21T11:01:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6fc23b6ed8fa0ba6cc47b2f8756df1199abc3a5c'/>
<id>urn:sha1:6fc23b6ed8fa0ba6cc47b2f8756df1199abc3a5c</id>
<content type='text'>
When we switched over from binder_ctl.h to binderfs.h we forgot to change
the include guards. It's minor but it's obviously correct.

Signed-off-by: Christian Brauner &lt;christian@brauner.io&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
