summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-08-19 22:31:31 -0700
committerAndreas Gampe <agampe@google.com>2014-08-22 01:44:06 -0700
commit049249ce7addafaa0bd09480cd8858cd2c54138f (patch)
treed97559db3a4658231163f816ebc05d9e92ad86da /include
parenta59b6ac6973b3f5ce1246bf73969094779436892 (diff)
downloadsystem_core-049249ce7addafaa0bd09480cd8858cd2c54138f.zip
system_core-049249ce7addafaa0bd09480cd8858cd2c54138f.tar.gz
system_core-049249ce7addafaa0bd09480cd8858cd2c54138f.tar.bz2
NativeBridge: Tighten security on libnativebridge
Do not allow arbitrary paths for the native bridge - only allow simple names. Do not allow re-setup of the native bridge. Bug: 16404669 (cherry picked from commit cd2ef4c1af69727231b84ebc82864c170ff0e8ad) Change-Id: Ie22de356d2307fe2758f9094a85d44e61a4098a1
Diffstat (limited to 'include')
-rw-r--r--include/nativebridge/native_bridge.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/nativebridge/native_bridge.h b/include/nativebridge/native_bridge.h
index 2415e6b..c588bbc 100644
--- a/include/nativebridge/native_bridge.h
+++ b/include/nativebridge/native_bridge.h
@@ -29,6 +29,10 @@ struct NativeBridgeRuntimeCallbacks;
void SetupNativeBridge(const char* native_bridge_library_filename,
const NativeBridgeRuntimeCallbacks* runtime_callbacks);
+// Check whether a native bridge is available (initialized). Requires a prior call to
+// SetupNativeBridge to make sense.
+bool NativeBridgeAvailable();
+
// Load a shared library that is supported by the native bridge.
void* NativeBridgeLoadLibrary(const char* libpath, int flag);
@@ -38,6 +42,17 @@ void* NativeBridgeGetTrampoline(void* handle, const char* name, const char* shor
// True if native library is valid and is for an ABI that is supported by native bridge.
bool NativeBridgeIsSupported(const char* libpath);
+// Returns whether we have seen a native bridge error. This could happen because the library
+// was not found, rejected, could not be initialized and so on.
+//
+// This functionality is mainly for testing.
+bool NativeBridgeError();
+
+// Returns whether a given string is acceptable as a native bridge library filename.
+//
+// This functionality is exposed mainly for testing.
+bool NativeBridgeNameAcceptable(const char* native_bridge_library_filename);
+
// Native bridge interfaces to runtime.
struct NativeBridgeCallbacks {
// Initialize native bridge. Native bridge's internal implementation must ensure MT safety and