[rs6000] Fix address sanitizer for powerpc64.

Message ID 8dcd9de1-dfee-fed3-ce56-0fa02e449855@linux.vnet.ibm.com
State New
Headers show
Series
  • [rs6000] Fix address sanitizer for powerpc64.
Related show

Commit Message

Bill Seurer April 17, 2018, 10:15 p.m.
[PATCH, rs6000] Fix address sanitizer for powerpc64.

This patch fixes problems that asan has on powerpc64 running on some old
kernels and also very new kernels.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85394 and
https://github.com/google/sanitizers/issues/933 for more information.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu and
powerpc64be-unknown-linux-gnu with no regressions.  Is this ok for trunk?


2018-04-17  Bill Seurer  <seurer@linux.vnet.ibm.com>

	PR sanitizer/85389
	* asan/asan_allocator.h: Switch to use dynamic base for the allocator
	region.


-- 

-Bill Seurer

Comments

Jakub Jelinek April 17, 2018, 10:20 p.m. | #1
On Tue, Apr 17, 2018 at 05:15:06PM -0500, Bill Seurer wrote:
> [PATCH, rs6000] Fix address sanitizer for powerpc64.

> 

> This patch fixes problems that asan has on powerpc64 running on some old

> kernels and also very new kernels.

> 

> See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85394 and

> https://github.com/google/sanitizers/issues/933 for more information.

> 

> Bootstrapped and tested on powerpc64le-unknown-linux-gnu and

> powerpc64be-unknown-linux-gnu with no regressions.  Is this ok for trunk?

> 

> 

> 2018-04-17  Bill Seurer  <seurer@linux.vnet.ibm.com>

> 

> 	PR sanitizer/85389

> 	* asan/asan_allocator.h: Switch to use dynamic base for the allocator

> 	region.


I'd write
	* asan/asan_allocator.h (kAllocatorSpace): For __powerpc64__ change
	from 0xa0000000000ULL to ~(uptr)0.

Ok with that change and thanks for all the testing.

> Index: libsanitizer/asan/asan_allocator.h

> ===================================================================

> --- libsanitizer/asan/asan_allocator.h	(revision 259447)

> +++ libsanitizer/asan/asan_allocator.h	(working copy)

> @@ -122,7 +122,7 @@ const uptr kAllocatorSpace = ~(uptr)0;

>  const uptr kAllocatorSize  =  0x40000000000ULL;  // 4T.

>  typedef DefaultSizeClassMap SizeClassMap;

>  # elif defined(__powerpc64__)

> -const uptr kAllocatorSpace =  0xa0000000000ULL;

> +const uptr kAllocatorSpace = ~(uptr)0;

>  const uptr kAllocatorSize  =  0x20000000000ULL;  // 2T.

>  typedef DefaultSizeClassMap SizeClassMap;

>  # elif defined(__aarch64__) && SANITIZER_ANDROID

> 


	Jakub
Segher Boessenkool April 17, 2018, 10:45 p.m. | #2
Hi!

On Wed, Apr 18, 2018 at 12:20:50AM +0200, Jakub Jelinek wrote:
> On Tue, Apr 17, 2018 at 05:15:06PM -0500, Bill Seurer wrote:

> > This patch fixes problems that asan has on powerpc64 running on some old

> > kernels and also very new kernels.

> > 

> > See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85394 and

> > https://github.com/google/sanitizers/issues/933 for more information.

> > 

> > Bootstrapped and tested on powerpc64le-unknown-linux-gnu and

> > powerpc64be-unknown-linux-gnu with no regressions.  Is this ok for trunk?

> > 

> > 

> > 2018-04-17  Bill Seurer  <seurer@linux.vnet.ibm.com>

> > 

> > 	PR sanitizer/85389

> > 	* asan/asan_allocator.h: Switch to use dynamic base for the allocator

> > 	region.

> 

> I'd write

> 	* asan/asan_allocator.h (kAllocatorSpace): For __powerpc64__ change

> 	from 0xa0000000000ULL to ~(uptr)0.

> 

> Ok with that change and thanks for all the testing.


Same here: thanks!


Segher

Patch

Index: libsanitizer/asan/asan_allocator.h
===================================================================
--- libsanitizer/asan/asan_allocator.h	(revision 259447)
+++ libsanitizer/asan/asan_allocator.h	(working copy)
@@ -122,7 +122,7 @@  const uptr kAllocatorSpace = ~(uptr)0;
 const uptr kAllocatorSize  =  0x40000000000ULL;  // 4T.
 typedef DefaultSizeClassMap SizeClassMap;
 # elif defined(__powerpc64__)
-const uptr kAllocatorSpace =  0xa0000000000ULL;
+const uptr kAllocatorSpace = ~(uptr)0;
 const uptr kAllocatorSize  =  0x20000000000ULL;  // 2T.
 typedef DefaultSizeClassMap SizeClassMap;
 # elif defined(__aarch64__) && SANITIZER_ANDROID