GmsCore icon indicating copy to clipboard operation
GmsCore copied to clipboard

Memory leak in HandleProxyFactory.kt DroidGuard class cache ClassLoader not Unloaded java.lang.UnsatisfiedLinkError Library already loaded in another classloader

Open ydaniels opened this issue 1 year ago • 1 comments

Describe the bug HandleProxyFactory keeps a cache of DroidGuardClass in classMap fun loadClass https://github.com/microg/GmsCore/blob/048a6e59f1cd9192eb614fb73db3304c058574cb/play-services-droidguard/core/src/main/kotlin/org/microg/gms/droidguard/core/HandleProxyFactory.kt#L214.

but DroidGuardHandleImpl.kt creates a new copy of the class everytime PlayIntegrity or Safetynet is checked so the previous DroidGuardClass cache never gets unloaded and you get error java.lang.UnsatisfiedLinkError Library already loaded in another classloader when you try to check PlayIntegrity or Safetynet multiple times

To Reproduce 1.) Install SPIC - Play Integrity Checker 2.) Check Integrity It works fine for the first time 3) Check Integrity Multiple time. It fails and crash occur internally on adb with error java.lang.UnsatisfiedLinkError Library already loaded in another classloader

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

System Android Version: 11 Custom ROM: LineageOS 18

Additional context This was tested with official playstore

ydaniels avatar Jan 23 '24 18:01 ydaniels

image

huwenkai26 avatar Feb 18 '24 06:02 huwenkai26