Julian Dolby
IBM Thomas J. Watson Research Center
IMDEA, Madrid, June 2017
Illustrate a small sample of being everywhere
hybrid apps
WALA on Web browsers
Swift
Soundy analysis framework for Android hybrid apps
support for most implicit inter-language flows (Backed by APIs and Dalvik VM source code)
support most type compatibility in browsers (backed by experiments with trials & errors)
Implementation on top of WALA
Uses generic WALA cross-language support
function Document_prototype_write(x) { } function id(x) { return x // line 6; } var document = { URL: "whatever" }; var url = id(document.URL); // line 10 Document_prototype_write(url); // line 11 var notUrl = id("not a url"); Document_prototype_write(notUrl);
Apple a dominant mobile platform
likely most popular phone in the audience
Swift primary programming language
WALA meant to be flexible
analyzing new language Swift a test
support Apple-IBM alliance
Use WALA to analyze Swift
Use open source Apple code
up-to-date with evolving language
written largely in C++, unlike WALA
Bridge C++ code to WALA
large code base, so JNI to Swift tedious
exploit JNI interface to WALA
Expose WALA to Apple Swift code
interface CAstNode {
...
/**
* What kind of node is this...
int getKind();
...
}
this->_getKind = env->GetMethodID(CAstNode, "getKind", "()I");
THROW_ANY_EXCEPTION(java_ex);
int CAstWrapper::getKind(jobject castNode) {
jint result = env->CallIntMethod(castNode, _getKind);
THROW_ANY_EXCEPTION(java_ex);
return result;
}
JNIEnv *launch() {
...
// Create the JVM
JNIEnv *jniEnv;
long flag = JNI_CreateJavaVM(&javaVM, (void**)
&jniEnv, &vmArgs);
...
}
void run() {
JNIEnv *java_env = launch();
TRY(exp, java_env)
CAstWrapper CAst(java_env, exp, NULL);
THROW_ANY_EXCEPTION(exp);
CATCH()
}
WALA-Swift JNI interface working
integrated into Apple build process
initial steps working as of WALA Hack-a-thon
Interface not just for WALA
other Java tools could benefit
would love collaborators
World getting less monolingual, not more
domains have favorites, e.g. Python for ML
new languages like Swift arise
Analysis frameworks must adapt
need to analyze code people use
WALA has proven flexible