From: Evgeniy Stepanov Date: Fri, 29 Jun 2018 00:38:26 +0000 (+0000) Subject: [cfi] Reset i-cache after copying code in test. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d310651a2e14329f6fa38f7593baf8b1459448e;p=platform%2Fupstream%2Fllvm.git [cfi] Reset i-cache after copying code in test. Fixes intermittent crashes on Android. Also add PROT_READ to the code mapping for no real reason. llvm-svn: 335943 --- diff --git a/compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp b/compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp index d238a7ac..20fe122 100644 --- a/compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp +++ b/compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp @@ -83,10 +83,12 @@ static void save_code(char *p) { } static void restore_code() { - char *code = (char *)mmap(real_start, kCodeSize, PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, 0, 0); + char *code = + (char *)mmap(real_start, kCodeSize, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, 0, 0); assert(code == real_start); memcpy(code, saved_code, kCodeSize); + __clear_cache(code, code + kCodeSize); } int main(int argc, char *argv[]) {