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

Commit acd97fa3 authored by Robin Lee's avatar Robin Lee
Browse files

Remove infinite money glitch from ProtoLog service

Clients had a register() method but no unregister(), only a
binderDied(). It also registers many duplicates if init() is called
repeatedly. This has some weaknesses:

- The implementation of linkToDeath creates a strong self-reference that
  is never deleted, preventing the client object from geting cleaned up
  until the binder fully dies.

- Lack of unregister means that every call to init() leaks a new
  BinderProxy, eventually overwhelming the limits in long-running test
  suites that setup proto logging thousands of times in one process.

- The existing cleanup method fails to delete the entry from the client
  hashmap, which once again leaks the client object in BinderProxy form.

- Use of IBinder.Stub as primary keys is not safe because multiple
  objects can represent the same Binder. Switched to using the IBinder
  as primary key since this is a unique reference in the same process.

Removing the infinite money glitch (also known in gaming circles as
a binder leak, which is one of the common ways this is exploited by our
players) makes us more robust against cheating by WmShellUnitTests and
other bad actors.

Test: atest --iterations 5 WMShellUnitTests
Bug: 419430883
Flag: android.tracing.client_side_proto_logging
Change-Id: I151ac2714b180cc4411ec6be260503c8e5e45ea9
parent 5a136f7b
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