summaryrefslogtreecommitdiffstats
path: root/base/process_util_linux.cc
diff options
context:
space:
mode:
authortimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-11 14:59:36 +0000
committertimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-11 14:59:36 +0000
commit4633282c8a0f54e066aed904bfeb590d9c8a58db (patch)
treefab035d2a7dc543986dacd65d844774c1d7a8a42 /base/process_util_linux.cc
parentefe2c84fd0227e35c80420f348a4817620cf071c (diff)
downloadchromium_src-4633282c8a0f54e066aed904bfeb590d9c8a58db.zip
chromium_src-4633282c8a0f54e066aed904bfeb590d9c8a58db.tar.gz
chromium_src-4633282c8a0f54e066aed904bfeb590d9c8a58db.tar.bz2
Do not redefine malloc&co when ADDRESS_SANITIZER macro is defined.
ADDRESS_SANITIZER macro is defined when building the code using https://sites.google.com/a/chromium.org/dev/developers/testing/addresssanitizer This is a copy http://codereview.chromium.org/7004020/ the original patch was prepared by Konstantin Serebryany (kcc@) TBR=willchan Review URL: http://codereview.chromium.org/6995052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_linux.cc')
-rw-r--r--base/process_util_linux.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index fea4347..f80cfc0 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -611,7 +611,7 @@ void OnNoMemory() {
} // namespace
extern "C" {
-#if !defined(USE_TCMALLOC)
+#if !defined(USE_TCMALLOC) && !defined(ADDRESS_SANITIZER)
extern "C" {
void* __libc_malloc(size_t size);
@@ -638,6 +638,9 @@ void* __libc_memalign(size_t alignment, size_t size);
// If we are using tcmalloc, then the problem is moot since tcmalloc handles
// this for us. Thus this code is in a !defined(USE_TCMALLOC) block.
//
+// If we are testing the binary with AddressSanitizer, we should not
+// redefine malloc and let AddressSanitizer do it instead.
+//
// We call the real libc functions in this code by using __libc_malloc etc.
// Previously we tried using dlsym(RTLD_NEXT, ...) but that failed depending on
// the link order. Since ld.so needs calloc during symbol resolution, it