From patchwork Tue Oct 13 11:20:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: max X-Patchwork-Id: 529687 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9EACC1402C4 for ; Tue, 13 Oct 2015 22:20:31 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=B/VGEW7g; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=WMXQ7R726OKGKdar5 0PGjGA1DA+KVHspXf/kL3IPifIPK95ymBKGdb/FaLtsMt0QD7MedP8B4kApkpxA9 DBbC4wj4a8w+b7sRlsDOyX3Gz5A9Zh0Fv6CJYdIpcuyAY4PORuGQX3A9IC8zmsrD 57HLQ8Xo+IwFKDgop83AcZRtIQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=pQD69SGVKG76xf4F14R4nF6 pMcs=; b=B/VGEW7gaR0My8jVEelRiZmAzzwQ5shhLYrBSInZy9PDAam96ZTZl/C bwI5SFMpFv4Sbm0i+Lf0ciPe9cLXG6okN3D3BIvzl84ec+Kc9OFBTPnfKk3Q7nm5 ld5ofm4Zo5SzsdYMwqikFINeARUjRHl0S+pHNY3guuXCGlpUW5PU= Received: (qmail 20794 invoked by alias); 13 Oct 2015 11:20:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 20756 invoked by uid 89); 13 Oct 2015 11:20:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL, BAYES_50, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mailout4.w1.samsung.com Received: from mailout4.w1.samsung.com (HELO mailout4.w1.samsung.com) (210.118.77.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 13 Oct 2015 11:20:22 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NW50016ZOTU5C10@mailout4.w1.samsung.com> for gcc-patches@gcc.gnu.org; Tue, 13 Oct 2015 12:20:18 +0100 (BST) Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 28.C3.05269.1F8EC165; Tue, 13 Oct 2015 12:20:17 +0100 (BST) Received: from [106.109.128.167] by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NW5008LXOTS9150@eusync4.samsung.com>; Tue, 13 Oct 2015 12:20:17 +0100 (BST) Subject: [PATCH 5/7] Libsanitizer merge from upstream r249633. To: GCC Patches , Jakub Jelinek , Kostya Serebryany References: <561CE769.6050800@partner.samsung.com> Cc: Dmitry Vyukov , Marek Polacek , Yury Gribov , Slava Garbuzov , Vyacheslav Barinov From: Maxim Ostapenko Message-id: <561CE8E6.6080002@partner.samsung.com> Date: Tue, 13 Oct 2015 14:20:06 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-version: 1.0 In-reply-to: <561CE769.6050800@partner.samsung.com> Content-type: multipart/mixed; boundary=------------040709070304040602030000 X-IsSubscribed: yes This patch removes UBSan stubs from ASan and TSan code. We don't embed UBSan to ASan and UBSan because that would lead to undefined references to C++ stuff when linking with -static-libasan. AFAIK, sanitizer developers use different libraries for C and CXX runtimes, but I think this is out of scope of this merge. 2015-10-13 Maxim Ostapenko * tsan/tsan_defs.h: Define TSAN_CONTAINS_UBSAN to 0. * asan/asan_flags.cc (InitializeFlags): Do not initialize UBSan flags. * asan/asan_rtl.cc (AsanInitInternal): Do not init UBSan. Index: libsanitizer/asan/asan_flags.cc =================================================================== --- libsanitizer/asan/asan_flags.cc (revision 250059) +++ libsanitizer/asan/asan_flags.cc (working copy) @@ -86,15 +86,6 @@ RegisterCommonFlags(&lsan_parser); #endif -#if CAN_SANITIZE_UB - __ubsan::Flags *uf = __ubsan::flags(); - uf->SetDefaults(); - - FlagParser ubsan_parser; - __ubsan::RegisterUbsanFlags(&ubsan_parser, uf); - RegisterCommonFlags(&ubsan_parser); -#endif - // Override from ASan compile definition. const char *asan_compile_def = MaybeUseAsanDefaultOptionsCompileDefinition(); asan_parser.ParseString(asan_compile_def); @@ -102,20 +93,11 @@ // Override from user-specified string. const char *asan_default_options = MaybeCallAsanDefaultOptions(); asan_parser.ParseString(asan_default_options); -#if CAN_SANITIZE_UB - const char *ubsan_default_options = __ubsan::MaybeCallUbsanDefaultOptions(); - ubsan_parser.ParseString(ubsan_default_options); -#endif - // Override from command line. asan_parser.ParseString(GetEnv("ASAN_OPTIONS")); #if CAN_SANITIZE_LEAKS lsan_parser.ParseString(GetEnv("LSAN_OPTIONS")); #endif -#if CAN_SANITIZE_UB - ubsan_parser.ParseString(GetEnv("UBSAN_OPTIONS")); -#endif - // Let activation flags override current settings. On Android they come // from a system property. On other platforms this is no-op. if (!flags()->start_deactivated) { Index: libsanitizer/asan/asan_rtl.cc =================================================================== --- libsanitizer/asan/asan_rtl.cc (revision 250059) +++ libsanitizer/asan/asan_rtl.cc (working copy) @@ -513,10 +513,6 @@ } #endif // CAN_SANITIZE_LEAKS -#if CAN_SANITIZE_UB - __ubsan::InitAsPlugin(); -#endif - InitializeSuppressions(); VReport(1, "AddressSanitizer Init done\n"); Index: libsanitizer/tsan/rtl/tsan_defs.h =================================================================== --- libsanitizer/tsan/tsan_defs.h (revision 250059) +++ libsanitizer/tsan/tsan_defs.h (working copy) @@ -29,7 +29,7 @@ #endif #ifndef TSAN_CONTAINS_UBSAN -# define TSAN_CONTAINS_UBSAN (CAN_SANITIZE_UB && !defined(SANITIZER_GO)) +# define TSAN_CONTAINS_UBSAN 0 #endif namespace __tsan {