Search code examples
androidandroid-11

Does GWP-ASan require an Android 11 Device?


Documentation says GWP-ASan is available on apps that target Android 11 (API level 30) or higher but doesn't mention any requirements on the device.

Similarly, the manifest documentation for gwpAsanMode says Added in API level 30 but doesn't mention any requirements on device.

I'm targeting API level 30 and have enabled GWP-Asan and I'm trying to trigger it just to prove that it's working. I'm following the pattern in the example in the doc of doing thousands of use-after-free, but it's not triggering. I'm wondering if that's because I'm testing on an Android 7 device (I don't have an Android 11 device to hand).


Solution

  • An Android 11 device is required: source

    GWP-ASan is only available on Android 11 devices. So - for an app to have GWP-ASan, you need: (1) A device with Android 11, (2) android:gwpAsanMode="always" specified in your manifest. Additionally, you'll need to build your app using the Android 11 SDK, as the flag in (2) isn't defined in older SDKs and will fail to build.