summaryrefslogtreecommitdiff
path: root/cpu_ref/rsCpuExecutable.h
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2015-02-13 20:02:50 -0800
committerPirama Arumuga Nainar <pirama@google.com>2015-03-03 16:01:09 -0800
commitaa6757ffc1b23d771566439c3179fdbc1e5ba569 (patch)
tree044aca6fe98f7f091fb24c9d1d02ce7a4cca8e10 /cpu_ref/rsCpuExecutable.h
parent405710bfdbb988764fe1dd65ac13352b8858848c (diff)
downloadrs-aa6757ffc1b23d771566439c3179fdbc1e5ba569.tar.gz
Add build fingerprint and ensure match on .so load
bug 19216507 If ro.debuggable system property is set, - Compute the Adler32 checksum of bitcode, compiler arguments, bcc, libclcore files. - On shared object load, check that there is an embedded checksum value in .rs.info and it matches the value computed in the previous step. The .so is not loaded if the checksums don't match. - If invoking bcc, pass the checksum as an argument. If ro.debuggable is not set, a constant checksum is added to .rs.info. But it is never checked. Change-Id: I0a9d16b34148b748daf744007a8515511714a5a5
Diffstat (limited to 'cpu_ref/rsCpuExecutable.h')
-rw-r--r--cpu_ref/rsCpuExecutable.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/cpu_ref/rsCpuExecutable.h b/cpu_ref/rsCpuExecutable.h
index acf092c8..cdf6fd6b 100644
--- a/cpu_ref/rsCpuExecutable.h
+++ b/cpu_ref/rsCpuExecutable.h
@@ -63,7 +63,7 @@ public:
size_t forEachCount,
const char ** pragmaKeys, const char ** pragmaValues,
size_t pragmaCount,
- bool isThreadable) :
+ bool isThreadable, const char *buildChecksum) :
mFieldAddress(fieldAddress), mFieldIsObject(fieldIsObject),
mExportedVarCount(varCount),
mInvokeFunctions(invokeFunctions), mFuncCount(funcCount),
@@ -71,7 +71,8 @@ public:
mForEachCount(forEachCount),
mPragmaKeys(pragmaKeys), mPragmaValues(pragmaValues),
mPragmaCount(pragmaCount),
- mIsThreadable(isThreadable), mRS(RSContext) {
+ mIsThreadable(isThreadable), mBuildChecksum(buildChecksum),
+ mRS(RSContext) {
}
~ScriptExecutable() {
@@ -85,6 +86,7 @@ public:
}
}
+ delete[] mBuildChecksum;
for (size_t i = 0; i < mPragmaCount; ++i) {
delete [] mPragmaKeys[i];
delete [] mPragmaValues[i];
@@ -118,6 +120,12 @@ public:
bool getThreadable() const { return mIsThreadable; }
+ const char *getBuildChecksum() const { return mBuildChecksum; }
+ bool isChecksumValid(const char *checksum) const {
+ return (mBuildChecksum != nullptr &&
+ strcmp(checksum, mBuildChecksum) == 0);
+ }
+
private:
void** mFieldAddress;
bool* mFieldIsObject;
@@ -135,6 +143,7 @@ private:
size_t mPragmaCount;
bool mIsThreadable;
+ const char *mBuildChecksum;
Context* mRS;
};