Commit Graph

122 Commits

Author SHA1 Message Date
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
Jakub Jelinek
81c87471e9 re PR sanitizer/60055 (Invalid binding of __tsan_default_options)
PR sanitizer/60055
	* tsan/tsan_flags.cc (__tsan_default_options): Add
	SANITIZER_INTERFACE_ATTRIBUTE.  Backport from upstream r200747.
	* tsan/tsan_rtl.cc (__tsan::OnFinalize): Likewise.

From-SVN: r207459
2014-02-04 11:46:22 +01:00
Jakub Jelinek
5ab39ec3b0 re PR sanitizer/60038 (AddressSanitizer CHECK failed ... "((*tls_addr + *tls_size)) <= ((*stk_addr + *stk_size))" on CentOS 5.10)
PR sanitizer/60038
	* sanitizer_common/sanitizer_linux_libcdep.cc: Include
	sanitizer_atomic.h and unistd.h.
	(kThreadDescriptorSize): Made static, remove initializer and const,
	change type to atomic_uintptr_t.
	(ThreadDescriptorSize): Use confstr(_CS_GNU_LIBC_VERSION, ...) to
	query glibc version, compute kThreadDescriptorSize depending on
	glibc version minor number.
	(GetThreadStackAndTls): Use ThreadDescriptorSize() instead of
	kThreadDescriptorSize directly.

From-SVN: r207452
2014-02-04 08:37:44 +01:00
Yury Gribov
4a7eaf5f94 re PR sanitizer/57316 (build failure in libsanitizer)
2014-01-23  Yury Gribov  <y.gribov@samsung.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/57316
	* configure.ac: Check for missing syscalls.
	* Makefile.am: Likewise.
	* configure: Regenerate.
	* Makefile.in: Regenerate.

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

From-SVN: r206966
2014-01-23 14:32:05 +00:00
Jakub Jelinek
b5f58ba331 * sanitizer_common/sanitizer_symbolizer_libbacktrace.h
(LibbacktraceSymbolizer::Demangle): New declaration.
	* sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
	(POSIXSymbolizer::Demangle): Use libbacktrace_symbolizer_'s Demangle
	method if possible.
	* sanitizer_common/sanitizer_symbolizer_libbacktrace.cc: Include
	"demangle.h" if SANITIZE_CP_DEMANGLE is defined.
	(struct CplusV3DemangleData): New type.
	(CplusV3DemangleCallback, CplusV3Demangle): New functions.
	(SymbolizeCodePCInfoCallback, SymbolizeCodeCallback,
	SymbolizeDataCallback): Use CplusV3Demangle.
	* sanitizer_common/Makefile.am (AM_CXXFLAGS): Add
	-DSANITIZE_CP_DEMANGLE and -I $(top_srcdir)/../include.
	* libbacktrace/backtrace-rename.h (cplus_demangle_builtin_types,
	cplus_demangle_fill_ctor, cplus_demangle_fill_dtor,
	cplus_demangle_fill_extended_operator, cplus_demangle_fill_name,
	cplus_demangle_init_info, cplus_demangle_mangled_name,
	cplus_demangle_operators, cplus_demangle_print,
	cplus_demangle_print_callback, cplus_demangle_type, cplus_demangle_v3,
	cplus_demangle_v3_callback, is_gnu_v3_mangled_ctor,
	is_gnu_v3_mangled_dtor, java_demangle_v3, java_demangle_v3_callback):
	Define.
	(__asan_internal_memcmp, __asan_internal_strncmp): New prototypes.
	(memcmp, strncmp): Redefine.
	* libbacktrace/Makefile.am (libsanitizer_libbacktrace_la_SOURCES): Add
	../../libiberty/cp-demangle.c.
	* libbacktrace/bridge.cc (__asan_internal_memcmp,
	__asan_internal_strncmp): New functions.
	* sanitizer_common/Makefile.in: Regenerated.
	* libbacktrace/Makefile.in: Regenerated.
	* configure: Regenerated.
	* configure.ac: Regenerated.
	* config.h.in: Regenerated.

From-SVN: r206477
2014-01-09 19:16:40 +01:00
Jakub Jelinek
2613419a70 Makefile.am (AM_CPPFLAGS): Add -isystem $(top_srcdir)/include/system.
* sanitizer_common/Makefile.am (AM_CPPFLAGS): Add
	-isystem $(top_srcdir)/include/system.
	* sanitizer_common/Makefile.in: Regenerated.
	* include/system/linux/aio_abi.h: New header.
	* include/system/linux/mroute.h: New header.
	* include/system/linux/mroute6.h: New header.
	* include/system/linux/perf_event.h: New header.
	* include/system/linux/types.h: New header.

From-SVN: r206476
2014-01-09 19:15:41 +01:00
Jakub Jelinek
c915a58145 re PR sanitizer/59136 (llvm-symbolizer shouldn't be started always)
PR sanitizer/59136
libsanitizer/
	* sanitizer_common/Makefile.am (AM_CXXFLAGS): If
	LIBBACKTRACE_SUPPORTED add -DSANITIZER_LIBBACKTRACE
	and -I/-include flags.
	* lsan/Makefile.am (liblsan_la_LIBADD): Add
	libsanitizer_libbacktrace.la if LIBBACKTRACE_SUPPORTED.
	* tsan/Makefile.am (libtsan_la_LIBADD): Likewise.
	* ubsan/Makefile.am (libubsan_la_LIBADD): Likewise.
	* asan/Makefile.am (libasan_la_LIBADD): Likewise.
	* Makefile.am (SUBDIRS): If LIBBACKTRACE_SUPPORTED add
	libbacktrace.
	* README.gcc: Document that also lsan and ubsan are
	maintained in compiler-rt upstream.
	* libbacktrace/Makefile.am: New file.
	* libbacktrace/backtrace-rename.h: New file.
	* libbacktrace/backtrace-supported.h.in: New file.
	* libbacktrace/bridge.cc: New file.
	* configure.ac: Add tests needed for libbacktrace build
	within libsanitizer.
	* sanitizer_common/Makefile.in: Regenerated.
	* lsan/Makefile.in: Regenerated.
	* tsan/Makefile.in: Regenerated.
	* ubsan/Makefile.in: Regenerated.
	* libbacktrace/Makefile.in: Generated.
	* config.h.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
	* interception/Makefile.in: Regenerated.
	* asan/Makefile.in: Regenerated.
	* aclocal.m4: Regenerated.
testsuite/
	* c-c++-common/asan/strip-path-prefix-1.c: Allow also the
	filename:line instead of (modulename+offset) form with stripped
	initial / from the filename.

From-SVN: r206475
2014-01-09 19:13:39 +01:00
Kostya Serebryany
409f3b4663 libsanitizer: fix build on Mac 10.6
From-SVN: r206113
2013-12-19 12:54:11 +00:00
H.J. Lu
079db27b09 Use int64 on time and clock for x32
* sanitizer_common/sanitizer_platform_limits_posix.h
	(__sanitizer_shmid_ds): Use u64 on time fields for x32.
	(__sanitizer_clock_t): Use long long for x32.

From-SVN: r205737
2013-12-06 03:48:24 -08:00
H.J. Lu
7efb96c077 Include <sys/stat.h> if __x86_64__ is defined
* sanitizer_common/sanitizer_platform_limits_linux.cc: Include
	<sys/stat.h>, instead of <asm/stat.h>, if __x86_64__ is defined.
	(struct___old_kernel_stat_sz): Don't check if __x86_64__ is defined.

From-SVN: r205736
2013-12-06 03:44:55 -08:00
H.J. Lu
df9d1700f1 Add -lm to link_sanitizer_common
* configure.ac (link_sanitizer_common): Add -lm.
	* configure: Regenerated.

From-SVN: r205710
2013-12-05 06:41:38 -08:00
Jakub Jelinek
46db94aa6a Add forgotten file.
From-SVN: r205701
2013-12-05 12:06:10 +01:00