1 Art versions in the directory, and where they were build from 2 ------------------------------------------------------------- 3 4 See https://source.android.com/source/build-numbers.html for build numbers. 5 6 Device names: 7 8 angler: Nexus 6P 9 mako: Nexus 4 10 11 12 art (default) 13 ------------- 14 Build from AOSP branch master. To update to a new AOSP master 15 16 mkdir master 17 cd master 18 repo init -u https://android.googlesource.com/platform/manifest -b master 19 repo sync -cq -j24 20 source build/envsetup.sh 21 lunch aosp_angler-eng 22 m -j24 23 m -j24 build-art 24 m -j24 test-art-host 25 26 Collected into tools/linux/art 27 28 scripts/update-host-art.sh --android-checkout ~/android/master --art-dir art 29 30 The precise info for the AOSP master used is in aosp_master_manifest.xml, which is 31 produced using this command: 32 33 repo manifest -o aosp_master_manifest.xml -r 34 35 To reproduce that AOSP state, use the following commands: 36 37 mkdir master 38 cd master 39 mkdir -p .repo/manifests 40 cp <r8-checkout>/aosp_master_manifest.xml .repo/manifests 41 repo init -u https://android.googlesource.com/platform/manifest -m aosp_master_manifest.xml 42 <continue with repo sync as above> 43 44 45 art-7.0.0 46 --------- 47 Build from branch android-7.0.0_r21 with the following patch: 48 49 diff --git a/runtime/thread.cc b/runtime/thread.cc 50 index 16f30cded..acdd995e9 100644 51 --- a/runtime/thread.cc 52 +++ b/runtime/thread.cc 53 @@ -554,6 +554,12 @@ void Thread::InstallImplicitProtection() { 54 // AddressSanitizer does not like the part of this functions that reads every stack page. 55 // Looks a lot like an out-of-bounds access. 56 57 + // 58 + // Accesses too far below the current machine register corresponding to the stack pointer (e.g., 59 + // ESP on x86[-32], SP on ARM) might cause a SIGSEGV (at least on x86 with newer kernels). We 60 + // thus have to move the stack pointer. We do this portably by using a recursive function with a 61 + // large stack frame size. 62 + 63 // (Defensively) first remove the protection on the protected region as will want to read 64 // and write it. Ignore errors. 65 UnprotectStack(); 66 @@ -561,12 +567,26 @@ void Thread::InstallImplicitProtection() { 67 VLOG(threads) << "Need to map in stack for thread at " << std::hex << 68 static_cast<void*>(pregion); 69 70 - // Read every page from the high address to the low. 71 - volatile uint8_t dont_optimize_this; 72 - UNUSED(dont_optimize_this); 73 - for (uint8_t* p = stack_top; p >= pregion; p -= kPageSize) { 74 - dont_optimize_this = *p; 75 - } 76 + struct RecurseDownStack { 77 + // This function has an intentionally large stack size. 78 +#pragma GCC diagnostic push 79 +#pragma GCC diagnostic ignored "-Wframe-larger-than=" 80 + NO_INLINE 81 + static void Touch(uintptr_t target) { 82 + volatile size_t zero = 0; 83 + // Use a large local volatile array to ensure a large frame size. Do not use anything close 84 + // to a full page for ASAN. It would be nice to ensure the frame size is at most a page, but 85 + // there is no pragma support for this. 86 + volatile char space[kPageSize - 256]; 87 + char sink ATTRIBUTE_UNUSED = space[zero]; 88 + if (reinterpret_cast<uintptr_t>(space) >= target + kPageSize) { 89 + Touch(target); 90 + } 91 + zero *= 2; // Try to avoid tail recursion. 92 + } 93 +#pragma GCC diagnostic pop 94 + }; 95 + RecurseDownStack::Touch(reinterpret_cast<uintptr_t>(pregion)); 96 97 VLOG(threads) << "(again) installing stack protected region at " << std::hex << 98 static_cast<void*>(pregion) << " to " << 99 100 101 mkdir 7.0.0_r21 102 cd 7.0.0_r21 103 repo init -u https://android.googlesource.com/platform/manifest -b android-7.0.0_r21 104 repo sync -cq -j24 105 source build/envsetup.sh 106 lunch aosp_angler-userdebug 107 cd art 108 <apply patch> 109 cd .. 110 m -j24 111 m -j24 build-art 112 m -j24 test-art-host 113 114 Collected into tools/linux/art-7.0.0. 115 116 scripts/update-host-art.sh --android-checkout ~/android/7.0.0_r21 --art-dir art-7.0.0 117 118 119 art-6.0.1 120 --------- 121 Build from branch android-6.0.1_r66 with the following patch: 122 123 diff --git a/runtime/thread.cc b/runtime/thread.cc 124 index 6e8f89cb4..788d717ca 100644 125 --- a/runtime/thread.cc 126 +++ b/runtime/thread.cc 127 @@ -357,20 +357,37 @@ void Thread::InstallImplicitProtection() { 128 uint8_t* stack_top = reinterpret_cast<uint8_t*>(reinterpret_cast<uintptr_t>(&stack_himem) & 129 ~(kPageSize - 1)); // Page containing current top of stack. 130 131 + // 132 + // Accesses too far below the current machine register corresponding to the stack pointer (e.g., 133 + // ESP on x86[-32], SP on ARM) might cause a SIGSEGV (at least on x86 with newer kernels). We 134 + // thus have to move the stack pointer. We do this portably by using a recursive function with a 135 + // large stack frame size. 136 + 137 // First remove the protection on the protected region as will want to read and 138 // write it. This may fail (on the first attempt when the stack is not mapped) 139 // but we ignore that. 140 UnprotectStack(); 141 142 - // Map in the stack. This must be done by reading from the 143 - // current stack pointer downwards as the stack may be mapped using VM_GROWSDOWN 144 - // in the kernel. Any access more than a page below the current SP might cause 145 - // a segv. 146 - 147 - // Read every page from the high address to the low. 148 - for (uint8_t* p = stack_top; p >= pregion; p -= kPageSize) { 149 - dont_optimize_this = *p; 150 - } 151 + struct RecurseDownStack { 152 + // This function has an intentionally large stack size. 153 +#pragma GCC diagnostic push 154 +#pragma GCC diagnostic ignored "-Wframe-larger-than=" 155 + NO_INLINE 156 + static void Touch(uintptr_t target) { 157 + volatile size_t zero = 0; 158 + // Use a large local volatile array to ensure a large frame size. Do not use anything close 159 + // to a full page for ASAN. It would be nice to ensure the frame size is at most a page, but 160 + // there is no pragma support for this. 161 + volatile char space[kPageSize - 256]; 162 + char sink ATTRIBUTE_UNUSED = space[zero]; 163 + if (reinterpret_cast<uintptr_t>(space) >= target + kPageSize) { 164 + Touch(target); 165 + } 166 + zero *= 2; // Try to avoid tail recursion. 167 + } 168 +#pragma GCC diagnostic pop 169 + }; 170 + RecurseDownStack::Touch(reinterpret_cast<uintptr_t>(pregion)); 171 172 VLOG(threads) << "installing stack protected region at " << std::hex << 173 static_cast<void*>(pregion) << " to " << 174 175 176 mkdir 6.0.1_r66 177 cd 6.0.1_r66 178 repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r66 179 repo sync -cq -j24 180 source build/envsetup.sh 181 lunch aosp_angler-userdebug 182 cd art 183 <apply patch> 184 cd .. 185 m -j24 186 m -j24 build-art 187 m -j24 test-art-host 188 189 Collected into tools/linux/art-6.0.1. 190 191 scripts/update-host-art.sh --android-checkout ~/android/6.0.1_r66 --art-dir art-6.0.1 192 193 194 art-5.1.1 195 --------- 196 Build from branch 5.1.1_r19 with the following patch: 197 198 diff --git a/runtime/thread.cc b/runtime/thread.cc 199 index 2f474f7ae..f927ad7a3 100644 200 --- a/runtime/thread.cc 201 +++ b/runtime/thread.cc 202 @@ -257,20 +257,39 @@ void Thread::InstallImplicitProtection() { 203 byte* stack_top = reinterpret_cast<byte*>(reinterpret_cast<uintptr_t>(&stack_himem) & 204 ~(kPageSize - 1)); // Page containing current top of stack. 205 206 + // 207 + // Accesses too far below the current machine register corresponding to the stack pointer (e.g., 208 + // ESP on x86[-32], SP on ARM) might cause a SIGSEGV (at least on x86 with newer kernels). We 209 + // thus have to move the stack pointer. We do this portably by using a recursive function with a 210 + // large stack frame size. 211 + 212 // First remove the protection on the protected region as will want to read and 213 // write it. This may fail (on the first attempt when the stack is not mapped) 214 // but we ignore that. 215 UnprotectStack(); 216 217 - // Map in the stack. This must be done by reading from the 218 - // current stack pointer downwards as the stack may be mapped using VM_GROWSDOWN 219 - // in the kernel. Any access more than a page below the current SP might cause 220 - // a segv. 221 - 222 - // Read every page from the high address to the low. 223 - for (byte* p = stack_top; p >= pregion; p -= kPageSize) { 224 - dont_optimize_this = *p; 225 - } 226 +#define NO_INLINE __attribute__ ((noinline)) 227 +#define ATTRIBUTE_UNUSED __attribute__((__unused__)) 228 + struct RecurseDownStack { 229 + // This function has an intentionally large stack size. 230 +#pragma GCC diagnostic push 231 +#pragma GCC diagnostic ignored "-Wframe-larger-than=" 232 + NO_INLINE 233 + static void Touch(uintptr_t target) { 234 + volatile size_t zero = 0; 235 + // Use a large local volatile array to ensure a large frame size. Do not use anything close 236 + // to a full page for ASAN. It would be nice to ensure the frame size is at most a page, but 237 + // there is no pragma support for this. 238 + volatile char space[kPageSize - 256]; 239 + char sink ATTRIBUTE_UNUSED = space[zero]; 240 + if (reinterpret_cast<uintptr_t>(space) >= target + kPageSize) { 241 + Touch(target); 242 + } 243 + zero *= 2; // Try to avoid tail recursion. 244 + } 245 +#pragma GCC diagnostic pop 246 + }; 247 + RecurseDownStack::Touch(reinterpret_cast<uintptr_t>(pregion)); 248 249 VLOG(threads) << "installing stack protected region at " << std::hex << 250 static_cast<void*>(pregion) << " to " << 251 252 253 mkdir 5.1.1_r19 254 cd 5.1.1_r19 255 repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.1_r19 256 repo sync -cq -j24 257 source build/envsetup.sh 258 lunch aosp_mako-userdebug 259 cd art 260 <apply patch> 261 cd .. 262 m -j24 263 m -j24 build-art 264 m -j24 test-art-host 265 266 Collected into tools/linux/art-5.1.1. 267 268 scripts/update-host-art.sh --android-checkout ~/android/5.1.1_r19 --art-dir art-5.1.1 --android-product mako 269