| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file implements the native methods of | 5 // This file implements the native methods of |
| 6 // org.content.chromium.app.LinkerTests | 6 // org.content.chromium.app.LinkerTests |
| 7 // Unlike the content of linker_jni.cc, it is part of the content library and | 7 // Unlike the content of linker_jni.cc, it is part of the content library and |
| 8 // can thus use base/ and the C++ STL. | 8 // can thus use base/ and the C++ STL. |
| 9 | 9 |
| 10 #include "content/shell/android/linker_test_apk/chromium_linker_test_linker_test
s.h" | 10 #include "content/shell/android/linker_test_apk/chromium_linker_test_linker_test
s.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 std::vector<MappedMemoryRegion> regions; | 72 std::vector<MappedMemoryRegion> regions; |
| 73 base::debug::ParseProcMaps(maps, ®ions); | 73 base::debug::ParseProcMaps(maps, ®ions); |
| 74 if (regions.empty()) { | 74 if (regions.empty()) { |
| 75 LOG(ERROR) << prefix << "FAIL Cannot read memory mappings in this process"; | 75 LOG(ERROR) << prefix << "FAIL Cannot read memory mappings in this process"; |
| 76 return false; | 76 return false; |
| 77 } | 77 } |
| 78 | 78 |
| 79 const RE2 legacy_linker_re(kLegacyRelroSectionPattern); | 79 const RE2 legacy_linker_re(kLegacyRelroSectionPattern); |
| 80 const RE2 modern_linker_re(kModernRelroSectionPattern); | 80 const RE2 modern_linker_re(kModernRelroSectionPattern); |
| 81 | 81 |
| 82 size_t num_shared_relros = 0; | 82 int num_shared_relros = 0; |
| 83 size_t num_bad_shared_relros = 0; | 83 int num_bad_shared_relros = 0; |
| 84 | 84 |
| 85 for (size_t n = 0; n < regions.size(); ++n) { | 85 for (size_t n = 0; n < regions.size(); ++n) { |
| 86 MappedMemoryRegion& region = regions[n]; | 86 MappedMemoryRegion& region = regions[n]; |
| 87 | 87 |
| 88 const std::string path = region.path; | 88 const std::string path = region.path; |
| 89 const bool is_legacy_relro = re2::RE2::FullMatch(path, legacy_linker_re); | 89 const bool is_legacy_relro = re2::RE2::FullMatch(path, legacy_linker_re); |
| 90 const bool is_modern_relro = re2::RE2::FullMatch(path, modern_linker_re); | 90 const bool is_modern_relro = re2::RE2::FullMatch(path, modern_linker_re); |
| 91 | 91 |
| 92 if (is_legacy_relro && is_modern_relro) { | 92 if (is_legacy_relro && is_modern_relro) { |
| 93 LOG(ERROR) << prefix | 93 LOG(ERROR) << prefix |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 jboolean CheckForNoSharedRelros(JNIEnv* env, | 204 jboolean CheckForNoSharedRelros(JNIEnv* env, |
| 205 jclass clazz, | 205 jclass clazz, |
| 206 jboolean in_browser_process) { | 206 jboolean in_browser_process) { |
| 207 return RunChecks(in_browser_process, false); | 207 return RunChecks(in_browser_process, false); |
| 208 } | 208 } |
| 209 | 209 |
| 210 bool RegisterLinkerTestsJni(JNIEnv* env) { return RegisterNativesImpl(env); } | 210 bool RegisterLinkerTestsJni(JNIEnv* env) { return RegisterNativesImpl(env); } |
| 211 | 211 |
| 212 } // namespace content | 212 } // namespace content |
| OLD | NEW |