Commit Graph

215 Commits

Author SHA1 Message Date
Martin Liska 15e109b35d Include patch in LOCAL_PATCHES.
2018-11-09  Martin Liska  <mliska@suse.cz>

	* LOCAL_PATCHES: Include one local patch.

From-SVN: r265951
2018-11-09 09:21:56 +00:00
Martin Liska d1e2e13c42 Fallback in libsanitizer for scudo sanitizer (PR sanitizer/87892).
2018-11-09  Martin Liska  <mliska@suse.cz>

	PR sanitizer/87892
	* sanitizer_common/sanitizer_linux_libcdep.cc (defined): Return
	1 when CPU_COUNT macro is not defined.

From-SVN: r265950
2018-11-09 09:14:36 +00:00
Bill Seurer 39abbb865c [PATCH, rs6000] Disable ASLR in sanitizer on powerpc64.
Cherry pick powerpc64 sanitizer fix from upstream llvm.

See https://reviews.llvm.org/rL346030 and
https://reviews.llvm.org/D52900.


2018-11-08  Bill Seurer  <seurer@linux.vnet.ibm.com>

	* libsanitizer/sanitizer_common/sanitizer_linux.cc (CheckASLR):
	Disable ASLR for powerpc64 when using sanitizers.

From-SVN: r265941
2018-11-08 22:33:52 +00:00
Rainer Orth aaabfd71e3 Enable libsanitizer on Solaris (PR sanitizer/80953)
gcc:
	PR sanitizer/80953
	* config/sol2.h (ASAN_CC1_SPEC): Define.
	(LD_WHOLE_ARCHIVE_OPTION): Define.
	(LD_NO_WHOLE_ARCHIVE_OPTION): Define.
	(ASAN_REJECT_SPEC): Provide default.
	(LIBASAN_EARLY_SPEC): Define.
	(LIBTSAN_EARLY_SPEC): Define.
	(LIBLSAN_EARLY_SPEC): Define.
	* config/i386/sol2.h (CC1_SPEC): Redefine.
	(ASAN_REJECT_SPEC): Define.

	* config/sparc/sparc.c (sparc_asan_shadow_offset): Declare.
	(TARGET_ASAN_SHADOW_OFFSET): Define.
	(sparc_asan_shadow_offset): New function.
	* config/sparc/sol2.h (CC1_SPEC): Append ASAN_CC1_SPEC.
	(ASAN_REJECT_SPEC): Define.

	gcc/testsuite:
	PR sanitizer/80953
	* c-c++-common/asan/alloca_loop_unpoisoning.c: Require alloca
	support.
	(foo): Use __builtin_alloca.

	libsanitizer:
	PR sanitizer/80953
	* configure.tgt (sparc*-*-solaris2.11*): Enable.
	(x86_64-*-solaris2.11* | i?86-*-solaris2.11*): Enable.

From-SVN: r265837
2018-11-06 10:49:34 +00:00
Rainer Orth 0b5ccc800e Cherry-pick Solaris sanitizer fixes (PR sanitizer/80953)
PR sanitizer/80953
	* sanitizer_common/sanitizer_internal_defs.h,
	sanitizer_common/sanitizer_platform_limits_solaris.h,
	sanitizer_common/sanitizer_procmaps_solaris.cc,
	sanitizer_common/sanitizer_solaris.cc: Cherry-pick compiler-rt
	revision 346153.
	* sanitizer_common/sanitizer_stacktrace.h,
	sanitizer_common/sanitizer_stacktrace_sparc.cc: Cherry-pick
	compiler-rt revision 346155.

From-SVN: r265836
2018-11-06 10:42:05 +00:00
Segher Boessenkool b40a67df7c Fix sanitizer frame unwind on 32-bit ABIs (again)
This re-applies r258525, and this time adds it to LOCAL_PATCHES.


libsanitizer/
	* LOCAL_PATCHES: Add r258525.
	* sanitizer_common/sanitizer_stacktrace.cc
	(BufferedStackTrace::FastUnwindStack): Use the correct frame offset
	for PowerPC SYSV ABI.

From-SVN: r265817
2018-11-05 20:41:29 +01:00
Martin Liska 6388cb2957 Fix build on sparc64-linux-gnu.
2018-11-05  Martin Liska  <mliska@suse.cz>

	PR sanitizer/87860
	* sanitizer_common/sanitizer_linux.cc:  Cherry-pick upstream
	r346129.

From-SVN: r265796
2018-11-05 13:34:36 +00:00
Joseph Myers 22e0527251 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856).
This patch updates GCC to use autoconf 2.69 and automake 1.15.1.
(That's not the latest automake version, but it's the one used by
binutils-gdb, with which consistency is desirable, and in any case
seems a useful incremental update that should make a future update to
1.16.1 easier.)

The changes are generally similar to the binutils-gdb ones, and are
copied from there where shared files and directories are involved
(there are some further changes to such shared directories, however,
which I'd expect to apply to binutils-gdb once this patch is in GCC).
Largely, obsolete AC_PREREQ calls are removed, while many
AC_LANG_SOURCE calls are added to avoid warnings from aclocal and
autoconf.  Multilib support is no longer included in core automake,
meaning that multilib.am needs copying from automake's contrib
directory into the GCC source tree.  Autoconf 2.69 has Go support, so
local copies of that support are removed.  I hope the D support will
soon be submitted to upstream autoconf so the local copy of that can
be removed in a future update.  Changes to how automake generates
runtest calls mean quotes are removed from RUNTEST definitions in five
lib*/testsuite/Makefile.am files (libatomic, libgomp, libitm,
libphobos, libvtv; some others have RUNTEST definitions without
quotes, which are still OK); libgo and libphobos also get
-Wno-override added to AM_INIT_AUTOMAKE so those overrides of RUNTEST
do not generate automake warnings.

Note that the regeneration did not include regeneration of
fixincludes/config.h.in (attempting such regeneration resulted in all
the USED_FOR_TARGET conditionals disappearing; and I don't see
anything in the fixincludes/ directory that would result in such
conditionals being generated, unlike in the gcc/ directory).  Also
note that libvtv/testsuite/other-tests/Makefile.in was not
regenerated; that directory is not listed as a subdirectory for which
Makefile.in gets regenerated by calling "automake" in libvtv/, so I'm
not sure how it's meant to be regenerated.

While I mostly fixed warnings should running aclocal / automake /
autoconf, there were various such warnings from automake in the
libgfortran, libgo, libgomp, liboffloadmic, libsanitizer, libphobos
directories that I did not fix, preferring to leave those to the
relevant subsystem maintainers.  Specifically, most of those warnings
were of the following form (example from libgfortran):

Makefile.am:48: warning: source file 'caf/single.c' is in a subdirectory,
Makefile.am:48: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they
will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.

I think it's best for the relevant maintainers to add subdir-objects
and do any other associated Makefile.am changes needed.  In some cases
the paths in the warnings involved ../; I don't know if that adds any
extra complications to the use of subdir-objects.

I've tested this with native, cross and Canadian cross builds.  The
risk of any OS-specific issues should I hope be rather lower than if a
libtool upgrade were included (we *should* do such an upgrade at some
point, but it's more complicated - it involves identifying all our
local libtool changes to see if any aren't included in the upstream
version we update to, and reverting an upstream libtool patch that's
inappropriate for use in GCC); I think it would be better to get this
update into GCC so that people can test in different configurations
and we can fix any issues found, rather than to try to get more and
more testing done before it goes in.

top level:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* multilib.am: New file.  From automake.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE.
	* ar-lib: New file.
	* test-driver: New file.
	* configure: Re-generate.

config:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* math.m4, tls.m4: Use AC_LANG_SOURCE.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.

fixincludes:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* aclocal.m4, configure: Regenerate.

gcc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use single
	line for second argument of AC_DEFINE_UNQUOTED.
	* doc/install.texi (Tools/packages necessary for modifying GCC):
	Update to autoconf 2.69 and automake 1.15.1.
	* aclocal.m4, config.in, configure: Regenerate.

gnattools:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* configure: Regenerate.

gotools:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* config/go.m4: Remove file.
	* Makefile.am (ACLOCAL_AMFLAGS): Do not use -I ./config.
	* configure.ac:  Remove AC_PREREQ.  Do not include config/go.m4.
	* Makefile.in, aclocal.m4, configure: Regenerate.

intl:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ.
	* configure: Re-generate.
	* config.h.in: Re-generate.
	* aclocal.m4: Re-generate.

libada:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* configure: Regenerate.

libatomic:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* acinclude.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libbacktrace:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libcc1:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libcpp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* aclocal.m4, config.in, configure: Regenerate.

libdecnumber:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* aclocal.m4.

libffi:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove doc/libffi.info.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, fficonfig.h.in,
	include/Makefile.in, man/Makefile.in, testsuite/Makefile.in:
	Regenerate.

libgcc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* configure: Regenerate.

libgfortran:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libgo [logically part of this change but omitted from the commit]:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* config/go.m4: Remove file.
	* config/libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use
	-Wno-override in AM_INIT_AUTOMAKE call.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libgomp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove libgomp.info.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libhsail-rt:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libiberty:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* config.in: Re-generate.

libitm:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove libitm.info.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libobjc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* aclocal.m4, config.h.in, configure: Regenerate.

liboffloadmic:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* plugin/Makefile.am: Include multilib.am.
	* plugin/configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, plugin/Makefile.in,
	plugin/aclocal.m4, plugin/configure: Regenerate.

libphobos:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use -Wno-override in
	AM_INIT_AUTOMAKE call.
	* m4/autoconf.m4: Add extra argument to AC_LANG_DEFINE call.
	* m4/druntime/os.m4: Use AC_LANG_SOURCE.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, libdruntime/Makefile.in,
	src/Makefile.in, testsuite/Makefile.in: Regenerate.

libquadmath:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Remove 1.8.  Add info-in-builddir.
	(all-local): Define outside conditional code.
	(CLEANFILES): Remove libquadmath.info.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libsanitizer:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, asan/Makefile.in, configure,
	interception/Makefile.in, libbacktrace/Makefile.in,
	lsan/Makefile.in, sanitizer_common/Makefile.in, tsan/Makefile.in,
	ubsan/Makefile.in: Regenerate.

libssp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Remove 1.9.5.
	* configure.ac: Remove AC_PREREQ.  Quote argument to
	AC_RUN_IFELSE.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libstdc++-v3:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, doc/Makefile.in,
	include/Makefile.in, libsupc++/Makefile.in, po/Makefile.in,
	python/Makefile.in, src/Makefile.in, src/c++11/Makefile.in,
	src/c++17/Makefile.in, src/c++98/Makefile.in,
	src/filesystem/Makefile.in, testsuite/Makefile.in: Regenerate.

libvtv:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

lto-plugin:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

zlib:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Modernize AC_INIT call, remove AC_PREREQ.
	* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add foreign.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* configure: Re-generate.

From-SVN: r265695
2018-10-31 17:03:16 +00:00
Martin Liska 088371bfc5 Update LOCAL_PATCHES after libsanitizer merge.
2018-10-31  Martin Liska  <mliska@suse.cz>

	* LOCAL_PATCHES: Update to installed revisions.

From-SVN: r265673
2018-10-31 11:27:16 +00:00
Martin Liska c244886cc4 New local GCC patch for CAN_SANITIZE_UB ifdef.
2018-10-31  Martin Liska  <mliska@suse.cz>

	* ubsan/ubsan_platform.h: Add ifndef as we define it with
	-DCAN_SANITIZE_UB CFLAGS.

From-SVN: r265669
2018-10-31 11:17:10 +00:00
Martin Liska f607b87cbe Revert https://reviews.llvm.org/D40908 which changes asan offset to 1<<44.
2018-10-31  Martin Liska  <mliska@suse.cz>

	* asan/asan_mapping.h: Revert shadow memory offset to 1 << 41.

From-SVN: r265668
2018-10-31 11:16:41 +00:00
Martin Liska e63c967765 Apply LOCAL_PATCHES and remove not used ones.
2018-10-31  Martin Liska  <mliska@suse.cz>

	* LOCAL_PATCHES: Update patch list.
	* asan/asan_globals.cc (CheckODRViolationViaIndicator): Apply
	patches from GCC's trunk.
	(CheckODRViolationViaPoisoning): Likewise.
	(RegisterGlobal): Likewise.
	* sanitizer_common/sanitizer_mac.cc (defined): Likewise.
	* sanitizer_common/sanitizer_stacktrace.cc (GetCanonicFrame): Likewise.
	* ubsan/ubsan_handlers.cc (__ubsan::__ubsan_handle_cfi_bad_icall): Likewise.
	(__ubsan::__ubsan_handle_cfi_bad_icall_abort): Likewise.
	* ubsan/ubsan_handlers.h (struct CFIBadIcallData): Likewise.
	(struct CFICheckFailData): Likewise.
	(RECOVERABLE): Likewise.

From-SVN: r265667
2018-10-31 11:16:17 +00:00
Martin Liska 8468f94425 Update build system: include new files and run autoheader, autoconf, automake
2018-10-31  Martin Liska  <mliska@suse.cz>

	* config.h.in: Regenerate.
	* configure: Likewise.
	* sanitizer_common/Makefile.am: Include new files, remove old
	files.
	* sanitizer_common/Makefile.in: Regenerate.
	* ubsan/Makefile.am: Include new files, remove old
	files.
	* ubsan/Makefile.in: Likewise.
	* asan/Makefile.am: Include new files.
	* asan/Makefile.in: Regenerate.

From-SVN: r265666
2018-10-31 11:15:57 +00:00
Martin Liska eac9753122 backport: All source files: Merge from upstream 345033.
Merge from upstream 345033.

2018-10-31  Martin Liska  <mliska@suse.cz>

	* All source files: Merge from upstream 345033.

From-SVN: r265665
2018-10-31 11:14:23 +00:00
Martin Liska 95fba530b6 Update merge script and HOWTO_MERGE documentation.
2018-10-31  Martin Liska  <mliska@suse.cz>

	* HOWTO_MERGE: Enhance documentation.
	* merge.sh: Add support for git as well.

From-SVN: r265664
2018-10-31 11:09:26 +00:00
Martin Liska 92a285c1a7 Replace 8 spaces with a tabular in ChangeLog files.
From-SVN: r263886
2018-08-27 14:04:23 +00:00
Martin Liska b4f1f01d45 Cherry-pick compiler-rt revision 338606 (PR sanitizer/86022).
Fix sizeof(struct pthread) in glibc 2.14.

2018-08-02  Martin Liska  <mliska@suse.cz>

        PR sanitizer/86022
	* sanitizer_common/sanitizer_linux_libcdep.cc (ThreadDescriptorSize):
        Cherry-pick compiler-rt revision 338606.

From-SVN: r263246
2018-08-02 09:32:58 +00:00
Marek Polacek c191b1abe9 Cherry-pick compiler-rt revision 318044 and 319180.
[PowerPC][tsan] Update tsan to handle changed memory layouts in newer kernels
    
    In more recent Linux kernels with 47 bit VMAs the layout of virtual memory
    for powerpc64 changed causing the thread sanitizer to not work properly. This
    patch adds support for 47 bit VMA kernels for powerpc64.
    
    Tested on several 4.x and 3.x kernel releases.

Regtested/bootstrapped on ppc64le-linux with kernel 4.14; applying to
trunk/8.3.

2018-08-01  Marek Polacek  <polacek@redhat.com>

	PR sanitizer/86759
	* tsan/tsan_platform.h: Cherry-pick compiler-rt revision 318044.
	* tsan/tsan_platform_linux.cc: Cherry-pick compiler-rt revision
	319180.

From-SVN: r263229
2018-08-01 17:17:29 +00:00
H.J. Lu c83b4b8242 libsanitizer: Mark REAL(swapcontext) with indirect_return attribute on x86
Cherry-pick compiler-rt revision 337603:

When shadow stack from Intel CET is enabled, the first instruction of all
indirect branch targets must be a special instruction, ENDBR.

lib/asan/asan_interceptors.cc has

...
  int res = REAL(swapcontext)(oucp, ucp);
...

REAL(swapcontext) is a function pointer to swapcontext in libc.  Since
swapcontext may return via indirect branch on x86 when shadow stack is
enabled, as in this case,

int res = REAL(swapcontext)(oucp, ucp);
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^  This function may be
returned via an indirect branch.

Here compiler must insert ENDBR after call, like

call *bar(%rip)
endbr64

I opened an LLVM bug:

https://bugs.llvm.org/show_bug.cgi?id=38207

to add the indirect_return attribute so that it can be used to inform
compiler to insert ENDBR after REAL(swapcontext) call.  We mark
REAL(swapcontext) with the indirect_return attribute if it is available.

This fixed:

https://bugs.llvm.org/show_bug.cgi?id=38249

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D49608

	PR target/86560
	* asan/asan_interceptors.cc (swapcontext) Cherry-pick
	compiler-rt revision 337603.
	* sanitizer_common/sanitizer_internal_defs.h (__has_attribute):
	Likewise.

From-SVN: r263009
2018-07-26 07:48:55 -07:00
Jakub Jelinek bdfc619ed8 Revert
2018-07-04  Maxim Ostapenko  <m.ostapenko@samsung.com>

	PR sanitizer/84250
	* config/gnu-user.h (LIBASAN_EARLY_SPEC): Pass -lstdc++ for static
	libasan.
	* gcc.c: Do not pass LIBUBSAN_SPEC if ASan is enabled with UBSan.

	* Makefile.am: Reorder libs.
	* Makefile.in: Regenerate.
	* asan/Makefile.am: Define DCAN_SANITIZE_UB=1, add dependancy from
	libsanitizer_ubsan.la.
	* asan/Makefile.in: Regenerate.
	* ubsan/Makefile.am: Define new libsanitizer_ubsan.la library.
	* ubsan/Makefile.in: Regenerate.

From-SVN: r262433
2018-07-05 11:47:05 +02:00
Maxim Ostapenko ca8dd9f274 re PR sanitizer/84250 (Symbol collision when using both Address and Undefined Behavior sanitizers (-fsanitize=address,undefined))
gcc/

2018-07-04  Maxim Ostapenko  <m.ostapenko@samsung.com>

	PR sanitizer/84250
	* config/gnu-user.h (LIBASAN_EARLY_SPEC): Pass -lstdc++ for static
	libasan.
	* gcc.c: Do not pass LIBUBSAN_SPEC if ASan is enabled with UBSan.

libsanitizer/

2018-07-04  Maxim Ostapenko  <m.ostapenko@samsung.com>

	PR sanitizer/84250
	* Makefile.am: Reorder libs.
	* Makefile.in: Regenerate.
	* asan/Makefile.am: Define DCAN_SANITIZE_UB=1, add dependancy from
	libsanitizer_ubsan.la.
	* asan/Makefile.in: Regenerate.
	* ubsan/Makefile.am: Define new libsanitizer_ubsan.la library.
	* ubsan/Makefile.in: Regenerate.

From-SVN: r262421
2018-07-04 22:49:06 +03:00
Denis Khalikov 3b07c0e5e4 re PR sanitizer/86090 ([ASAN] ASAN does not properly configure libbacktrace.)
2018-06-13  Denis Khalikov  <d.khalikov@partner.samsung.com>

libsanitizer/

	PR sanitizer/86090
	* configure.ac: Check for lstat and readlink.
	* configure, config.h.in: Rebuild.

From-SVN: r261564
2018-06-13 22:51:42 +03:00
Matthias Klose 5b87c1fe09 re PR sanitizer/86012 (libsanitizer build failure on sparc64-linux-gnu)
2018-05-31  Matthias Klose  <doko@ubuntu.com>

        PR sanitizer/86012
        * sanitizer_common/sanitizer_platform_limits_posix.cc: Define
        SIZEOF_STRUCT_USTAT for 32bit sparc.

From-SVN: r260990
2018-05-31 09:57:33 +00:00
H.J. Lu 71b55d45e4 libsanitizer: Use pre-computed size of struct ustat for Linux
Cherry-pick compiler-rt revision 333213:

<sys/ustat.h> has been removed from glibc 2.28 by:

commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sun Mar 18 11:28:59 2018 +0800

    Deprecate ustat syscall interface

This patch uses pre-computed size of struct ustat for Linux.

	PR sanitizer/85835
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Don't
	include <sys/ustat.h> for Linux.
	(SIZEOF_STRUCT_USTAT): New.
	(struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux.

From-SVN: r260684
2018-05-24 12:52:32 -07:00
Hans-Peter Nilsson 752361c980 If someone has access to a 64-bit mips-linux system to test this (with the obvious edit), that'd be really nice.
If someone has access to a 64-bit mips-linux system to test
this (with the obvious edit), that'd be really nice.  Until
then, best to not introduce possible build failures.

	* configure.tgt <mips*-*-linux*>: Enable build, excluding
	mips*64*-*-linux*.

From-SVN: r259665
2018-04-26 01:16:47 +00:00
Hans-Peter Nilsson 9f943b2446 As mentioned in <http://gcc.gnu.org/ml/gcc/2018-03/msg00133.html> the bogus adjustment to 160 from 144 (which is reverted here)...
As mentioned in <http://gcc.gnu.org/ml/gcc/2018-03/msg00133.html>
the bogus adjustment to 160 from 144 (which is reverted here),
is a single-token commit in upstream r301307, an attempt to
correct a failed build due to an upstream change to compile the
runtime with D_FILE_OFFSET_BITS=64.  The correct fix is here:
just use the right include.  Yes, user-struct-stat64-as-stat is
actually 160 for MIPS o32 and I hear user-struct-stat is also
160 for n32.  There are additional fields appended for
user-struct-stat!  I guess for MIPS it's as bad as it gets for
mixing up kernel and user struct stat.  The context of the patch
doesn't show that in the #else there's the correct include, the
one for <asm/stat.h> to get the kernel-struct-stat.  If you
can't compile it, IMHO the kernel headers are just too old; 3.2
is fine for example.

	* sanitizer_common/sanitizer_platform_limits_linux.cc: Do not
	take the shortcut to #include <sys/stat.h> for MIPS instead of
	the kernel <asm/stat.h>.  Explain why sys/stat.h is misleading
	or wrong to get the kernel struct stat.
	* sanitizer_common/sanitizer_platform_limits_posix.h [__mips__]:
	Correct the value for 32-bit non-android struct_kernel_stat_sz.

From-SVN: r259664
2018-04-26 01:12:56 +00:00
Hans-Peter Nilsson bc40f16691 This appears to be present in compiler-rt upstream, but as part of more intrusive changes.
This appears to be present in compiler-rt upstream, but as part
of more intrusive changes.  For gcc, the lack of this results in
a fatal warning (-Werror) at build-time.

	* sanitizer_common/sanitizer_atomic_clang_other.h [_MIPS_SIM
	&& _MIPS_SIM == _ABIO32] (lock): Add initializer for .pad member.

From-SVN: r259663
2018-04-26 01:09:27 +00:00
H.J. Lu 7b47ecf2f7 Regenerate configure of target libraries
* configure: Regenerated.

From-SVN: r259610
2018-04-24 09:45:26 -07:00
Jakub Jelinek a0e1df888d cet.m4 (GCC_CET_FLAGS): Default to --disable-cet, replace --enable-cet=default with --enable-cet=auto.
* config/cet.m4 (GCC_CET_FLAGS): Default to --disable-cet, replace
	--enable-cet=default with --enable-cet=auto.

	* doc/install.texi: Document --disable-cet being the default and
	--enable-cet=auto.

	* configure: Regenerated.

From-SVN: r259487
2018-04-19 09:45:51 +02:00
David Malcolm 001ddaa852 re PR jit/85384 (libgccjit does not work if --with-gcc-major-version is used)
PR jit/85384
	* acx.m4 (GCC_BASE_VER): Remove \$\$ from sed expression.

	* configure.ac (gcc-driver-name.h): Honor --with-gcc-major-version
	by using gcc_base_ver to generate a gcc_driver_version, and use
	it when generating GCC_DRIVER_NAME.
	* configure: Regenerate.

	* configure: Regenerate.

From-SVN: r259462
2018-04-18 11:46:58 +02:00
Bill Seurer 19ddb884eb re PR sanitizer/85389 (posix_memalign() crash with address sanitizer when passing invalid arguments)
PR sanitizer/85389
	* asan/asan_allocator.h (kAllocatorSpace): For __powerpc64__ change
	from 0xa0000000000ULL to ~(uptr)0.

From-SVN: r259459
2018-04-18 09:02:40 +02:00
Jakub Jelinek 359ea407e9 re PR sanitizer/84761 (AddressSanitizer is not compatible with glibc 2.27 on x86)
PR sanitizer/84761
	* sanitizer_common/sanitizer_linux_libcdep.cc (__GLIBC_PREREQ):
	Define if not defined.
	(DL_INTERNAL_FUNCTION): Don't define.
	(InitTlsSize): For __i386__ if not compiled against glibc 2.27+
	determine at runtime whether to use regparm(3), stdcall calling
	convention for older glibcs or normal calling convention for
	newer glibcs for call to _dl_get_tls_static_info.

From-SVN: r258663
2018-03-19 21:47:29 +01:00
Segher Boessenkool 1422855a40 rs6000: Fix sanitizer frame unwind on 32-bit ABIs
This fixes more than half of our testcase failures on BE.


libsanitizer/
	* sanitizer_common/sanitizer_stacktrace.cc
	(BufferedStackTrace::FastUnwindStack): Use the correct frame offset
	for PowerPC SYSV ABI.

From-SVN: r258525
2018-03-14 14:46:03 +01:00
Igor Tsimbalist 14e335edc8 CET shouldn't be enabled in 32-bit run-time libraries by defualt
ENDBR32 and RDSSPD are multi-byte NOPs on x86-64 processors and
newer x86 processors, starting Pentium Pro.  They are UD on older
32-bit processors. Detect this at configure time and adjust the
default value for enable_cet. GCC will enable CET in 32-bit run-time
libraries in any case if --enable-cet is used to configure GCC.

	PR target/84148
	* config/cet.m4: Check if target support multi-byte NOPS (SSE).
	* libatomic/configure: Regenerate.
	* libbacktrace/configure: Likewise.
	* libgcc/configure: Likewise.
	* libgfortran/configure: Likewise.
	* libgomp/configure: Likewise.
	* libitm/configure: Likewise.
	* libmpx/configure: Likewise.
	* libobjc/configure: Likewise.
	* libquadmath/configure: Likewise.
	* libsanitizer/configure: Likewise.
	* libssp/configure: Likewise.
	* libstdc++-v3/configure: Likewise.
	* libvtv/configure: Likewise.

From-SVN: r257809
2018-02-19 17:25:49 +01:00
Rainer Orth 9dfc6e8394 Add upstream svn rev for PR sanitizer/82825.
From-SVN: r257405
2018-02-06 08:16:22 +00:00
Martin Liska 4c4f3c3fef Cherry-pick libsanitizer pointer-pair tristate option.
2018-02-05  Martin Liska  <mliska@suse.cz>

	* doc/invoke.texi: Cherry-pick upstream r323995.
2018-02-05  Martin Liska  <mliska@suse.cz>

	* c-c++-common/asan/pointer-compare-1.c: Adjust ASAN_OPTIONS
	options.
	* c-c++-common/asan/pointer-compare-2.c: Likewise.
	* c-c++-common/asan/pointer-subtract-1.c: Likewise.
	* c-c++-common/asan/pointer-subtract-2.c: Likewise.
	* c-c++-common/asan/pointer-subtract-3.c: Likewise.
	* c-c++-common/asan/pointer-subtract-4.c: Likewise.
	* c-c++-common/asan/pointer-compare-3.c: New test.
2018-02-05  Martin Liska  <mliska@suse.cz>

	* asan/asan_flags.inc: Cherry-pick upstream r323995.
	* asan/asan_report.cc (CheckForInvalidPointerPair):
	Cherry-pick upstream r323995.

From-SVN: r257387
2018-02-05 11:01:50 +00:00
Rainer Orth 2d509539db Guard against undefined weak symbols before Mac OS X 10.9 (PR sanitizer/82825)
PR sanitizer/82825
	* sanitizer_common/sanitizer_internal_defs.h: Cherry-pick upstream
	r??????.

From-SVN: r256813
2018-01-17 19:31:43 +00:00
Rainer Orth 1f7273e5db Allow for lack of VM_MEMORY_OS_ALLOC_ONCE on Mac OS X (PR sanitizer/82824)
PR sanitizer/82824
	* lsan/lsan_common_mac.cc: Cherry-pick upstream r322437.

From-SVN: r256650
2018-01-13 21:01:27 +00:00
Martin Liska 05abad4cca invoke.texi: Document the options.
gcc/
	* doc/invoke.texi: Document the options.
	* flag-types.h (enum sanitize_code): Add
	SANITIZE_POINTER_COMPARE and SANITIZE_POINTER_SUBTRACT.
	* ipa-inline.c (sanitize_attrs_match_for_inline_p): Add handling
	of SANITIZE_POINTER_COMPARE and SANITIZE_POINTER_SUBTRACT.
	* opts.c: Define new sanitizer options.
	* sanitizer.def (BUILT_IN_ASAN_POINTER_COMPARE): Likewise.
	(BUILT_IN_ASAN_POINTER_SUBTRACT): Likewise.
gcc/c/
	* c-typeck.c (pointer_diff): Add new argument and instrument
	pointer subtraction.
	(build_binary_op): Similar for pointer comparison.
gcc/cp/
	* typeck.c (pointer_diff): Add new argument and instrument
	pointer subtraction.
	(cp_build_binary_op): Create compound expression if doing an
	instrumentation.
gcc/testsuite/
	* c-c++-common/asan/pointer-compare-1.c: New test.
	* c-c++-common/asan/pointer-compare-2.c: New test.
	* c-c++-common/asan/pointer-subtract-1.c: New test.
	* c-c++-common/asan/pointer-subtract-2.c: New test.
	* c-c++-common/asan/pointer-subtract-3.c: New test.
	* c-c++-common/asan/pointer-subtract-4.c: New test.
libsanitizer/
	* asan/asan_descriptions.cc: Cherry-pick upstream r319668.
	* asan/asan_descriptions.h: Likewise.
	* asan/asan_report.cc: Likewise.
	* asan/asan_thread.cc: Likewise.
	* asan/asan_thread.h: Likewise.

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

From-SVN: r255404
2017-12-05 10:23:25 +01:00
Igor Tsimbalist 9069eb28d4 Enable building libsanitizer with Intel CET
libsanitizer/
	* acinclude.m4: Add enable.m4 and cet.m4.
	* Makefile.in: Regenerate.
	* asan/Makefile.am: Update AM_CXXFLAGS.
	* asan/Makefile.in: Regenerate.
	* configure: Likewise.
	* configure.ac: Set CET_FLAGS. Update EXTRA_CFLAGS,
	EXTRA_CXXFLAGS, EXTRA_ASFLAGS.
	* interception/Makefile.am: Update AM_CXXFLAGS.
	* interception/Makefile.in: Regenerate.
	* libbacktrace/Makefile.am: Update AM_CFLAGS, AM_CXXFLAGS.
	* libbacktrace/Makefile.in: Regenerate.
	* lsan/Makefile.am: Update AM_CXXFLAGS.
	* lsan/Makefile.in: Regenerate.
	* sanitizer_common/Makefile.am: Update AM_CXXFLAGS,
	AM_CCASFLAGS.
	* sanitizer_common/sanitizer_linux_x86_64.S: Include cet.h.
	Add _CET_ENDBR macro.
	* sanitizer_common/Makefile.in: Regenerate.
	* tsan/Makefile.am: Update AM_CXXFLAGS.
	* tsan/Makefile.in: Regenerate.
	* tsan/tsan_rtl_amd64.S Include cet.h. Add _CET_ENDBR macro.
	* ubsan/Makefile.am: Update AM_CXXFLAGS.
	* ubsan/Makefile.in: Regenerate.

From-SVN: r254896
2017-11-17 22:34:50 +01:00
Jakub Jelinek 5925290f7d re PR bootstrap/82670 (UBSAN bootstrap broken after recent libsanitizer merge)
PR bootstrap/82670
	* ubsan/Makefile.am (ubsan_files): Remove ubsan_init_standalone.cc
	and ubsan_signals_standalone.cc.
	* ubsan/Makefile.in: Regenerated.

From-SVN: r254518
2017-11-08 09:17:02 +01:00
Tom de Vries 735e62b905 [libsanitizer] Remove semicolon after do {} while (0) in macro body
2017-11-05  Tom de Vries  <tom@codesourcery.com>

	PR other/82784
	* asan/asan_poisoning.cc (CHECK_SMALL_REGION): Remove semicolon after
	"do {} while (0)".
	* lsan/lsan_common.cc (LOG_POINTERS, LOG_THREADS): Same.

From-SVN: r254419
2017-11-05 09:57:17 +00:00
Jakub Jelinek 9a45ffbd12 re PR sanitizer/82595 (bootstrap fails in libsanitizer on powerpc64-unknown-linux-gnu)
PR sanitizer/82595
	* config/gnu-user.h (LIBTSAN_EARLY_SPEC): Add libtsan_preinit.o
	for -fsanitize=thread link of executables.
	(LIBLSAN_EARLY_SPEC): Add liblsan_preinit.o for -fsanitize=leak
	link of executables.

	* lsan/lsan.h (__lsan_init): Add SANITIZER_INTERFACE_ATTRIBUTE.
	* lsan/Makefile.am (nodist_toolexeclib_HEADERS): Add
	liblsan_preinit.o.
	(lsan_files): Remove lsan_preinit.cc.
	(liblsan_preinit.o): New rule.
	* lsan/Makefile.in: Regenerated.

From-SVN: r253925
2017-10-20 09:32:35 +02:00
Jakub Jelinek 5d3805fca3 ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
	builtins, store max (log2 (align), 0) into uchar field instead of
	align into uptr field.
	(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
	store uchar 0 field instead of uptr 0 field.
	(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
	instead of passing one address of struct with 2 locations pass
	two addresses of structs with 1 location each.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
	BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
	(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
	BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.

	* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
	from expected output regexps.
	* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
	* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
	* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
	* g++.dg/asan/default-options-1.C (__asan_default_options): Add
	used attribute.
	* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
	in the environment.

	* All source files: Merge from upstream 315899.
        * asan/Makefile.am (nodist_saninclude_HEADERS): Add
	include/sanitizer/tsan_interface.h.
        * asan/libtool-version: Bump the libasan SONAME.
	* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
	(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
        * sanitizer_common/Makefile.am (sanitizer_common_files): Add
	sancov_flags.cc, sanitizer_allocator_checks.cc,
	sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
	sanitizer_file.cc, sanitizer_mac_libcdep.cc and
	sanitizer_stoptheworld_mac.cc.  Remove sanitizer_coverage_libcdep.cc
	and sanitizer_coverage_mapping_libcdep.cc.
        * tsan/Makefile.am (tsan_files): Add tsan_external.cc.
	* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
	(ubsan_files): Add ubsan_init_standalone.cc and
	ubsan_signals_standalone.cc.
	* ubsan/libtool-version: Bump the libubsan SONAME.
        * asan/Makefile.in: Regenerate.
        * lsan/Makefile.in: Regenerate.
        * sanitizer_common/Makefile.in: Regenerate.
        * tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.in: Regenerate.

From-SVN: r253887
2017-10-19 13:23:59 +02:00
H.J. Lu bf4df9e6b4 Add sanitizer_linux_x86_64.lo if __x86_64__ is defined by $CC
Since size of "void *" is 4 bytes for x32, check if __x86_64__ is defined
by $CC, instead of

if test x$ac_cv_sizeof_void_p = x8; then

to decide wether sanitizer_linux_x86_64.lo should be used.

	PR sanitizer/82379
	* configure.tgt (SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS): Set
	to sanitizer_linux_x86_64.lo if __x86_64__ is defined by $CC.

From-SVN: r253441
2017-10-05 03:39:32 -07:00
Jakub Jelinek d1453bec27 backtrace-rename.h (backtrace_uncompress_zdebug): Define.
* libbacktrace/backtrace-rename.h (backtrace_uncompress_zdebug):
	Define.

From-SVN: r253351
2017-10-02 16:00:53 +02:00
Jakub Jelinek a5320f3ce2 * include/system/sys/ptrace.h: New file.
From-SVN: r250910
2017-08-07 10:32:47 +02:00
Jakub Jelinek c9b39a4955 re PR sanitizer/80998 (Implement -fsanitize=pointer-overflow)
PR sanitizer/80998
	* sanopt.c (pass_sanopt::execute): Handle IFN_UBSAN_PTR.
	* tree-ssa-alias.c (call_may_clobber_ref_p_1): Likewise.
	* flag-types.h (enum sanitize_code): Add SANITIZER_POINTER_OVERFLOW.
	Or it into SANITIZER_UNDEFINED.
	* ubsan.c: Include gimple-fold.h and varasm.h.
	(ubsan_expand_ptr_ifn): New function.
	(instrument_pointer_overflow): New function.
	(maybe_instrument_pointer_overflow): New function.
	(instrument_object_size): Formatting fix.
	(pass_ubsan::execute): Call instrument_pointer_overflow
	and maybe_instrument_pointer_overflow.
	* internal-fn.c (expand_UBSAN_PTR): New function.
	* ubsan.h (ubsan_expand_ptr_ifn): Declare.
	* sanitizer.def (__ubsan_handle_pointer_overflow,
	__ubsan_handle_pointer_overflow_abort): New builtins.
	* tree-ssa-tail-merge.c (merge_stmts_p): Handle IFN_UBSAN_PTR.
	* internal-fn.def (UBSAN_PTR): New internal function.
	* opts.c (sanitizer_opts): Add pointer-overflow.
	* lto-streamer-in.c (input_function): Handle IFN_UBSAN_PTR.
	* fold-const.c (build_range_check): Compute pointer range check in
	integral type if pointer arithmetics would be needed.  Formatting
	fixes.
gcc/testsuite/
	* c-c++-common/ubsan/ptr-overflow-1.c: New test.
	* c-c++-common/ubsan/ptr-overflow-2.c: New test.
libsanitizer/
	* ubsan/ubsan_handlers.cc: Cherry-pick upstream r304461.
	* ubsan/ubsan_checks.inc: Likewise.
	* ubsan/ubsan_handlers.h: Likewise.

From-SVN: r250656
2017-07-28 12:37:51 +02:00
Jakub Jelinek 144e36a796 re PR sanitizer/81066 (sanitizer_stoptheworld_linux_libcdep.cc:276:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined)
PR sanitizer/81066
	* sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
	* sanitizer_common/sanitizer_linux.cc: Likewise.
	* sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
	* tsan/tsan_platform_linux.cc: Likewise.

From-SVN: r250200
2017-07-14 11:10:45 +02:00
Martin Liska d9f8c5af8b Cherry-pick upstream r299036 from libsanitizer (PR sanitizer/80166).
2017-04-06  Martin Liska  <mliska@suse.cz>

	PR sanitizer/80166
	* sanitizer_common/sanitizer_common_interceptors.inc (INTERCEPTOR):
	Cherry-pick upstream r299036.
2017-04-06  Martin Liska  <mliska@suse.cz>

	PR sanitizer/80166
	* gcc.dg/asan/pr80166.c: New test.

From-SVN: r246730
2017-04-06 13:42:24 +00:00