A Hidden Weakness
Published on: 2025-06-11 08:39:18
A Hidden Weakness
May 29, 2025
Categories: mozilla
This is the story of a bug hunt that lasted much longer than expected, but ended with the dearest of all treasures: knowledge.
Let's draw some context: the Android platform defines different API levels. Unsurprisingly, some symbols are only defined starting with a given API version. For instance, ASystemFontIterator_open is only available starting at API 29.
Unconditionally trying to use ASystemFontIterator_open while targeting an API older than 29 leads to a linker error (an undefined reference), which makes sense because the symbol, well, does not exist at that API level.
So a native application that wants to use this symbol can either refuse to run on older API, or use a combination of dlopen and dlsym to dynamically lookup for the symbol and provide a fallback if it does not exist. The latter approach is used on Fenix, the Android version of Firefox.
Introducing __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ As an alternative to t
... Read full article.