Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5acf1be4 authored by Yu-Ting Tseng's avatar Yu-Ting Tseng
Browse files

Add an option to defer BC_REQUEST_FREEZE_NOTIFICATION when needed

Before this commit, user space may send BC_REQUEST_FREEZE_NOTIFICATION
before receiving BR_CLEAR_FREEZE_NOTIFICATION_DONE for the previous
listener session on the same binder node. This leads to a race condition
where notifications could be received out of order.

Here is an example
1. User space sends BC_REQUEST_FREEZE_NOTIFICATION with cookie A
2. Kernel sends BR_FROZEN_BINDER with frozen=false to user space
3. User space sends BC_CLEAR_FREEZE_NOTIFICATION with cookie A
4. Target process is frozen
5. User space sends BC_REQUEST_FREEZE_NOTIFICATION with cookie A
6. Kernel sends BR_FROZEN_BINDER with frozen=true to user space
7. The two BR_FROZEN_BINDER from step 2 and 6 may be picked up by
   user space in an arbitrary order. This is undesired. We want the last
   notification to be frozen=true.

The commit adds a new codepath (default off) that fixes this issue by
deferring BC_REQUEST_FREEZE_NOTIFICATION until user space receives
BR_CLEAR_FREEZE_NOTIFICATION_DONE. This ensures that a new listener
session never happens until the previous one is fully completed.

Change-Id: Ia026db0b2065ad8ee4cd56c75d49b459c6319ae0
Bug: 425638507
Flag: build.RELEASE_LIBBINDER_DEFER_BC_REQUEST_FREEZE_NOTIFICATION
parent c4dc4b74
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment