Allow APEX binaries to access fields and methods via JNI

Adds a native stack check for method and field resolutions via JNI.
This is part of checking the Core Platform API surface. Code outside
of APEXes shouldn't be accessing internals as those may change.

The native stack walk determines first caller outside of libart and
checks whether it's from an APEX module or other code. The caller
lookup employs a cache of executable pages in shared objects to avoid
costs of dladdr when examining program counters.

The overhead of this additional check is typically 50-400ns on per
field/method resolution via JNI as measured on a blueline device (see
b/124338141 for data).

Bug: 124338141
Test: m art_libartartbase_tests_memory_type_table_test && \
  out/host/linux-x86/nativetest/art_libartbase_tests/memory_type_table_test
Test: Boot and observe no core platform api warnings from opengl

(cherry picked from commit 80e9f700c29b1bcaa4535051eda57a5026cc12ed)

Change-Id: Ie2f7217cdcbfb324cd98d65856fa8bc9967dfd19
Merged-In: Ie2f7217cdcbfb324cd98d65856fa8bc9967dfd19
6 files changed