Commit Graph

133 Commits

Author SHA1 Message Date
Max Ostapenko
9211bbb278 Move ptrace.h to appropriate place.
libsanitizer/

	* include/system/linux/asm/ptrace.h: Move to ...
	* include/system/asm/ptrace.h: ... this.

From-SVN: r230804
2015-11-24 14:24:46 +02:00
Max Ostapenko
664dd3cfbd Fix libsanitizer build with old kernel headers on ARM after r230739.
libsanitizer/

	* include/system/linux/asm/ptrace.h: New header.

From-SVN: r230790
2015-11-24 10:44:39 +02:00
Max Ostapenko
55aea9f56c libsanitizer merge from upstream r253555.
libsanitizer/

2015-11-23  Maxim Ostapenko  <m.ostapenko@partner.samsung.com>

	* All source files: Merge from upstream r253555.
	* configure.tgt: Enable LSan on aarch64-*-linux* targets. Add new
	dependences for TSan for aarch64-*-linux* targets.
	* tsan/Makefile.am: Add new source files.
	* configure: Regenerate.
	* tsan/Makefile.in: Likewise.

From-SVN: r230739
2015-11-23 11:07:18 +02:00
Alan Modra
62c0f0a637 Update libsanitizer obstack interceptors
New obstack uses sensible types, size_t instead of int for length
params.  Since libsanitizer does not use prototypes from obstack.h to
call the real functions, it's necessary to update the libsanitizer
function declarations emitted by the INTERCEPTOR macro.

	* sanitizer_common/sanitizer_common_interceptors.inc: Update size
	params for _obstack_begin_1, _obstack_begin, _obstack_newchunk
	interceptors.
	* configure.ac: Substitute OBSTACK_DEFS.
	* asan/Makefile.am: Add OBSTACK_DEFS to DEFS.
	* tsan/Makefile.am: Likewise.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* asan/Makefile.in: Regenerate.
	* interception/Makefile.in: Regenerate.
	* libbacktrace/Makefile.in: Regenerate.
	* lsan/Makefile.in: Regenerate.
	* sanitizer_common/Makefile.in: Regenerate.
	* tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.in: Regenerate.

From-SVN: r229986
2015-11-09 14:53:25 +10:30
Maxim Ostapenko
02f4d3e9da Update HOWTO_MERGE file for libsanitizer.
From-SVN: r229215
2015-10-23 11:50:30 +03:00
Max Ostapenko
692b1131a7 Fix bootstrap on x86_64-apple-darwin14 after r229119.
libsanitizer/

	PR bootstrap/68041
	* configure.ac (link_sanitizer_common): Link against librt only if it
	contains shm_open, required by sanitizers.
	(CXX_ABI_NEEDED): Remove variable.
	* configure: Regenerate.
	* ubsan/Makefile.am (libubsan_la_LIBADD): Do not add -lc++abi anymore.
	* ubsan/Makefile.in: Regenerate.

From-SVN: r229168
2015-10-22 12:47:17 +03:00
Max Ostapenko
7047bc9c16 HOWTO_MERGE: New file.
libsanitizer/

	* HOWTO_MERGE: New file.

From-SVN: r229116
2015-10-21 10:53:22 +03:00
Max Ostapenko
21d6106320 sanitizer_stacktrace.cc (GetCanonicFrame): Assume we compiled code with GCC when extracting the caller PC for ARM if...
libsanitizer/

	* sanitizer_common/sanitizer_stacktrace.cc (GetCanonicFrame): Assume we
	compiled code with GCC when extracting the caller PC for ARM if no
	valid frame pointer is available.

From-SVN: r229115
2015-10-21 10:51:03 +03:00
Max Ostapenko
15ebe1fe46 re PR bootstrap/63888 (bootstrap failed when configured with -with-build-config=bootstrap-asan --disable-werror)
libsanitizer/

	PR bootstrap/63888
	Reapply:
	2015-02-20  Jakub Jelinek  <jakub@redhat.com>

	* asan/asan_globals.cc (RegisterGlobal): Disable detect_odr_violation
	support until it is rewritten upstream.

	* c-c++-common/asan/pr63888.c: New test.

From-SVN: r229114
2015-10-21 10:47:54 +03:00
Max Ostapenko
0d57d3e06b re PR sanitizer/63958 (bootstrap failure in the sanitizer libs on sparc-linux-gnu)
libsanitizer/

	PR sanitizer/63958
	Reapply:
	2014-10-14  David S. Miller  <davem@davemloft.net>

	* sanitizer_common/sanitizer_platform_limits_linux.cc (time_t):
	Define at __kernel_time_t, as needed for sparc.
	(struct __old_kernel_stat): Don't check if __sparc__ is defined.
	* libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
	(__sanitizer): Define struct___old_kernel_stat_sz,
	struct_kernel_stat_sz, and struct_kernel_stat64_sz for sparc.
	(__sanitizer_ipc_perm): Adjust for sparc targets.
	(__sanitizer_shmid_ds): Likewsie.
	(__sanitizer_sigaction): Likewise.
	(IOC_SIZE): Likewsie.

From-SVN: r229113
2015-10-21 10:44:35 +03:00
Max Ostapenko
696d846a56 libsanitizer merge from upstream r250806.
libsanitizer/

2015-10-20  Maxim Ostapenko  <m.ostapenko@partner.samsung.com>

	* All source files: Merge from upstream r250806.
	* configure.ac (link_sanitizer_common): Add -lrt flag.
	* configure.tgt: Enable TSAN and LSAN for aarch64-linux targets.
	Set CXX_ABI_NEEDED=true for darwin.
	* asan/Makefile.am (asan_files): Add new files.
	(DEFS): Add DCAN_SANITIZE_UB=0 and remove unused and legacy
	DASAN_FLEXIBLE_MAPPING_AND_OFFSET=0.
	* asan/Makefile.in: Regenerate.
	* ubsan/Makefile.am (ubsan_files): Add new files.
	(DEFS): Add DCAN_SANITIZE_UB=1.
	(libubsan_la_LIBADD): Add -lc++abi if CXX_ABI_NEEDED is true.
	* ubsan/Makefile.in: Regenerate.
	* tsan/Makefile.am (tsan_files): Add new files.
	(DEFS): Add DCAN_SANITIZE_UB=0.
	* tsan/Makefile.in: Regenerate.
	* sanitizer_common/Makefile.am (sanitizer_common_files): Add new files.
	* sanitizer_common/Makefile.in: Regenerate.
	* asan/libtool-version: Bump the libasan SONAME.

From-SVN: r229111
2015-10-21 10:32:45 +03:00
Markus Trippelsdorf
1842a04ce0 Fix sanitizer/67258 by cherry picking upstream patch
PR sanitizer/67258
	* ubsan/ubsan_type_hash.cc: Cherry pick upstream r244101.

Upstraem patch:
commit 1d2477faafda9ad2cc19927b3c31efd22747f013
Author: Alexey Samsonov <vonosmas@gmail.com>
Date:   Wed Aug 5 19:35:46 2015 +0000

    [UBSan] Fix UBSan-vptr false positive.

    Offset from vptr to the start of most-derived object can actually
    be positive in some virtual base class vtables.

    Patch by Stephan Bergmann!

    git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@244101 91177308-0d34-0410-b5e6-96231b3b80d8

From-SVN: r227591
2015-09-09 16:34:59 +00:00
Markus Trippelsdorf
97d8f80175 Use fast unwinder for PowerPC
2015-07-29  Markus Trippelsdorf  <markus@trippelsdorf.de>

	PR sanitizer/63927
	* sanitizer_common/sanitizer_stacktrace.h: Use fast unwinder
	for PowerPC.

From-SVN: r226338
2015-07-29 06:32:09 +00:00
Bill Schmidt
3d61d87585 re PR sanitizer/63927 (AddressSanitizer painfully slow on ppc64)
2015-07-28  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR sanitizer/63927
	* sanitizer_common/sanitizer_stacktrace.cc
	(BufferedStackTrace::FastUnwindStack): Fix code for PowerPC to
	find the link register at an offset of 16 from the base of the
	caller's stack frame.

From-SVN: r226335
2015-07-29 03:33:10 +00:00
Michael Haubenwallner
f3915b4249 libsanitizer: Bump to automake 1.11.6
2015-05-13  Michael Haubenwallner  <michael.haubenwallner@ssi-schaefer.com>

	* Makefile.in: Regenerated with automake-1.11.6.
	* aclocal.m4: Likewise.
	* asan/Makefile.in: Likewise.
	* configure: Likewise.
	* interception/Makefile.in: Likewise.
	* libbacktrace/Makefile.in: Likewise.
	* lsan/Makefile.in: Likewise.
	* sanitizer_common/Makefile.in: Likewise.
	* tsan/Makefile.in: Likewise.
	* ubsan/Makefile.in: Likewise.

From-SVN: r223140
2015-05-13 11:11:58 +00:00
Yury Gribov
d041a6fcae re PR sanitizer/64839 (libsanitizer shouldn't require <rpc/xdr.h>)
2015-04-13  Yury Gribov  <y.gribov@samsung.com>

	PR sanitizer/64839

	libsanitizer/
	* sanitizer_common/sanitizer_platform.h: Cherry pick
	upstream r234470.
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Ditto.
	* configure.ac (RPC_DEFS): Check for precense of RPC headers.
	* sanitizer_common/Makefile.am (DEFS): Pass info to compiler.
	* Makefile.in: Regenerate.
	* asan/Makefile.in: Regenerate.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* interception/Makefile.in: Regenerate.
	* libbacktrace/Makefile.in: Regenerate.
	* lsan/Makefile.in: Regenerate.
	* sanitizer_common/Makefile.in: Regenerate.
	* tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.in: Regenerate.

From-SVN: r222043
2015-04-13 08:59:55 +00:00
Christophe Lyon
d886f7cc33 re PR sanitizer/59009 (libsanitizer merge from upstream r191666 breaks bootstrap on powerpc64-linux and aarch64-linux)
2015-03-23  Christophe Lyon  <christophe.lyon@linaro.org>

	PR sanitizer/59009
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Cherry pick
	upstream r230324.
	* sanitizer_common/sanitizer_platform.h: Likewise.
	* sanitizer_common/sanitizer_common_syscalls.inc: Likewise.

From-SVN: r221593
2015-03-23 14:43:22 +01:00
Bernd Edlinger
563fb64a57 tsan_rtl_report.cc (ScopedReport::AddThread): Cherry pick upstream 224508 and 224755.
2015-03-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * tsan/tsan_rtl_report.cc (ScopedReport::AddThread): Cherry pick
        upstream 224508 and 224755.

From-SVN: r221356
2015-03-11 19:20:03 +00:00
Jakub Jelinek
ee876e5915 re PR sanitizer/63958 (bootstrap failure in the sanitizer libs on sparc-linux-gnu)
PR sanitizer/63958
	Reapply:
	2014-10-14  David S. Miller  <davem@davemloft.net>

	* sanitizer_common/sanitizer_platform_limits_linux.cc (time_t):
	Define at __kernel_time_t, as needed for sparc.
	(struct __old_kernel_stat): Don't check if __sparc__ is defined.
	* libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
	(__sanitizer): Define struct___old_kernel_stat_sz,
	struct_kernel_stat_sz, and struct_kernel_stat64_sz for sparc.
	(__sanitizer_ipc_perm): Adjust for sparc targets.
	(__sanitizer_shmid_ds): Likewsie.
	(__sanitizer_sigaction): Likewise.
	(IOC_SIZE): Likewsie.

From-SVN: r221283
2015-03-09 19:25:28 +01:00
Peter Bergner
6ad0611bec * configure.tgt: Enable build on powerpc*le-*-linux.
From-SVN: r221060
2015-02-27 07:46:30 -06:00
Jakub Jelinek
09901e8a73 re PR tree-optimization/65170 (curve25519-donna-c64 miscompilation)
PR tree-optimization/65170
	* wide-int.cc (wi::mul_internal): For the umul_ppmm optimization,
	if val[1] < 0, clear also val[2] and return 3.

	* gcc.c-torture/execute/pr65170.c: New test.
	* gcc.dg/tree-ssa/vrp96.c: New test.

From-SVN: r220931
2015-02-24 09:07:10 +01:00
Jakub Jelinek
86ee20386e re PR bootstrap/63888 (bootstrap failed when configured with -with-build-config=bootstrap-asan --disable-werror)
PR bootstrap/63888
	* asan/asan_globals.cc (RegisterGlobal): Disable detect_odr_violation
	support until it is rewritten upstream.

	* c-c++-common/asan/pr63888.c: New test.

From-SVN: r220919
2015-02-23 22:01:57 +01:00
Matthias Klose
94213c1020 configure.ac: Move AM_ENABLE_MULTILIB before AC_PROG_CC.
2015-01-26  Matthias Klose  <doko@ubuntu.com>

        * configure.ac: Move AM_ENABLE_MULTILIB before AC_PROG_CC.
        * configure: Regenerate.

From-SVN: r220165
2015-01-27 12:50:46 +00:00
Venkataramanan Kumar
8790f572ea Include TSAN dependent sources for 64 bit i?86 target.
2015-01-25  Venkataramanan Kumar  <venkataramanan.kumar@linaro.org>

        * configure.ac (TSAN_TARGET_DEPENDENT_OBJECTS): Undefine.
        * configure: Regenerate.
        * configure.tgt (TSAN_TARGET_DEPENDENT_OBJECTS): Define.

From-SVN: r220083
2015-01-24 15:21:51 +00:00
Venkataramanan Kumar
b0edd457a1 Conditionally include target specific files while building TSAN 2015-01-25...
Conditionally include target specific files while building TSAN
2015-01-25  Venkataramanan Kumar  <venkataramanan.kumar@linaro.org>

        * configure.ac (TSAN_TARGET_DEPENDENT_OBJECTS): Define.
        * configure: Regenerate.
        * tsan/Makefile.am (EXTRA_libtsan_la_SOURCES): Define.
        (libtsan_la_DEPENDENCIES): Likewise.
        * Makefile.in: Regenerate.
        * asan/Makefile.in: Regenerate.
        * interception/Makefile.in: Regenerate.
        * libbacktrace/Makefile.in: Regenerate.
        * lsan/Makefile.in: Regenerate.
        * sanitizer_common/Makefile.in: Regenerate.
        * tsan/Makefile.in: Regenerate.
        * ubsan/Makefile.in: Regenerate.

From-SVN: r220034
2015-01-23 11:53:04 +00:00
Jakub Jelinek
19ac475f49 * tsan/tsan_rtl.h: Cherry pick upstream r226829.
From-SVN: r220013
2015-01-22 21:44:25 +01:00
Jakub Jelinek
8b08ef255b re PR sanitizer/64435 (Bootstrap failure in libsanitizer on AArch64 with Linux kernel <= 3.15)
PR sanitizer/64435
	* sanitizer_common/sanitizer_platform_limits_posix.h: Cherry pick
	upstream r226637.
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.
	* sanitizer_common/sanitizer_posix.cc: Cherry pick upstream r226639.

From-SVN: r219968
2015-01-21 22:21:27 +01:00
Jakub Jelinek
3ea3641880 re PR sanitizer/64632 (runtime error: member call on address 0x0000004318a8 which does not point to an object of type 'ios_base')
PR sanitizer/64632
	* ubsan/ubsan_type_hash.cc: Cherry pick upstream r224972.

	* g++.dg/ubsan/pr64632.C: New test.

From-SVN: r219912
2015-01-20 21:39:52 +01:00
Jakub Jelinek
9deaf59d1b re PR sanitizer/64435 (Bootstrap failure in libsanitizer on AArch64 with Linux kernel <= 3.15)
PR sanitizer/64435
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Cherry pick
	upstream r223925.

From-SVN: r219833
2015-01-19 09:39:27 +01:00
Jakub Jelinek
b6a8baccac sanitizer_deadlock_detector.h: Cherry pick upstream r224518 and r224519.
* sanitizer_common/sanitizer_deadlock_detector.h: Cherry pick
	upstream r224518 and r224519.
	* tsan/tsan_rtl_thread.cc: Cherry pick upstream r224702 and
	r224834.

From-SVN: r219545
2015-01-13 18:01:30 +01:00
Jakub Jelinek
f2798565b4 sanitizer_symbolizer_libbacktrace.cc, [...]: Cherry pick upstream r224308.
* sanitizer_common/sanitizer_symbolizer_libbacktrace.cc,
	sanitizer_common/sanitizer_symbolizer_libbacktrace.h,
	sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc: Cherry pick
	upstream r224308.

From-SVN: r218778
2014-12-16 12:35:34 +01:00
H.J. Lu
a699d67255 Always use PIC option with -shared in libtool
Libtool needs to pass PIC option -shared when creating shared object to
link regular object files with slim-lto archive.

	PR bootstrap/63784
	* libtool.m4: Add $pic_flag with -shared.

boehm-gc/

	PR bootstrap/63784
	* configure: Regenerated.

gcc/

	PR bootstrap/63784
	* configure: Regenerated.

libatomic/

	PR bootstrap/63784
	* configure: Regenerated.

libbacktrace/

	PR bootstrap/63784
	* configure: Regenerated.

libcc1/

	PR bootstrap/63784
	* configure: Regenerated.

libcilkrts/

	PR bootstrap/63784
	* configure: Regenerated.

libffi/

	PR bootstrap/63784
	* configure: Regenerated.

libgfortran/

	PR bootstrap/63784
	* configure: Regenerated.

libgomp/

	PR bootstrap/63784
	* configure: Regenerated.

libitm/

	PR bootstrap/63784
	* configure: Regenerated.

libjava/

	PR bootstrap/63784
	* configure: Regenerated.

libjava/classpath/

	PR bootstrap/63784
	* configure: Regenerated.

libobjc/

	PR bootstrap/63784
	* configure: Regenerated.

libquadmath/

	PR bootstrap/63784
	* configure: Regenerated.

libsanitizer/

	PR bootstrap/63784
	* configure: Regenerated.

libssp/

	PR bootstrap/63784
	* configure: Regenerated.

libstdc++-v3/

	PR bootstrap/63784
	* configure: Regenerated.

libvtv/

	PR bootstrap/63784
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/63784
	* configure: Regenerated.

From-SVN: r217937
2014-11-21 08:49:17 -08:00
Jakub Jelinek
7697b16f45 re PR sanitizer/64013 (libsanitizer fails to build)
PR sanitizer/64013
	* sanitizer_common/sanitizer_linux.cc (FileExists): Cherry pick
	upstream r222532.

From-SVN: r217921
2014-11-21 15:03:37 +01:00
Uros Bizjak
7f201a67fb Makefile.am (AM_CXXFLAGS): Use -std=gnu++11.
* sanitizer_common/Makefile.am (AM_CXXFLAGS): Use -std=gnu++11.
	* asan/Makefile.am (AM_CXXFLAGS): Ditto.
	* lsan/Makefile.am (AM_CXXFLAGS): Ditto.
	* interception/Makefile.am (AM_CXXFLAGS): Ditto.
	* tsan/Makefile.am (AM_CXXFLAGS): Ditto.
	* libbacktrace/Makefile.am (AM_CXXFLAGS): Ditto.
	* ubsan/Makefile.am (AM_CXXFLAGS): Ditto.
	* sanitizer_common/Makefile.in: Regenerate.
	* asan/Makefile.in: Ditto.
	* lsan/Makefile.in: Ditto.
	* interception/Makefile.in: Ditto.
	* tsan/Makefile.in: Ditto.
	* libbacktrace/Makefile.in: Ditto.
	* ubsan/Makefile.in: Ditto.

From-SVN: r217562
2014-11-14 15:23:51 +01:00
Kostya Serebryany
c5be964a42 libsanitizer merge from upstream r221802
From-SVN: r217518
2014-11-13 20:41:38 +00:00
Francois-Xavier Coudert
ebf6d33b73 re PR target/63610 (Fixing the libtool bug for Yosemite (darwin14))
toplevel:
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* libtool.m4: Fix globbing of darwin versions.

boehm-gc/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

gcc/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libatomic/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libbacktrace/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libcc1/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libcilkrts/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libffi/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libgfortran/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libgomp/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libitm/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libobjc/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libquadmath/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libsanitizer/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libssp/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libstdc++-v3/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libvtv/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

lto-plugin/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libjava/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

libjava/classpath/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

zlib/
2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR target/63610
	* configure: Regenerate.

From-SVN: r217366
2014-11-11 20:25:18 +00:00
Martin Liska
d13fc1ed98 IPA ICF fallout: fox for libasan and pr43077-1.c
* gcc.dg/guality/pr43077-1.c: IPA ICF disabled
	to match defined expectations.

	* asan/Makefile.am: IPA ICF pass is disabled.
	* asan/Makefile.in: Likewise.

From-SVN: r216339
2014-10-16 16:56:21 +00:00
David S. Miller
c84733360b Fix sanitizer build on sparc.
* sanitizer_common/sanitizer_platform_limits_linux.cc (time_t):
	Define at __kernel_time_t, as needed for sparc.
	(struct __old_kernel_stat): Don't check if __sparc__ is defined.
	* libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
	(__sanitizer): Define struct___old_kernel_stat_sz,
	struct_kernel_stat_sz, and struct_kernel_stat64_sz for sparc.
	(__sanitizer_ipc_perm): Adjust for sparc targets.
	(__sanitizer_shmid_ds): Likewsie.
	(__sanitizer_sigaction): Likewsie.
	(IOC_SIZE): Likewsie.

From-SVN: r216224
2014-10-14 14:20:46 -07:00
Jakub Jelinek
694b4cfa08 Makefile.am (DEFS): Add -DPIC.
* ubsan/Makefile.am (DEFS): Add -DPIC.
	* ubsan/Makefile.in: Regenerated.

From-SVN: r216206
2014-10-14 17:56:52 +02:00
Christophe Lyon
a3125fc233 [AArch64] Enable Address Sanitizer.
2014-09-26  Christophe Lyon  <christophe.lyon@linaro.org>

	[AArch64] Enable Address Sanitizer.

	gcc/
	* config/aarch64/aarch64-linux.h (ASAN_CC1_SPEC): Define.
        (CC1_SPEC): Define.
        * config/aarch64/aarch64.c (aarch64_asan_shadow_offset): New function.
        (TARGET_ASAN_SHADOW_OFFSET): Define.

	libsanitzer/
	* configure.tgt: Enable build on aarch64*-linux.

From-SVN: r215642
2014-09-26 15:07:42 +02:00
Kostya Serebryany
866e32ad33 [libsanitizer merge from upstream r218156]
From-SVN: r215527
2014-09-23 17:59:53 +00:00
Jakub Jelinek
126edc3fe2 flag-types.h (enum sanitize_code): Add SANITIZE_NONNULL_ATTRIBUTE and SANITIZE_RETURNS_NONNULL_ATTRIBUTE...
gcc/
	* flag-types.h (enum sanitize_code): Add SANITIZE_NONNULL_ATTRIBUTE
	and SANITIZE_RETURNS_NONNULL_ATTRIBUTE, or them into SANITIZE_UNDEFINED.
	* opts.c (common_handle_option): Handle SANITIZE_NONNULL_ATTRIBUTE and
	SANITIZE_RETURNS_NONNULL_ATTRIBUTE and disable
	flag_delete_null_pointer_checks for them.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_NONNULL_ARG,
	BUILT_IN_UBSAN_HANDLE_NONNULL_ARG_ABORT,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): New.
	* ubsan.c (instrument_bool_enum_load): Set *gsi back to
	stmt's iterator.
	(instrument_nonnull_arg, instrument_nonnull_return): New functions.
	(pass_ubsan::gate): Return true even for SANITIZE_NONNULL_ATTRIBUTE
	or SANITIZE_RETURNS_NONNULL_ATTRIBUTE.
	(pass_ubsan::execute): Call instrument_nonnull_{arg,return}.
	* doc/invoke.texi (-fsanitize=nonnull-attribute,
	-fsanitize=returns-nonnull-attribute): Document.
gcc/testsuite/
	* c-c++-common/ubsan/attrib-3.c: New test.
	* c-c++-common/ubsan/nonnull-1.c: New test.
	* c-c++-common/ubsan/nonnull-2.c: New test.
	* c-c++-common/ubsan/nonnull-3.c: New test.
	* c-c++-common/ubsan/nonnull-4.c: New test.
	* c-c++-common/ubsan/nonnull-5.c: New test.
libsanitizer/
	* ubsan/ubsan_handlers.cc, ubsan/ubsan_handlers.h: Cherry pick
	upstream r215485, r217389, r217391 and r217400.

From-SVN: r215118
2014-09-10 11:23:16 +02:00
Paolo Carlini
0d807c8050 sanitizer_common_interceptors.inc: Cherry pick upstream r211008.
2014-06-23  Paolo Carlini  <paolo.carlini@oracle.com>

	* sanitizer_common/sanitizer_common_interceptors.inc:
	Cherry pick upstream r211008.

From-SVN: r211912
2014-06-23 19:03:07 +00:00
Richard Biener
4622301b0d asan_linux.cc: Cherry pick upstream r210012.
2014-06-11  Richard Biener  <rguenther@suse.de>

	* asan/asan_linux.cc: Cherry pick upstream r210012.

From-SVN: r211453
2014-06-11 11:35:48 +00:00
Jakub Jelinek
ecd5543ffa sanitizer_stacktrace.cc: Cherry pick upstream r209879.
* sanitizer_common/sanitizer_stacktrace.cc: Cherry pick upstream
	r209879.
	* sanitizer_common/sanitizer_common.h: Likewise.
	* asan/asan_mapping.h: Likewise.
	* asan/asan_linux.cc: Likewise.
	* tsan/tsan_mman.cc: Cherry pick upstream r209744.
	* sanitizer_common/sanitizer_allocator.h: Likewise.

From-SVN: r211080
2014-05-30 15:48:22 +02:00
Marek Polacek
85a16bf8b5 builtins.def: Change SANITIZE_FLOAT_DIVIDE to SANITIZE_NONDEFAULT.
* builtins.def: Change SANITIZE_FLOAT_DIVIDE to SANITIZE_NONDEFAULT.
	* gcc.c (sanitize_spec_function): Likewise.
	* convert.c (convert_to_integer): Include "ubsan.h".  Add
	floating-point to integer instrumentation.
	* doc/invoke.texi: Document -fsanitize=float-cast-overflow.
	* flag-types.h (enum sanitize_code): Add SANITIZE_FLOAT_CAST and
	SANITIZE_NONDEFAULT.
	* opts.c (common_handle_option): Handle -fsanitize=float-cast-overflow.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_FLOAT_CAST_OVERFLOW,
	BUILT_IN_UBSAN_HANDLE_FLOAT_CAST_OVERFLOW_ABORT): Add.
	* ubsan.c: Include "realmpfr.h" and "dfp.h".
	(get_ubsan_type_info_for_type): Handle REAL_TYPEs.
	(ubsan_type_descriptor): Set tkind to 0xffff for types other than
	float/double/long double.
	(ubsan_instrument_float_cast): New function.
	* ubsan.h (ubsan_instrument_float_cast): Declare.
testsuite/
	* c-c++-common/ubsan/float-cast-overflow-1.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-10.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-2.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-3.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-4.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-5.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-6.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-7.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-7.h: New file.
	* c-c++-common/ubsan/float-cast-overflow-8.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-9.c: New test.
	* c-c++-common/ubsan/float-cast.h: New file.
	* g++.dg/ubsan/float-cast-overflow-bf.C: New test.
	* gcc.dg/ubsan/float-cast-overflow-bf.c: New test.
libsanitizer/
	* ubsan/ubsan_value.cc (getFloatValue): Handle 96-bit
	floating-point types.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r210862
2014-05-23 14:44:42 +00:00
Kostya Serebryany
dee5ea7a0b libsanitizer merge from upstream r209283
From-SVN: r210743
2014-05-22 07:09:21 +00:00
Yury Gribov
2675305b4f re PR sanitizer/61100 (asan/tsan should have the sanitizer includes)
2014-05-14  Yury Gribov  <y.gribov@samsung.com>

	PR sanitizer/61100
	* Makefile.am (nodist_saninclude_HEADERS): Install
	public headers.
	* Makefile.in: Regenerate.

	* c-c++-common/asan/asan-interface-1.c: New test.
	* lib/asan-dg.exp (asan_include_flags): New function.
	(asan_init): Call asan_include_flags to obtain path
	to sanitizer headers.

From-SVN: r210413
2014-05-14 08:33:45 +00:00
Rainer Orth
a6c9ab4e19 Handle backtrace_qsort
* libbacktrace/Makefile.am (libsanitizer_libbacktrace_la_SOURCES):
	Add ../../libbacktrace/sort.c.
	* libbacktrace/Makefile.in: Regenerate.
	* libbacktrace/backtrace-rename.h (backtrace_qsort): Define.

From-SVN: r208401
2014-03-07 13:55:54 +00:00
Bill Schmidt
a42a7046eb configure.tgt: Unsupported for little endian PowerPC for now.
2014-03-03  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* configure.tgt: Unsupported for little endian PowerPC for now.

From-SVN: r208290
2014-03-03 20:36:56 +00:00