Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "NativeLibraryHelper" |
| 18 | //#define LOG_NDEBUG 0 |
| 19 | |
Andreas Gampe | ed6b9df | 2014-11-20 22:02:20 -0800 | [diff] [blame] | 20 | #include "core_jni_helpers.h" |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 21 | |
Steven Moreland | 2279b25 | 2017-07-19 09:50:45 -0700 | [diff] [blame] | 22 | #include <nativehelper/ScopedUtfChars.h> |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 23 | #include <androidfw/ZipFileRO.h> |
| 24 | #include <androidfw/ZipUtils.h> |
| 25 | #include <utils/Log.h> |
| 26 | #include <utils/Vector.h> |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 27 | |
| 28 | #include <zlib.h> |
| 29 | |
| 30 | #include <fcntl.h> |
| 31 | #include <stdlib.h> |
| 32 | #include <string.h> |
| 33 | #include <time.h> |
| 34 | #include <unistd.h> |
Dmitriy Ivanov | dec4688 | 2014-09-30 15:10:48 -0700 | [diff] [blame] | 35 | #include <inttypes.h> |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 36 | #include <sys/stat.h> |
| 37 | #include <sys/types.h> |
| 38 | |
Elliott Hughes | 93bb56e | 2016-09-11 14:50:12 -0700 | [diff] [blame] | 39 | #include <memory> |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 40 | |
| 41 | #define APK_LIB "lib/" |
| 42 | #define APK_LIB_LEN (sizeof(APK_LIB) - 1) |
| 43 | |
| 44 | #define LIB_PREFIX "/lib" |
| 45 | #define LIB_PREFIX_LEN (sizeof(LIB_PREFIX) - 1) |
| 46 | |
| 47 | #define LIB_SUFFIX ".so" |
| 48 | #define LIB_SUFFIX_LEN (sizeof(LIB_SUFFIX) - 1) |
| 49 | |
Narayan Kamath | d47e38b | 2014-05-16 16:45:56 +0100 | [diff] [blame] | 50 | #define RS_BITCODE_SUFFIX ".bc" |
Narayan Kamath | d47e38b | 2014-05-16 16:45:56 +0100 | [diff] [blame] | 51 | |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 52 | #define TMP_FILE_PATTERN "/tmp.XXXXXX" |
| 53 | #define TMP_FILE_PATTERN_LEN (sizeof(TMP_FILE_PATTERN) - 1) |
| 54 | |
| 55 | namespace android { |
| 56 | |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 57 | // These match PackageManager.java install codes |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 58 | enum install_status_t { |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 59 | INSTALL_SUCCEEDED = 1, |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 60 | INSTALL_FAILED_INVALID_APK = -2, |
| 61 | INSTALL_FAILED_INSUFFICIENT_STORAGE = -4, |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 62 | INSTALL_FAILED_CONTAINER_ERROR = -18, |
| 63 | INSTALL_FAILED_INTERNAL_ERROR = -110, |
Narayan Kamath | d11f223 | 2014-04-10 10:37:17 +0100 | [diff] [blame] | 64 | INSTALL_FAILED_NO_MATCHING_ABIS = -113, |
| 65 | NO_NATIVE_LIBRARIES = -114 |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 66 | }; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 67 | |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 68 | typedef install_status_t (*iterFunc)(JNIEnv*, void*, ZipFileRO*, ZipEntryRO, const char*); |
| 69 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 70 | // Equivalent to android.os.FileUtils.isFilenameSafe |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 71 | static bool |
| 72 | isFilenameSafe(const char* filename) |
| 73 | { |
| 74 | off_t offset = 0; |
| 75 | for (;;) { |
| 76 | switch (*(filename + offset)) { |
| 77 | case 0: |
| 78 | // Null. |
| 79 | // If we've reached the end, all the other characters are good. |
| 80 | return true; |
| 81 | |
| 82 | case 'A' ... 'Z': |
| 83 | case 'a' ... 'z': |
| 84 | case '0' ... '9': |
| 85 | case '+': |
| 86 | case ',': |
| 87 | case '-': |
| 88 | case '.': |
| 89 | case '/': |
| 90 | case '=': |
| 91 | case '_': |
| 92 | offset++; |
| 93 | break; |
| 94 | |
| 95 | default: |
| 96 | // We found something that is not good. |
| 97 | return false; |
| 98 | } |
| 99 | } |
| 100 | // Should not reach here. |
| 101 | } |
| 102 | |
| 103 | static bool |
Narayan Kamath | 407753c | 2015-06-16 12:02:57 +0100 | [diff] [blame] | 104 | isFileDifferent(const char* filePath, uint32_t fileSize, time_t modifiedTime, |
| 105 | uint32_t zipCrc, struct stat64* st) |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 106 | { |
| 107 | if (lstat64(filePath, st) < 0) { |
| 108 | // File is not found or cannot be read. |
Steve Block | 71f2cf1 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 109 | ALOGV("Couldn't stat %s, copying: %s\n", filePath, strerror(errno)); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 110 | return true; |
| 111 | } |
| 112 | |
| 113 | if (!S_ISREG(st->st_mode)) { |
| 114 | return true; |
| 115 | } |
| 116 | |
Andreas Gampe | 0f0b491 | 2014-11-12 08:03:48 -0800 | [diff] [blame] | 117 | if (static_cast<uint64_t>(st->st_size) != static_cast<uint64_t>(fileSize)) { |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 118 | return true; |
| 119 | } |
| 120 | |
| 121 | // For some reason, bionic doesn't define st_mtime as time_t |
| 122 | if (time_t(st->st_mtime) != modifiedTime) { |
Steve Block | 71f2cf1 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 123 | ALOGV("mod time doesn't match: %ld vs. %ld\n", st->st_mtime, modifiedTime); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 124 | return true; |
| 125 | } |
| 126 | |
| 127 | int fd = TEMP_FAILURE_RETRY(open(filePath, O_RDONLY)); |
| 128 | if (fd < 0) { |
Steve Block | 71f2cf1 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 129 | ALOGV("Couldn't open file %s: %s", filePath, strerror(errno)); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 130 | return true; |
| 131 | } |
| 132 | |
Narayan Kamath | 407753c | 2015-06-16 12:02:57 +0100 | [diff] [blame] | 133 | // uLong comes from zlib.h. It's a bit of a wart that they're |
| 134 | // potentially using a 64-bit type for a 32-bit CRC. |
| 135 | uLong crc = crc32(0L, Z_NULL, 0); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 136 | unsigned char crcBuffer[16384]; |
| 137 | ssize_t numBytes; |
| 138 | while ((numBytes = TEMP_FAILURE_RETRY(read(fd, crcBuffer, sizeof(crcBuffer)))) > 0) { |
| 139 | crc = crc32(crc, crcBuffer, numBytes); |
| 140 | } |
| 141 | close(fd); |
| 142 | |
Narayan Kamath | 407753c | 2015-06-16 12:02:57 +0100 | [diff] [blame] | 143 | ALOGV("%s: crc = %lx, zipCrc = %" PRIu32 "\n", filePath, crc, zipCrc); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 144 | |
Narayan Kamath | 407753c | 2015-06-16 12:02:57 +0100 | [diff] [blame] | 145 | if (crc != static_cast<uLong>(zipCrc)) { |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 146 | return true; |
| 147 | } |
| 148 | |
| 149 | return false; |
| 150 | } |
| 151 | |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 152 | static install_status_t |
Narayan Kamath | afd31e0 | 2013-12-03 13:16:03 +0000 | [diff] [blame] | 153 | sumFiles(JNIEnv*, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntry, const char*) |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 154 | { |
| 155 | size_t* total = (size_t*) arg; |
Narayan Kamath | 407753c | 2015-06-16 12:02:57 +0100 | [diff] [blame] | 156 | uint32_t uncompLen; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 157 | |
| 158 | if (!zipFile->getEntryInfo(zipEntry, NULL, &uncompLen, NULL, NULL, NULL, NULL)) { |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 159 | return INSTALL_FAILED_INVALID_APK; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 160 | } |
| 161 | |
Narayan Kamath | 407753c | 2015-06-16 12:02:57 +0100 | [diff] [blame] | 162 | *total += static_cast<size_t>(uncompLen); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 163 | |
| 164 | return INSTALL_SUCCEEDED; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | /* |
| 168 | * Copy the native library if needed. |
| 169 | * |
| 170 | * This function assumes the library and path names passed in are considered safe. |
| 171 | */ |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 172 | static install_status_t |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 173 | copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntry, const char* fileName) |
| 174 | { |
Dmitriy Ivanov | dec4688 | 2014-09-30 15:10:48 -0700 | [diff] [blame] | 175 | void** args = reinterpret_cast<void**>(arg); |
| 176 | jstring* javaNativeLibPath = (jstring*) args[0]; |
| 177 | jboolean extractNativeLibs = *(jboolean*) args[1]; |
| 178 | jboolean hasNativeBridge = *(jboolean*) args[2]; |
| 179 | |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 180 | ScopedUtfChars nativeLibPath(env, *javaNativeLibPath); |
| 181 | |
Narayan Kamath | 407753c | 2015-06-16 12:02:57 +0100 | [diff] [blame] | 182 | uint32_t uncompLen; |
| 183 | uint32_t when; |
| 184 | uint32_t crc; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 185 | |
Narayan Kamath | 407753c | 2015-06-16 12:02:57 +0100 | [diff] [blame] | 186 | uint16_t method; |
Dmitriy Ivanov | dec4688 | 2014-09-30 15:10:48 -0700 | [diff] [blame] | 187 | off64_t offset; |
| 188 | |
| 189 | if (!zipFile->getEntryInfo(zipEntry, &method, &uncompLen, NULL, &offset, &when, &crc)) { |
Steve Block | 5baa3a6 | 2011-12-20 16:23:08 +0000 | [diff] [blame] | 190 | ALOGD("Couldn't read zip entry info\n"); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 191 | return INSTALL_FAILED_INVALID_APK; |
Dmitriy Ivanov | dec4688 | 2014-09-30 15:10:48 -0700 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | if (!extractNativeLibs) { |
| 195 | // check if library is uncompressed and page-aligned |
| 196 | if (method != ZipFileRO::kCompressStored) { |
| 197 | ALOGD("Library '%s' is compressed - will not be able to open it directly from apk.\n", |
| 198 | fileName); |
| 199 | return INSTALL_FAILED_INVALID_APK; |
| 200 | } |
| 201 | |
| 202 | if (offset % PAGE_SIZE != 0) { |
| 203 | ALOGD("Library '%s' is not page-aligned - will not be able to open it directly from" |
| 204 | " apk.\n", fileName); |
| 205 | return INSTALL_FAILED_INVALID_APK; |
| 206 | } |
| 207 | |
| 208 | if (!hasNativeBridge) { |
| 209 | return INSTALL_SUCCEEDED; |
| 210 | } |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | // Build local file path |
| 214 | const size_t fileNameLen = strlen(fileName); |
| 215 | char localFileName[nativeLibPath.size() + fileNameLen + 2]; |
| 216 | |
| 217 | if (strlcpy(localFileName, nativeLibPath.c_str(), sizeof(localFileName)) != nativeLibPath.size()) { |
Steve Block | 5baa3a6 | 2011-12-20 16:23:08 +0000 | [diff] [blame] | 218 | ALOGD("Couldn't allocate local file name for library"); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 219 | return INSTALL_FAILED_INTERNAL_ERROR; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | *(localFileName + nativeLibPath.size()) = '/'; |
| 223 | |
| 224 | if (strlcpy(localFileName + nativeLibPath.size() + 1, fileName, sizeof(localFileName) |
| 225 | - nativeLibPath.size() - 1) != fileNameLen) { |
Steve Block | 5baa3a6 | 2011-12-20 16:23:08 +0000 | [diff] [blame] | 226 | ALOGD("Couldn't allocate local file name for library"); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 227 | return INSTALL_FAILED_INTERNAL_ERROR; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | // Only copy out the native file if it's different. |
Dmitriy Ivanov | dec4688 | 2014-09-30 15:10:48 -0700 | [diff] [blame] | 231 | struct tm t; |
| 232 | ZipUtils::zipTimeToTimespec(when, &t); |
Narayan Kamath | 407753c | 2015-06-16 12:02:57 +0100 | [diff] [blame] | 233 | const time_t modTime = mktime(&t); |
Elliott Hughes | ad07628 | 2014-01-17 18:27:27 -0800 | [diff] [blame] | 234 | struct stat64 st; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 235 | if (!isFileDifferent(localFileName, uncompLen, modTime, crc, &st)) { |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 236 | return INSTALL_SUCCEEDED; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 237 | } |
| 238 | |
Ivan Lozano | 62fc148 | 2017-12-14 19:03:56 -0800 | [diff] [blame] | 239 | char localTmpFileName[nativeLibPath.size() + TMP_FILE_PATTERN_LEN + 1]; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 240 | if (strlcpy(localTmpFileName, nativeLibPath.c_str(), sizeof(localTmpFileName)) |
| 241 | != nativeLibPath.size()) { |
Steve Block | 5baa3a6 | 2011-12-20 16:23:08 +0000 | [diff] [blame] | 242 | ALOGD("Couldn't allocate local file name for library"); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 243 | return INSTALL_FAILED_INTERNAL_ERROR; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 244 | } |
| 245 | |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 246 | if (strlcpy(localTmpFileName + nativeLibPath.size(), TMP_FILE_PATTERN, |
Ivan Lozano | 62fc148 | 2017-12-14 19:03:56 -0800 | [diff] [blame] | 247 | TMP_FILE_PATTERN_LEN + 1) != TMP_FILE_PATTERN_LEN) { |
Steve Block | 6215d3f | 2012-01-04 20:05:49 +0000 | [diff] [blame] | 248 | ALOGI("Couldn't allocate temporary file name for library"); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 249 | return INSTALL_FAILED_INTERNAL_ERROR; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | int fd = mkstemp(localTmpFileName); |
| 253 | if (fd < 0) { |
Steve Block | 6215d3f | 2012-01-04 20:05:49 +0000 | [diff] [blame] | 254 | ALOGI("Couldn't open temporary file name: %s: %s\n", localTmpFileName, strerror(errno)); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 255 | return INSTALL_FAILED_CONTAINER_ERROR; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | if (!zipFile->uncompressEntry(zipEntry, fd)) { |
Steve Block | 6215d3f | 2012-01-04 20:05:49 +0000 | [diff] [blame] | 259 | ALOGI("Failed uncompressing %s to %s\n", fileName, localTmpFileName); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 260 | close(fd); |
| 261 | unlink(localTmpFileName); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 262 | return INSTALL_FAILED_CONTAINER_ERROR; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | close(fd); |
| 266 | |
| 267 | // Set the modification time for this file to the ZIP's mod time. |
| 268 | struct timeval times[2]; |
| 269 | times[0].tv_sec = st.st_atime; |
| 270 | times[1].tv_sec = modTime; |
| 271 | times[0].tv_usec = times[1].tv_usec = 0; |
| 272 | if (utimes(localTmpFileName, times) < 0) { |
Steve Block | 6215d3f | 2012-01-04 20:05:49 +0000 | [diff] [blame] | 273 | ALOGI("Couldn't change modification time on %s: %s\n", localTmpFileName, strerror(errno)); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 274 | unlink(localTmpFileName); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 275 | return INSTALL_FAILED_CONTAINER_ERROR; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 276 | } |
| 277 | |
| 278 | // Set the mode to 755 |
| 279 | static const mode_t mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; |
| 280 | if (chmod(localTmpFileName, mode) < 0) { |
Steve Block | 6215d3f | 2012-01-04 20:05:49 +0000 | [diff] [blame] | 281 | ALOGI("Couldn't change permissions on %s: %s\n", localTmpFileName, strerror(errno)); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 282 | unlink(localTmpFileName); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 283 | return INSTALL_FAILED_CONTAINER_ERROR; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | // Finally, rename it to the final name. |
| 287 | if (rename(localTmpFileName, localFileName) < 0) { |
Steve Block | 6215d3f | 2012-01-04 20:05:49 +0000 | [diff] [blame] | 288 | ALOGI("Couldn't rename %s to %s: %s\n", localTmpFileName, localFileName, strerror(errno)); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 289 | unlink(localTmpFileName); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 290 | return INSTALL_FAILED_CONTAINER_ERROR; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 291 | } |
| 292 | |
Steve Block | 71f2cf1 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 293 | ALOGV("Successfully moved %s to %s\n", localTmpFileName, localFileName); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 294 | |
| 295 | return INSTALL_SUCCEEDED; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 296 | } |
| 297 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 298 | /* |
| 299 | * An iterator over all shared libraries in a zip file. An entry is |
| 300 | * considered to be a shared library if all of the conditions below are |
| 301 | * satisfied : |
| 302 | * |
| 303 | * - The entry is under the lib/ directory. |
| 304 | * - The entry name ends with ".so" and the entry name starts with "lib", |
| 305 | * an exception is made for entries whose name is "gdbserver". |
| 306 | * - The entry filename is "safe" (as determined by isFilenameSafe). |
| 307 | * |
| 308 | */ |
| 309 | class NativeLibrariesIterator { |
| 310 | private: |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 311 | NativeLibrariesIterator(ZipFileRO* zipFile, bool debuggable, void* cookie) |
| 312 | : mZipFile(zipFile), mDebuggable(debuggable), mCookie(cookie), mLastSlash(NULL) { |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 313 | fileName[0] = '\0'; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 314 | } |
| 315 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 316 | public: |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 317 | static NativeLibrariesIterator* create(ZipFileRO* zipFile, bool debuggable) { |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 318 | void* cookie = NULL; |
Yusuke Sato | 957c237 | 2015-08-03 16:17:16 -0700 | [diff] [blame] | 319 | // Do not specify a suffix to find both .so files and gdbserver. |
| 320 | if (!zipFile->startIteration(&cookie, APK_LIB, NULL /* suffix */)) { |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 321 | return NULL; |
| 322 | } |
| 323 | |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 324 | return new NativeLibrariesIterator(zipFile, debuggable, cookie); |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | ZipEntryRO next() { |
| 328 | ZipEntryRO next = NULL; |
| 329 | while ((next = mZipFile->nextEntry(mCookie)) != NULL) { |
| 330 | // Make sure this entry has a filename. |
| 331 | if (mZipFile->getEntryFileName(next, fileName, sizeof(fileName))) { |
| 332 | continue; |
| 333 | } |
| 334 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 335 | // Make sure the filename is at least to the minimum library name size. |
| 336 | const size_t fileNameLen = strlen(fileName); |
| 337 | static const size_t minLength = APK_LIB_LEN + 2 + LIB_PREFIX_LEN + 1 + LIB_SUFFIX_LEN; |
| 338 | if (fileNameLen < minLength) { |
| 339 | continue; |
| 340 | } |
| 341 | |
| 342 | const char* lastSlash = strrchr(fileName, '/'); |
| 343 | ALOG_ASSERT(lastSlash != NULL, "last slash was null somehow for %s\n", fileName); |
| 344 | |
Andreas Gampe | c012ae3 | 2016-12-15 16:12:39 -0800 | [diff] [blame] | 345 | // Skip directories. |
| 346 | if (*(lastSlash + 1) == 0) { |
| 347 | continue; |
| 348 | } |
| 349 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 350 | // Make sure the filename is safe. |
| 351 | if (!isFilenameSafe(lastSlash + 1)) { |
| 352 | continue; |
| 353 | } |
| 354 | |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 355 | if (!mDebuggable) { |
| 356 | // Make sure the filename starts with lib and ends with ".so". |
| 357 | if (strncmp(fileName + fileNameLen - LIB_SUFFIX_LEN, LIB_SUFFIX, LIB_SUFFIX_LEN) |
| 358 | || strncmp(lastSlash, LIB_PREFIX, LIB_PREFIX_LEN)) { |
| 359 | continue; |
| 360 | } |
| 361 | } |
| 362 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 363 | mLastSlash = lastSlash; |
| 364 | break; |
| 365 | } |
| 366 | |
| 367 | return next; |
| 368 | } |
| 369 | |
| 370 | inline const char* currentEntry() const { |
| 371 | return fileName; |
| 372 | } |
| 373 | |
| 374 | inline const char* lastSlash() const { |
| 375 | return mLastSlash; |
| 376 | } |
| 377 | |
| 378 | virtual ~NativeLibrariesIterator() { |
| 379 | mZipFile->endIteration(mCookie); |
| 380 | } |
| 381 | private: |
| 382 | |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 383 | char fileName[PATH_MAX]; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 384 | ZipFileRO* const mZipFile; |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 385 | const bool mDebuggable; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 386 | void* mCookie; |
| 387 | const char* mLastSlash; |
| 388 | }; |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 389 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 390 | static install_status_t |
| 391 | iterateOverNativeFiles(JNIEnv *env, jlong apkHandle, jstring javaCpuAbi, |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 392 | jboolean debuggable, iterFunc callFunc, void* callArg) { |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 393 | ZipFileRO* zipFile = reinterpret_cast<ZipFileRO*>(apkHandle); |
| 394 | if (zipFile == NULL) { |
Narayan Kamath | afd31e0 | 2013-12-03 13:16:03 +0000 | [diff] [blame] | 395 | return INSTALL_FAILED_INVALID_APK; |
| 396 | } |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 397 | |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 398 | std::unique_ptr<NativeLibrariesIterator> it( |
| 399 | NativeLibrariesIterator::create(zipFile, debuggable)); |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 400 | if (it.get() == NULL) { |
| 401 | return INSTALL_FAILED_INVALID_APK; |
| 402 | } |
| 403 | |
| 404 | const ScopedUtfChars cpuAbi(env, javaCpuAbi); |
| 405 | if (cpuAbi.c_str() == NULL) { |
| 406 | // This would've thrown, so this return code isn't observable by |
| 407 | // Java. |
| 408 | return INSTALL_FAILED_INVALID_APK; |
| 409 | } |
Narayan Kamath | afd31e0 | 2013-12-03 13:16:03 +0000 | [diff] [blame] | 410 | ZipEntryRO entry = NULL; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 411 | while ((entry = it->next()) != NULL) { |
| 412 | const char* fileName = it->currentEntry(); |
| 413 | const char* lastSlash = it->lastSlash(); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 414 | |
| 415 | // Check to make sure the CPU ABI of this file is one we support. |
| 416 | const char* cpuAbiOffset = fileName + APK_LIB_LEN; |
| 417 | const size_t cpuAbiRegionSize = lastSlash - cpuAbiOffset; |
| 418 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 419 | if (cpuAbi.size() == cpuAbiRegionSize && !strncmp(cpuAbiOffset, cpuAbi.c_str(), cpuAbiRegionSize)) { |
| 420 | install_status_t ret = callFunc(env, callArg, zipFile, entry, lastSlash + 1); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 421 | |
| 422 | if (ret != INSTALL_SUCCEEDED) { |
Steve Block | 71f2cf1 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 423 | ALOGV("Failure for entry %s", lastSlash + 1); |
Kenny Root | 1ebd74a | 2011-08-03 15:09:44 -0700 | [diff] [blame] | 424 | return ret; |
| 425 | } |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 426 | } |
| 427 | } |
| 428 | |
| 429 | return INSTALL_SUCCEEDED; |
| 430 | } |
| 431 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 432 | |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 433 | static int findSupportedAbi(JNIEnv *env, jlong apkHandle, jobjectArray supportedAbisArray, |
| 434 | jboolean debuggable) { |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 435 | const int numAbis = env->GetArrayLength(supportedAbisArray); |
| 436 | Vector<ScopedUtfChars*> supportedAbis; |
| 437 | |
| 438 | for (int i = 0; i < numAbis; ++i) { |
| 439 | supportedAbis.add(new ScopedUtfChars(env, |
| 440 | (jstring) env->GetObjectArrayElement(supportedAbisArray, i))); |
| 441 | } |
| 442 | |
| 443 | ZipFileRO* zipFile = reinterpret_cast<ZipFileRO*>(apkHandle); |
| 444 | if (zipFile == NULL) { |
| 445 | return INSTALL_FAILED_INVALID_APK; |
| 446 | } |
| 447 | |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 448 | std::unique_ptr<NativeLibrariesIterator> it( |
| 449 | NativeLibrariesIterator::create(zipFile, debuggable)); |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 450 | if (it.get() == NULL) { |
| 451 | return INSTALL_FAILED_INVALID_APK; |
| 452 | } |
| 453 | |
| 454 | ZipEntryRO entry = NULL; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 455 | int status = NO_NATIVE_LIBRARIES; |
| 456 | while ((entry = it->next()) != NULL) { |
| 457 | // We're currently in the lib/ directory of the APK, so it does have some native |
| 458 | // code. We should return INSTALL_FAILED_NO_MATCHING_ABIS if none of the |
| 459 | // libraries match. |
| 460 | if (status == NO_NATIVE_LIBRARIES) { |
| 461 | status = INSTALL_FAILED_NO_MATCHING_ABIS; |
| 462 | } |
| 463 | |
| 464 | const char* fileName = it->currentEntry(); |
| 465 | const char* lastSlash = it->lastSlash(); |
| 466 | |
| 467 | // Check to see if this CPU ABI matches what we are looking for. |
| 468 | const char* abiOffset = fileName + APK_LIB_LEN; |
| 469 | const size_t abiSize = lastSlash - abiOffset; |
| 470 | for (int i = 0; i < numAbis; i++) { |
| 471 | const ScopedUtfChars* abi = supportedAbis[i]; |
| 472 | if (abi->size() == abiSize && !strncmp(abiOffset, abi->c_str(), abiSize)) { |
| 473 | // The entry that comes in first (i.e. with a lower index) has the higher priority. |
| 474 | if (((i < status) && (status >= 0)) || (status < 0) ) { |
| 475 | status = i; |
| 476 | } |
| 477 | } |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | for (int i = 0; i < numAbis; ++i) { |
| 482 | delete supportedAbis[i]; |
| 483 | } |
| 484 | |
| 485 | return status; |
| 486 | } |
| 487 | |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 488 | static jint |
| 489 | com_android_internal_content_NativeLibraryHelper_copyNativeBinaries(JNIEnv *env, jclass clazz, |
Dmitriy Ivanov | dec4688 | 2014-09-30 15:10:48 -0700 | [diff] [blame] | 490 | jlong apkHandle, jstring javaNativeLibPath, jstring javaCpuAbi, |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 491 | jboolean extractNativeLibs, jboolean hasNativeBridge, jboolean debuggable) |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 492 | { |
Dmitriy Ivanov | dec4688 | 2014-09-30 15:10:48 -0700 | [diff] [blame] | 493 | void* args[] = { &javaNativeLibPath, &extractNativeLibs, &hasNativeBridge }; |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 494 | return (jint) iterateOverNativeFiles(env, apkHandle, javaCpuAbi, debuggable, |
Dmitriy Ivanov | dec4688 | 2014-09-30 15:10:48 -0700 | [diff] [blame] | 495 | copyFileIfChanged, reinterpret_cast<void*>(args)); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | static jlong |
| 499 | com_android_internal_content_NativeLibraryHelper_sumNativeBinaries(JNIEnv *env, jclass clazz, |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 500 | jlong apkHandle, jstring javaCpuAbi, jboolean debuggable) |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 501 | { |
| 502 | size_t totalSize = 0; |
| 503 | |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 504 | iterateOverNativeFiles(env, apkHandle, javaCpuAbi, debuggable, sumFiles, &totalSize); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 505 | |
| 506 | return totalSize; |
| 507 | } |
| 508 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 509 | static jint |
| 510 | com_android_internal_content_NativeLibraryHelper_findSupportedAbi(JNIEnv *env, jclass clazz, |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 511 | jlong apkHandle, jobjectArray javaCpuAbisToSearch, jboolean debuggable) |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 512 | { |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 513 | return (jint) findSupportedAbi(env, apkHandle, javaCpuAbisToSearch, debuggable); |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 514 | } |
| 515 | |
Narayan Kamath | d47e38b | 2014-05-16 16:45:56 +0100 | [diff] [blame] | 516 | enum bitcode_scan_result_t { |
| 517 | APK_SCAN_ERROR = -1, |
| 518 | NO_BITCODE_PRESENT = 0, |
| 519 | BITCODE_PRESENT = 1, |
| 520 | }; |
| 521 | |
| 522 | static jint |
| 523 | com_android_internal_content_NativeLibraryHelper_hasRenderscriptBitcode(JNIEnv *env, jclass clazz, |
| 524 | jlong apkHandle) { |
| 525 | ZipFileRO* zipFile = reinterpret_cast<ZipFileRO*>(apkHandle); |
| 526 | void* cookie = NULL; |
Yusuke Sato | 957c237 | 2015-08-03 16:17:16 -0700 | [diff] [blame] | 527 | if (!zipFile->startIteration(&cookie, NULL /* prefix */, RS_BITCODE_SUFFIX)) { |
Narayan Kamath | d47e38b | 2014-05-16 16:45:56 +0100 | [diff] [blame] | 528 | return APK_SCAN_ERROR; |
| 529 | } |
| 530 | |
| 531 | char fileName[PATH_MAX]; |
| 532 | ZipEntryRO next = NULL; |
| 533 | while ((next = zipFile->nextEntry(cookie)) != NULL) { |
| 534 | if (zipFile->getEntryFileName(next, fileName, sizeof(fileName))) { |
| 535 | continue; |
| 536 | } |
Narayan Kamath | d47e38b | 2014-05-16 16:45:56 +0100 | [diff] [blame] | 537 | const char* lastSlash = strrchr(fileName, '/'); |
| 538 | const char* baseName = (lastSlash == NULL) ? fileName : fileName + 1; |
Yusuke Sato | 957c237 | 2015-08-03 16:17:16 -0700 | [diff] [blame] | 539 | if (isFilenameSafe(baseName)) { |
Narayan Kamath | d47e38b | 2014-05-16 16:45:56 +0100 | [diff] [blame] | 540 | zipFile->endIteration(cookie); |
| 541 | return BITCODE_PRESENT; |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | zipFile->endIteration(cookie); |
| 546 | return NO_BITCODE_PRESENT; |
| 547 | } |
| 548 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 549 | static jlong |
| 550 | com_android_internal_content_NativeLibraryHelper_openApk(JNIEnv *env, jclass, jstring apkPath) |
| 551 | { |
| 552 | ScopedUtfChars filePath(env, apkPath); |
| 553 | ZipFileRO* zipFile = ZipFileRO::open(filePath.c_str()); |
| 554 | |
| 555 | return reinterpret_cast<jlong>(zipFile); |
| 556 | } |
| 557 | |
Dianne Hackborn | 1704e3c | 2017-10-31 19:55:42 +0000 | [diff] [blame] | 558 | static jlong |
| 559 | com_android_internal_content_NativeLibraryHelper_openApkFd(JNIEnv *env, jclass, |
| 560 | jobject fileDescriptor, jstring debugPathName) |
| 561 | { |
| 562 | ScopedUtfChars debugFilePath(env, debugPathName); |
| 563 | |
| 564 | int fd = jniGetFDFromFileDescriptor(env, fileDescriptor); |
| 565 | if (fd < 0) { |
| 566 | jniThrowException(env, "java/lang/IllegalArgumentException", "Bad FileDescriptor"); |
| 567 | return 0; |
| 568 | } |
| 569 | |
| 570 | ZipFileRO* zipFile = ZipFileRO::openFd(fd, debugFilePath.c_str()); |
| 571 | |
| 572 | return reinterpret_cast<jlong>(zipFile); |
| 573 | } |
| 574 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 575 | static void |
| 576 | com_android_internal_content_NativeLibraryHelper_close(JNIEnv *env, jclass, jlong apkHandle) |
| 577 | { |
| 578 | delete reinterpret_cast<ZipFileRO*>(apkHandle); |
| 579 | } |
| 580 | |
Daniel Micay | 76f6a86 | 2015-09-19 17:31:01 -0400 | [diff] [blame] | 581 | static const JNINativeMethod gMethods[] = { |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 582 | {"nativeOpenApk", |
| 583 | "(Ljava/lang/String;)J", |
| 584 | (void *)com_android_internal_content_NativeLibraryHelper_openApk}, |
Dianne Hackborn | 1704e3c | 2017-10-31 19:55:42 +0000 | [diff] [blame] | 585 | {"nativeOpenApkFd", |
| 586 | "(Ljava/io/FileDescriptor;Ljava/lang/String;)J", |
| 587 | (void *)com_android_internal_content_NativeLibraryHelper_openApkFd}, |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 588 | {"nativeClose", |
| 589 | "(J)V", |
| 590 | (void *)com_android_internal_content_NativeLibraryHelper_close}, |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 591 | {"nativeCopyNativeBinaries", |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 592 | "(JLjava/lang/String;Ljava/lang/String;ZZZ)I", |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 593 | (void *)com_android_internal_content_NativeLibraryHelper_copyNativeBinaries}, |
| 594 | {"nativeSumNativeBinaries", |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 595 | "(JLjava/lang/String;Z)J", |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 596 | (void *)com_android_internal_content_NativeLibraryHelper_sumNativeBinaries}, |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 597 | {"nativeFindSupportedAbi", |
Tamas Berghammer | d6dd6b8 | 2016-10-07 19:12:51 +0100 | [diff] [blame] | 598 | "(J[Ljava/lang/String;Z)I", |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 599 | (void *)com_android_internal_content_NativeLibraryHelper_findSupportedAbi}, |
Narayan Kamath | d47e38b | 2014-05-16 16:45:56 +0100 | [diff] [blame] | 600 | {"hasRenderscriptBitcode", "(J)I", |
| 601 | (void *)com_android_internal_content_NativeLibraryHelper_hasRenderscriptBitcode}, |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 602 | }; |
| 603 | |
| 604 | |
| 605 | int register_com_android_internal_content_NativeLibraryHelper(JNIEnv *env) |
| 606 | { |
Andreas Gampe | ed6b9df | 2014-11-20 22:02:20 -0800 | [diff] [blame] | 607 | return RegisterMethodsOrDie(env, |
| 608 | "com/android/internal/content/NativeLibraryHelper", gMethods, NELEM(gMethods)); |
Kenny Root | 66269ea | 2011-07-12 14:14:01 -0700 | [diff] [blame] | 609 | } |
| 610 | |
| 611 | }; |