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
Loading
Please register or sign in to comment