[libsanitizer] AddressSanitizer: fix for SPARC with GCC

Message ID 3903998.RHMxXVOS9R@polaris
State New
Headers show
Series
  • [libsanitizer] AddressSanitizer: fix for SPARC with GCC
Related show

Commit Message

Eric Botcazou March 13, 2019, 9:21 a.m.
This patch contains a fixlet for the AddressSanitizer on the SPARC with GCC, 
which would otherwise generate a problematic call to the intercepted memcpy 
routine.  It only affects the SPARC ports and has been tested on SPARC/Solaris 
and SPARC64/Linux.

It merges r355979 of the LLVM repository.  Installed on the mainline.


2019-03-13  Eric Botcazou  <ebotcazou@adacore.com>

	PR sanitizer/80953
	Merge from LLVM revision 355979
	* asan/asan_globals.c (GetGlobalsForAddress): Use internal_memcpy to
	copy Global objects for SPARC with GCC.

-- 
Eric Botcazou

Patch

Index: asan/asan_globals.cc
===================================================================
--- asan/asan_globals.cc	(revision 269546)
+++ asan/asan_globals.cc	(working copy)
@@ -112,7 +112,11 @@  int GetGlobalsForAddress(uptr addr, Glob
     if (flags()->report_globals >= 2)
       ReportGlobal(g, "Search");
     if (IsAddressNearGlobal(addr, g)) {
+#if defined(__GNUC__) && defined(__sparc__)
+      internal_memcpy(&globals[res], &g, sizeof(g));
+#else
       globals[res] = g;
+#endif
       if (reg_sites)
         reg_sites[res] = FindRegistrationSite(&g);
       res++;