<div dir="ltr">Doesn't reproduce on a newer debian with the exact same cmake command...<div>Let me start a 14.04 VM... <div>Perhaps, there is something incompatible with the older GOLD. </div><div><br></div><div>Could you please try the patch below and see if it helps?</div><div><a class="gmail_plusreply" id="plusReplyChip-0" href="mailto:eugenis@google.com" tabindex="-1">+Evgeniy Stepanov</a> to check if we still need this code on Android. <br></div><div><pre id="gmail-hterm:copy-to-clipboard-source" style="color:rgb(0,0,0)">Index: lib/hwasan/hwasan_dynamic_shadow.cc
===================================================================
--- lib/hwasan/hwasan_dynamic_shadow.cc (revision 341145)
+++ lib/hwasan/hwasan_dynamic_shadow.cc (working copy)
@@ -58,6 +58,7 @@
} // namespace __hwasan
+#if SANITIZER_ANDROID
extern "C" {
INTERFACE_ATTRIBUTE void __hwasan_shadow();
@@ -124,3 +125,13 @@
}
} // namespace __hwasan
+#else
+namespace __hwasan {
+
+uptr FindDynamicShadowStart(uptr shadow_size_bytes) {
+ return MapDynamicShadow(shadow_size_bytes);
+}
+
+} // namespace __hwasan
+#
+#endif // SANITIZER_ANDROID</pre></div><div><br></div><div> </div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 30, 2018 at 6:54 PM <<a href="mailto:douglas.yung@sony.com">douglas.yung@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div class="m_-5957945365641442275WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi Kostya,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Our linux machine is running Ubuntu 14.04.4 LTS with clang 3.7.1 and does the following:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="m_-5957945365641442275MsoListParagraph"><u></u><span style="font-size:11.0pt;font-family:Symbol;color:#1f497d"><span>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">mkdir build<u></u><u></u></span></p>
<p class="m_-5957945365641442275MsoListParagraph"><u></u><span style="font-size:11.0pt;font-family:Symbol;color:#1f497d"><span>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">cd build<u></u><u></u></span></p>
<p class="m_-5957945365641442275MsoListParagraph"><u></u><span style="font-size:10.5pt;font-family:Symbol;color:#333333"><span>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span style="font-size:10.5pt;font-family:"Courier New";color:#333333">cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_USE_LINKER=gold -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_TIMESTAMPS=OFF
-DLLVM_VERSION_SUFFIX= -DLLVM_BUILD_RUNTIME=ON -DLLVM_LIT_ARGS=--verbose --no-progress-bar --xunit-xml-output=xunit.xml -DCMAKE_BUILD_TYPE=Release ../llvm<u></u><u></u></span></p>
<p class="m_-5957945365641442275MsoListParagraph"><u></u><span style="font-size:11.0pt;font-family:Symbol;color:#1f497d"><span>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">ninja all<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">That should do it.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Kostya Serebryany [mailto:<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>]
<br>
<b>Sent:</b> Thursday, August 30, 2018 18:45<br>
<b>To:</b> Yung, Douglas<br>
<b>Cc:</b> LLVM Commits<br>
<b>Subject:</b> Re: [compiler-rt] r340983 - [hwasan] get rid of some macros, remove the fixed shadow mapping<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Looking... <u></u><u></u></p>
<div>
<p class="MsoNormal">Meanwhile, how do I reproduce your build?<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Thu, Aug 30, 2018 at 6:03 PM <<a href="mailto:douglas.yung@sony.com" target="_blank">douglas.yung@sony.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">Hi Kostya,<br>
<br>
Your commit is breaking our internal linux builder that uses clang 3.7.1 to build:<br>
<br>
FAILED: : && /usr/lib/ccache/clang++ -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++11 -O3 -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=gold -m64 -nodefaultlibs -Wl,--version-script,/home/siadmin/jenkins/w/opensource/opensource_build/build/projects/compiler-rt/lib/hwasan/clang_rt.hwasan-dynamic-x86_64.vers
-shared -Wl,-soname,<a href="http://libclang_rt.hwasan-x86_64.so" target="_blank">libclang_rt.hwasan-x86_64.so</a> -o lib/clang/8.0.0/lib/linux/<a href="http://libclang_rt.hwasan-x86_64.so" target="_blank">libclang_rt.hwasan-x86_64.so</a> projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan_dynamic.x86_64.dir/hwasan.cc.o
projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan_dynamic.x86_64.dir/hwasan_allocator.cc.o projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan_dynamic.x86_64.dir/hwasan_dynamic_shadow.cc.o projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan_dynamic.x86_64.dir/hwasan_interceptors.cc.o
projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan_dynamic.x86_64.dir/hwasan_linux.cc.o projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan_dynamic.x86_64.dir/hwasan_poisoning.cc.o projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan_dynamic.x86_64.dir/hwasan_report.cc.o
projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan_dynamic.x86_64.dir/hwasan_thread.cc.o projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan_dynamic.x86_64.dir/hwasan_new_delete.cc.o projects/compiler-rt/lib/interception/CMakeFiles/RTInterception.x86_64.dir/interception_linux.cc.o
projects/compiler-rt/lib/interception/CMakeFiles/RTInterception.x86_64.dir/interception_mac.cc.o projects/compiler-rt/lib/interception/CMakeFiles/RTInterception.x86_64.dir/interception_win.cc.o projects/compiler-rt/lib/interception/CMakeFiles/RTInterception.x86_64.dir/interception_type_test.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_allocator.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_common.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_deadlock_detector1.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_deadlock_detector2.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_errno.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_file.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_flags.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_flag_parser.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_fuchsia.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_libc.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_libignore.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_linux.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_linux_s390.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_mac.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_openbsd.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_persistent_allocator.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_linux.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_netbsd.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_openbsd.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_posix.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_solaris.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_posix.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_printf.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_procmaps_common.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_procmaps_bsd.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_procmaps_linux.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_procmaps_mac.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_procmaps_solaris.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_rtems.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_solaris.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_stoptheworld_mac.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_suppressions.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_tls_get_addr.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_thread_registry.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_win.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_linux_x86_64.S.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_linux_mips64.S.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_termination.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.x86_64.dir/sanitizer_common_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.x86_64.dir/sanitizer_allocator_checks.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.x86_64.dir/sanitizer_linux_libcdep.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.x86_64.dir/sanitizer_mac_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.x86_64.dir/sanitizer_posix_libcdep.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.x86_64.dir/sanitizer_stoptheworld_linux_libcdep.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonCoverage.x86_64.dir/sancov_flags.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonCoverage.x86_64.dir/sanitizer_coverage_fuchsia.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonCoverage.x86_64.dir/sanitizer_coverage_libcdep_new.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonCoverage.x86_64.dir/sanitizer_coverage_win_sections.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_allocator_report.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_stackdepot.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_stacktrace.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_stacktrace_libcdep.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_stacktrace_printer.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_stacktrace_sparc.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_symbolizer.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_symbolizer_libbacktrace.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_symbolizer_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_symbolizer_mac.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_symbolizer_markup.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_symbolizer_posix_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_symbolizer_report.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_symbolizer_win.cc.o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_unwind_linux_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_unwind_win.cc.o projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.x86_64.dir/ubsan_diag.cc.o projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.x86_64.dir/ubsan_init.cc.o
projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.x86_64.dir/ubsan_flags.cc.o projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.x86_64.dir/ubsan_handlers.cc.o projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.x86_64.dir/ubsan_monitor.cc.o projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.x86_64.dir/ubsan_value.cc.o
projects/compiler-rt/lib/hwasan/CMakeFiles/RTHwasan_dynamic_version_script_dummy.x86_64.dir/dummy.cc.o -lstdc++ -lgcc_s -lc -ldl -lrt -lm -lpthread -Wl,-rpath,"\$ORIGIN/../lib" && :<br>
/home/siadmin/jenkins/w/opensource/opensource_build/llvm/projects/compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cc:121: error: undefined reference to '__hwasan_shadow'<br>
/home/siadmin/jenkins/w/opensource/opensource_build/llvm/projects/compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cc:124: error: undefined reference to '__hwasan_shadow'<br>
clang: error: linker command failed with exit code 1 (use -v to see invocation)<br>
<br>
Can you take a look?<br>
<br>
Douglas Yung<br>
<br>
> -----Original Message-----<br>
> From: llvm-commits [mailto:<a href="mailto:llvm-commits-bounces@lists.llvm.org" target="_blank">llvm-commits-bounces@lists.llvm.org</a>] On<br>
> Behalf Of Kostya Serebryany via llvm-commits<br>
> Sent: Wednesday, August 29, 2018 15:42<br>
> To: <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> Subject: [compiler-rt] r340983 - [hwasan] get rid of some macros,<br>
> remove the fixed shadow mapping<br>
> <br>
> Author: kcc<br>
> Date: Wed Aug 29 15:42:16 2018<br>
> New Revision: 340983<br>
> <br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=340983&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=340983&view=rev</a><br>
> Log:<br>
> [hwasan] get rid of some macros, remove the fixed shadow mapping<br>
> <br>
> Modified:<br>
> compiler-rt/trunk/lib/hwasan/hwasan.cc<br>
> compiler-rt/trunk/lib/hwasan/hwasan_allocator.cc<br>
> compiler-rt/trunk/lib/hwasan/hwasan_dynamic_shadow.cc<br>
> compiler-rt/trunk/lib/hwasan/hwasan_linux.cc<br>
> compiler-rt/trunk/lib/hwasan/hwasan_mapping.h<br>
> compiler-rt/trunk/lib/hwasan/hwasan_poisoning.cc<br>
> compiler-rt/trunk/lib/hwasan/hwasan_report.cc<br>
> compiler-rt/trunk/lib/hwasan/hwasan_thread.cc<br>
> <br>
> Modified: compiler-rt/trunk/lib/hwasan/hwasan.cc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/hwasan/hwasan.cc?rev=340983&r1=340982&r2=340983&view=diff<br>
> =======================================================================<br>
> =======<br>
> --- compiler-rt/trunk/lib/hwasan/hwasan.cc (original)<br>
> +++ compiler-rt/trunk/lib/hwasan/hwasan.cc Wed Aug 29 15:42:16 2018<br>
> @@ -167,12 +167,6 @@ void __hwasan_shadow_init() {<br>
> if (hwasan_shadow_inited) return;<br>
> if (!InitShadow()) {<br>
> Printf("FATAL: HWAddressSanitizer cannot mmap the shadow<br>
> memory.\n");<br>
> - if (HWASAN_FIXED_MAPPING) {<br>
> - Printf("FATAL: Make sure to compile with -fPIE and to link with<br>
> -pie.\n");<br>
> - Printf("FATAL: Disabling ASLR is known to cause this error.\n");<br>
> - Printf("FATAL: If running under GDB, try "<br>
> - "'set disable-randomization off'.\n");<br>
> - }<br>
> DumpProcessMap();<br>
> Die();<br>
> }<br>
> @@ -230,12 +224,12 @@ void __hwasan_init() {<br>
> <br>
> void __hwasan_print_shadow(const void *p, uptr sz) {<br>
> uptr ptr_raw = UntagAddr(reinterpret_cast<uptr>(p));<br>
> - uptr shadow_first = MEM_TO_SHADOW(ptr_raw);<br>
> - uptr shadow_last = MEM_TO_SHADOW(ptr_raw + sz - 1);<br>
> + uptr shadow_first = MemToShadow(ptr_raw);<br>
> + uptr shadow_last = MemToShadow(ptr_raw + sz - 1);<br>
> Printf("HWASan shadow map for %zx .. %zx (pointer tag %x)\n",<br>
> ptr_raw,<br>
> ptr_raw + sz, GetTagFromPointer((uptr)p));<br>
> for (uptr s = shadow_first; s <= shadow_last; ++s)<br>
> - Printf(" %zx: %x\n", SHADOW_TO_MEM(s), *(tag_t *)s);<br>
> + Printf(" %zx: %x\n", ShadowToMem(s), *(tag_t *)s);<br>
> }<br>
> <br>
> sptr __hwasan_test_shadow(const void *p, uptr sz) {<br>
> @@ -245,11 +239,11 @@ sptr __hwasan_test_shadow(const void *p,<br>
> if (ptr_tag == 0)<br>
> return -1;<br>
> uptr ptr_raw = UntagAddr(reinterpret_cast<uptr>(p));<br>
> - uptr shadow_first = MEM_TO_SHADOW(ptr_raw);<br>
> - uptr shadow_last = MEM_TO_SHADOW(ptr_raw + sz - 1);<br>
> + uptr shadow_first = MemToShadow(ptr_raw);<br>
> + uptr shadow_last = MemToShadow(ptr_raw + sz - 1);<br>
> for (uptr s = shadow_first; s <= shadow_last; ++s)<br>
> if (*(tag_t*)s != ptr_tag)<br>
> - return SHADOW_TO_MEM(s) - ptr_raw;<br>
> + return ShadowToMem(s) - ptr_raw;<br>
> return -1;<br>
> }<br>
> <br>
> @@ -305,7 +299,7 @@ template <ErrorAction EA, AccessType AT,<br>
> __attribute__((always_inline, nodebug)) static void CheckAddress(uptr<br>
> p) {<br>
> tag_t ptr_tag = GetTagFromPointer(p);<br>
> uptr ptr_raw = p & ~kAddressTagMask;<br>
> - tag_t mem_tag = *(tag_t *)MEM_TO_SHADOW(ptr_raw);<br>
> + tag_t mem_tag = *(tag_t *)MemToShadow(ptr_raw);<br>
> if (UNLIKELY(ptr_tag != mem_tag)) {<br>
> SigTrap<0x20 * (EA == ErrorAction::Recover) +<br>
> 0x10 * (AT == AccessType::Store) + LogSize>(p);<br>
> @@ -319,8 +313,8 @@ __attribute__((always_inline, nodebug))<br>
> CHECK_NE(0, sz);<br>
> tag_t ptr_tag = GetTagFromPointer(p);<br>
> uptr ptr_raw = p & ~kAddressTagMask;<br>
> - tag_t *shadow_first = (tag_t *)MEM_TO_SHADOW(ptr_raw);<br>
> - tag_t *shadow_last = (tag_t *)MEM_TO_SHADOW(ptr_raw + sz - 1);<br>
> + tag_t *shadow_first = (tag_t *)MemToShadow(ptr_raw);<br>
> + tag_t *shadow_last = (tag_t *)MemToShadow(ptr_raw + sz - 1);<br>
> for (tag_t *t = shadow_first; t <= shadow_last; ++t)<br>
> if (UNLIKELY(ptr_tag != *t)) {<br>
> SigTrap<0x20 * (EA == ErrorAction::Recover) +<br>
> <br>
> Modified: compiler-rt/trunk/lib/hwasan/hwasan_allocator.cc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/hwasan/hwasan_allocator.cc?rev=340983&r1=340982&r2=340983&<br>
> view=diff<br>
> =======================================================================<br>
> =======<br>
> --- compiler-rt/trunk/lib/hwasan/hwasan_allocator.cc (original)<br>
> +++ compiler-rt/trunk/lib/hwasan/hwasan_allocator.cc Wed Aug 29<br>
> 15:42:16 2018<br>
> @@ -178,7 +178,7 @@ static bool PointerAndMemoryTagsMatch(vo<br>
> CHECK(tagged_ptr);<br>
> tag_t ptr_tag =<br>
> GetTagFromPointer(reinterpret_cast<uptr>(tagged_ptr));<br>
> tag_t mem_tag = *reinterpret_cast<tag_t *>(<br>
> - MEM_TO_SHADOW(UntagPtr(tagged_ptr)));<br>
> + MemToShadow(reinterpret_cast<uptr>(UntagPtr(tagged_ptr))));<br>
> return ptr_tag == mem_tag;<br>
> }<br>
> <br>
> <br>
> Modified: compiler-rt/trunk/lib/hwasan/hwasan_dynamic_shadow.cc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/hwasan/hwasan_dynamic_shadow.cc?rev=340983&r1=340982&r2=34<br>
> 0983&view=diff<br>
> =======================================================================<br>
> =======<br>
> --- compiler-rt/trunk/lib/hwasan/hwasan_dynamic_shadow.cc (original)<br>
> +++ compiler-rt/trunk/lib/hwasan/hwasan_dynamic_shadow.cc Wed Aug 29<br>
> 15:42:16 2018<br>
> @@ -58,8 +58,6 @@ static uptr MapDynamicShadow(uptr shadow<br>
> <br>
> } // namespace __hwasan<br>
> <br>
> -#if HWASAN_PREMAP_SHADOW<br>
> -<br>
> extern "C" {<br>
> <br>
> INTERFACE_ATTRIBUTE void __hwasan_shadow();<br>
> @@ -117,15 +115,11 @@ void __hwasan_shadow();<br>
> <br>
> } // extern "C"<br>
> <br>
> -#endif // HWASAN_PREMAP_SHADOW<br>
> -<br>
> namespace __hwasan {<br>
> <br>
> uptr FindDynamicShadowStart(uptr shadow_size_bytes) {<br>
> -#if HWASAN_PREMAP_SHADOW<br>
> if (IsPremapShadowAvailable())<br>
> return FindPremappedShadowStart(shadow_size_bytes);<br>
> -#endif<br>
> return MapDynamicShadow(shadow_size_bytes);<br>
> }<br>
> <br>
> <br>
> Modified: compiler-rt/trunk/lib/hwasan/hwasan_linux.cc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/hwasan/hwasan_linux.cc?rev=340983&r1=340982&r2=340983&view<br>
> =diff<br>
> =======================================================================<br>
> =======<br>
> --- compiler-rt/trunk/lib/hwasan/hwasan_linux.cc (original)<br>
> +++ compiler-rt/trunk/lib/hwasan/hwasan_linux.cc Wed Aug 29 15:42:16<br>
> 2018<br>
> @@ -157,7 +157,7 @@ bool InitShadow() {<br>
> kHighMemEnd = GetHighMemEnd();<br>
> <br>
> // Determine shadow memory base offset.<br>
> - InitializeShadowBaseAddress(MEM_TO_SHADOW_SIZE(kHighMemEnd));<br>
> + InitializeShadowBaseAddress(MemToShadowSize(kHighMemEnd));<br>
> <br>
> // Place the low memory first.<br>
> if (SHADOW_OFFSET) {<br>
> @@ -166,20 +166,20 @@ bool InitShadow() {<br>
> } else {<br>
> // LowMem covers as much of the first 4GB as possible.<br>
> kLowMemEnd = (1UL << 32) - 1;<br>
> - kLowMemStart = MEM_TO_SHADOW(kLowMemEnd) + 1;<br>
> + kLowMemStart = MemToShadow(kLowMemEnd) + 1;<br>
> }<br>
> <br>
> // Define the low shadow based on the already placed low memory.<br>
> - kLowShadowEnd = MEM_TO_SHADOW(kLowMemEnd);<br>
> - kLowShadowStart = SHADOW_OFFSET ? SHADOW_OFFSET :<br>
> MEM_TO_SHADOW(kLowMemStart);<br>
> + kLowShadowEnd = MemToShadow(kLowMemEnd);<br>
> + kLowShadowStart = SHADOW_OFFSET ? SHADOW_OFFSET :<br>
> MemToShadow(kLowMemStart);<br>
> <br>
> // High shadow takes whatever memory is left up there (making sure<br>
> it is not<br>
> // interfering with low memory in the fixed case).<br>
> - kHighShadowEnd = MEM_TO_SHADOW(kHighMemEnd);<br>
> - kHighShadowStart = Max(kLowMemEnd, MEM_TO_SHADOW(kHighShadowEnd)) +<br>
> 1;<br>
> + kHighShadowEnd = MemToShadow(kHighMemEnd);<br>
> + kHighShadowStart = Max(kLowMemEnd, MemToShadow(kHighShadowEnd)) + 1;<br>
> <br>
> // High memory starts where allocated shadow allows.<br>
> - kHighMemStart = SHADOW_TO_MEM(kHighShadowStart);<br>
> + kHighMemStart = ShadowToMem(kHighShadowStart);<br>
> <br>
> // Check the sanity of the defined memory ranges (there might be<br>
> gaps).<br>
> CHECK_EQ(kHighMemStart % GetMmapGranularity(), 0);<br>
> <br>
> Modified: compiler-rt/trunk/lib/hwasan/hwasan_mapping.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/hwasan/hwasan_mapping.h?rev=340983&r1=340982&r2=340983&vie<br>
> w=diff<br>
> =======================================================================<br>
> =======<br>
> --- compiler-rt/trunk/lib/hwasan/hwasan_mapping.h (original)<br>
> +++ compiler-rt/trunk/lib/hwasan/hwasan_mapping.h Wed Aug 29 15:42:16<br>
> 2018<br>
> @@ -16,6 +16,7 @@<br>
> #define HWASAN_MAPPING_H<br>
> <br>
> #include "sanitizer_common/sanitizer_internal_defs.h"<br>
> +#include "hwasan_interface_internal.h"<br>
> <br>
> // Typical mapping on Linux/x86_64 with fixed shadow mapping:<br>
> // || [0x080000000000, 0x7fffffffffff] || HighMem ||<br>
> @@ -47,37 +48,28 @@<br>
> // || [0x007477480000, 0x007bbebc7fff] || LowShadow ||<br>
> // || [0x000000000000, 0x00747747ffff] || LowMem ||<br>
> <br>
> -static constexpr __sanitizer::u64 kDefaultShadowSentinel =<br>
> ~(__sanitizer::u64)0;<br>
> +static constexpr u64 kDefaultShadowSentinel = ~(u64)0;<br>
> <br>
> // Reasonable values are 4 (for 1/16th shadow) and 6 (for 1/64th).<br>
> -constexpr __sanitizer::uptr kShadowScale = 4;<br>
> -constexpr __sanitizer::uptr kShadowAlignment = 1ULL << kShadowScale;<br>
> +constexpr uptr kShadowScale = 4;<br>
> +constexpr uptr kShadowAlignment = 1ULL << kShadowScale;<br>
> <br>
> -#if SANITIZER_ANDROID<br>
> -# define HWASAN_FIXED_MAPPING 0<br>
> -#else<br>
> -# define HWASAN_FIXED_MAPPING 1<br>
> -#endif<br>
> -<br>
> -#if HWASAN_FIXED_MAPPING<br>
> -# define SHADOW_OFFSET (0)<br>
> -# define HWASAN_PREMAP_SHADOW 0<br>
> -#else<br>
> -# define SHADOW_OFFSET (__hwasan_shadow_memory_dynamic_address)<br>
> -# define HWASAN_PREMAP_SHADOW 1<br>
> -#endif<br>
> +#define SHADOW_OFFSET (__hwasan_shadow_memory_dynamic_address)<br>
> <br>
> #define SHADOW_GRANULARITY (1ULL << kShadowScale)<br>
> <br>
> -#define MEM_TO_SHADOW(mem) (((uptr)(mem) >> kShadowScale) +<br>
> SHADOW_OFFSET)<br>
> -#define SHADOW_TO_MEM(shadow) (((uptr)(shadow) - SHADOW_OFFSET) <<<br>
> kShadowScale)<br>
> -<br>
> -#define MEM_TO_SHADOW_SIZE(size) ((uptr)(size) >> kShadowScale)<br>
> -<br>
> -#define MEM_IS_APP(mem) MemIsApp((uptr)(mem))<br>
> -<br>
> namespace __hwasan {<br>
> <br>
> +inline uptr MemToShadow(uptr untagged_addr) {<br>
> + return (untagged_addr >> kShadowScale) + SHADOW_OFFSET;<br>
> +}<br>
> +inline uptr ShadowToMem(uptr shadow_addr) {<br>
> + return (shadow_addr - SHADOW_OFFSET) << kShadowScale;<br>
> +}<br>
> +inline uptr MemToShadowSize(uptr size) {<br>
> + return size >> kShadowScale;<br>
> +}<br>
> +<br>
> bool MemIsApp(uptr p);<br>
> <br>
> } // namespace __hwasan<br>
> <br>
> Modified: compiler-rt/trunk/lib/hwasan/hwasan_poisoning.cc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/hwasan/hwasan_poisoning.cc?rev=340983&r1=340982&r2=340983&<br>
> view=diff<br>
> =======================================================================<br>
> =======<br>
> --- compiler-rt/trunk/lib/hwasan/hwasan_poisoning.cc (original)<br>
> +++ compiler-rt/trunk/lib/hwasan/hwasan_poisoning.cc Wed Aug 29<br>
> 15:42:16 2018<br>
> @@ -22,8 +22,8 @@ namespace __hwasan {<br>
> uptr TagMemoryAligned(uptr p, uptr size, tag_t tag) {<br>
> CHECK(IsAligned(p, kShadowAlignment));<br>
> CHECK(IsAligned(size, kShadowAlignment));<br>
> - uptr shadow_start = MEM_TO_SHADOW(p);<br>
> - uptr shadow_size = MEM_TO_SHADOW_SIZE(size);<br>
> + uptr shadow_start = MemToShadow(p);<br>
> + uptr shadow_size = MemToShadowSize(size);<br>
> internal_memset((void *)shadow_start, tag, shadow_size);<br>
> return AddTagToPointer(p, tag);<br>
> }<br>
> <br>
> Modified: compiler-rt/trunk/lib/hwasan/hwasan_report.cc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/hwasan/hwasan_report.cc?rev=340983&r1=340982&r2=340983&vie<br>
> w=diff<br>
> =======================================================================<br>
> =======<br>
> --- compiler-rt/trunk/lib/hwasan/hwasan_report.cc (original)<br>
> +++ compiler-rt/trunk/lib/hwasan/hwasan_report.cc Wed Aug 29 15:42:16<br>
> 2018<br>
> @@ -151,7 +151,7 @@ void ReportInvalidFree(StackTrace *stack<br>
> ScopedErrorReportLock l;<br>
> uptr untagged_addr = UntagAddr(tagged_addr);<br>
> tag_t ptr_tag = GetTagFromPointer(tagged_addr);<br>
> - tag_t *tag_ptr =<br>
> reinterpret_cast<tag_t*>(MEM_TO_SHADOW(untagged_addr));<br>
> + tag_t *tag_ptr =<br>
> reinterpret_cast<tag_t*>(MemToShadow(untagged_addr));<br>
> tag_t mem_tag = *tag_ptr;<br>
> Decorator d;<br>
> Printf("%s", d.Error());<br>
> @@ -187,7 +187,7 @@ void ReportTagMismatch(StackTrace *stack<br>
> untagged_addr, pc);<br>
> <br>
> tag_t ptr_tag = GetTagFromPointer(tagged_addr);<br>
> - tag_t *tag_ptr =<br>
> reinterpret_cast<tag_t*>(MEM_TO_SHADOW(untagged_addr));<br>
> + tag_t *tag_ptr =<br>
> reinterpret_cast<tag_t*>(MemToShadow(untagged_addr));<br>
> tag_t mem_tag = *tag_ptr;<br>
> Printf("%s", d.Access());<br>
> Printf("%s of size %zu at %p tags: %02x/%02x (ptr/mem)\n",<br>
> <br>
> Modified: compiler-rt/trunk/lib/hwasan/hwasan_thread.cc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/hwasan/hwasan_thread.cc?rev=340983&r1=340982&r2=340983&vie<br>
> w=diff<br>
> =======================================================================<br>
> =======<br>
> --- compiler-rt/trunk/lib/hwasan/hwasan_thread.cc (original)<br>
> +++ compiler-rt/trunk/lib/hwasan/hwasan_thread.cc Wed Aug 29 15:42:16<br>
> 2018<br>
> @@ -54,15 +54,15 @@ void HwasanThread::SetThreadStackAndTls(<br>
> <br>
> int local;<br>
> CHECK(AddrIsInStack((uptr)&local));<br>
> - CHECK(MEM_IS_APP(stack_bottom_));<br>
> - CHECK(MEM_IS_APP(stack_top_ - 1));<br>
> + CHECK(MemIsApp(stack_bottom_));<br>
> + CHECK(MemIsApp(stack_top_ - 1));<br>
> }<br>
> <br>
> void HwasanThread::Init() {<br>
> SetThreadStackAndTls();<br>
> if (stack_bottom_) {<br>
> - CHECK(MEM_IS_APP(stack_bottom_));<br>
> - CHECK(MEM_IS_APP(stack_top_ - 1));<br>
> + CHECK(MemIsApp(stack_bottom_));<br>
> + CHECK(MemIsApp(stack_top_ - 1));<br>
> }<br>
> }<br>
> <br>
> <br>
> <br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote></div>