public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] binder: fix freeze race
@ 2021-09-10  3:53 Li Li
  2021-09-10  3:53 ` [PATCH v2 1/1] " Li Li
  0 siblings, 1 reply; 6+ messages in thread
From: Li Li @ 2021-09-10  3:53 UTC (permalink / raw)
  To: dualli, tkjos, gregkh, christian, arve, devel, linux-kernel, maco,
	hridya, surenb
  Cc: joel, kernel-team

From: Li Li <dualli@google.com>

As there isn't an atomic operation to freeze the main thread and binder
interface together, it's possible the main thread initiates a new binder
transaction while the binder interfaces are already frozen. This race issue
will result in failed binder transaction and unexpectedly crash the app.

This patch allows a post-froze rollback mechanism by checking if there's
any new pending binder transaction waiting for response. At the same time,
it treats the response transaction like an oneway transaction so that the
response can successfully reach the frozen process.

Changes in v2:
1. Improve commit msg, adding "Fixes"
2. Adding missing "_ilocked" suffix to binder_txns_pending()
3. Document bit assignment of struct binder_frozen_status_info in binder.h

Li Li (1):
  binder: fix freeze race

 drivers/android/binder.c            | 34 +++++++++++++++++++++++++----
 drivers/android/binder_internal.h   |  2 ++
 include/uapi/linux/android/binder.h |  7 ++++++
 3 files changed, 39 insertions(+), 4 deletions(-)

-- 
2.33.0.309.g3052b89438-goog


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-13 17:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-10  3:53 [PATCH v2 0/1] binder: fix freeze race Li Li
2021-09-10  3:53 ` [PATCH v2 1/1] " Li Li
2021-09-10  5:37   ` Greg KH
2021-09-10  6:17     ` Li Li
2021-09-10  7:15       ` Greg KH
2021-09-13 17:18         ` Li Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox