OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 | 8 // can |
9 // thus use base/ and the C++ STL. | 9 // thus use base/ and the C++ STL. |
10 | 10 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 "unexpected error %d (EACCES:%d wanted): %s", | 129 "unexpected error %d (EACCES:%d wanted): %s", |
130 region_start, | 130 region_start, |
131 region_end, | 131 region_end, |
132 errno, | 132 errno, |
133 EACCES, | 133 EACCES, |
134 strerror(errno)); | 134 strerror(errno)); |
135 num_bad_shared_relros++; | 135 num_bad_shared_relros++; |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 LOG(INFO) | 139 VLOG(0) |
140 << prefix | 140 << prefix |
141 << base::StringPrintf( | 141 << base::StringPrintf( |
142 "There are %d shared RELRO sections in this process, %d are bad", | 142 "There are %d shared RELRO sections in this process, %d are bad", |
143 num_shared_relros, | 143 num_shared_relros, |
144 num_bad_shared_relros); | 144 num_bad_shared_relros); |
145 | 145 |
146 if (num_bad_shared_relros > 0) { | 146 if (num_bad_shared_relros > 0) { |
147 LOG(ERROR) << prefix << "FAIL Bad Relros sections in this process"; | 147 LOG(ERROR) << prefix << "FAIL Bad Relros sections in this process"; |
148 return false; | 148 return false; |
149 } | 149 } |
150 | 150 |
151 if (need_relros) { | 151 if (need_relros) { |
152 if (num_shared_relros == 0) { | 152 if (num_shared_relros == 0) { |
153 LOG(ERROR) << prefix | 153 LOG(ERROR) << prefix |
154 << "FAIL Missing shared RELRO sections in this process!"; | 154 << "FAIL Missing shared RELRO sections in this process!"; |
155 return false; | 155 return false; |
156 } | 156 } |
157 } else { | 157 } else { |
158 if (num_shared_relros > 0) { | 158 if (num_shared_relros > 0) { |
159 LOG(ERROR) << prefix << "FAIL Unexpected " << num_shared_relros | 159 LOG(ERROR) << prefix << "FAIL Unexpected " << num_shared_relros |
160 << " shared RELRO sections in this process!"; | 160 << " shared RELRO sections in this process!"; |
161 return false; | 161 return false; |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 LOG(INFO) << prefix << "SUCCESS"; | 165 VLOG(0) << prefix << "SUCCESS"; |
166 return true; | 166 return true; |
167 } | 167 } |
168 | 168 |
169 } // namespace | 169 } // namespace |
170 | 170 |
171 jboolean CheckForSharedRelros(JNIEnv* env, | 171 jboolean CheckForSharedRelros(JNIEnv* env, |
172 jclass clazz, | 172 jclass clazz, |
173 jboolean in_browser_process) { | 173 jboolean in_browser_process) { |
174 return RunChecks(in_browser_process, true); | 174 return RunChecks(in_browser_process, true); |
175 } | 175 } |
176 | 176 |
177 jboolean CheckForNoSharedRelros(JNIEnv* env, | 177 jboolean CheckForNoSharedRelros(JNIEnv* env, |
178 jclass clazz, | 178 jclass clazz, |
179 jboolean in_browser_process) { | 179 jboolean in_browser_process) { |
180 return RunChecks(in_browser_process, false); | 180 return RunChecks(in_browser_process, false); |
181 } | 181 } |
182 | 182 |
183 bool RegisterLinkerTestsJni(JNIEnv* env) { return RegisterNativesImpl(env); } | 183 bool RegisterLinkerTestsJni(JNIEnv* env) { return RegisterNativesImpl(env); } |
184 | 184 |
185 } // namespace content | 185 } // namespace content |
OLD | NEW |