From patchwork Mon Nov 7 08:25:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Ostapenko X-Patchwork-Id: 81003 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp895968qge; Mon, 7 Nov 2016 00:26:26 -0800 (PST) X-Received: by 10.98.60.7 with SMTP id j7mr8914671pfa.129.1478507185968; Mon, 07 Nov 2016 00:26:25 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id s199si3102027pgs.43.2016.11.07.00.26.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Nov 2016 00:26:25 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-440568-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-440568-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-440568-patch=linaro.org@gcc.gnu.org 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:cc:from:message-id:date:mime-version:in-reply-to :content-type:references; q=dns; s=default; b=mSLzJNe6YD1k6m12Iv vf99hZitZuV7oWGmcHqlxzoVwtKE8BBVWCUDbWCzBdHq324em2yIW8QD5BVVKhQd NTQ0zGxu3PgDJpoztz4U97dMAntz0czTChZNGzKneVOaft69x+8yz5FVRTLATXu+ GZVNM0ZxKKIS/nrmoxUtAW7b4= 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:cc:from:message-id:date:mime-version:in-reply-to :content-type:references; s=default; bh=CynhtIDHTXCnfpyvYwbqXBJs ygE=; b=rlNRkZAksP6JhUEkTffiEFJ/6yGxVllJfWEqWPz5FGPjEu4X4OgoXKNN LUTd4Fe2o+xLcXJbRCnCntjT+imm3xEI37oa7r9s4117+gYBnmGYszy3prymnLQA GtAnFprW29f8ZbKT31BVULkmeMrV+zspVzcKR9I+H/ulEzrrh4E= Received: (qmail 11028 invoked by alias); 7 Nov 2016 08:26:10 -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 11018 invoked by uid 89); 7 Nov 2016 08:26:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=beg, HContent-type:multipart, HContent-type:boundary X-HELO: mailout3.w1.samsung.com Received: from mailout3.w1.samsung.com (HELO mailout3.w1.samsung.com) (210.118.77.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Nov 2016 08:25:59 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OG9008NFJF8HJ40@mailout3.w1.samsung.com> for gcc-patches@gcc.gnu.org; Mon, 07 Nov 2016 08:25:56 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161107082556eucas1p283e59615a186899297ee2f22fadc7e03~EtmzUbzbb1048610486eucas1p2d; Mon, 7 Nov 2016 08:25:56 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 4B.7A.19540.39A30285; Mon, 7 Nov 2016 08:25:55 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161107082555eucas1p217136a7bc11b9033cad23d9579361228~EtmyeEpGE1049010490eucas1p2k; Mon, 7 Nov 2016 08:25:55 +0000 (GMT) Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 66.2E.10494.57A30285; Mon, 7 Nov 2016 08:25:25 +0000 (GMT) Received: from [106.109.129.18] by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OG900K8BJF69070@eusync4.samsung.com>; Mon, 07 Nov 2016 08:25:54 +0000 (GMT) Subject: [PATCH 4/7] Libsanitizer merge from upstream r285547. To: GCC Patches Cc: Jakub Jelinek , Kostya Serebryany , Yuri Gribov From: Maxim Ostapenko Message-id: <58203A91.9030402@samsung.com> Date: Mon, 07 Nov 2016 11:25:53 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-version: 1.0 In-reply-to: <582039C4.4040606@samsung.com> Content-type: multipart/mixed; boundary=------------090201000900090508070503 X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161107082555eucas1p217136a7bc11b9033cad23d9579361228 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?TWFrc2ltIE9zdGFwZW5rbxtTUlItU1cgVG9vbHMgTGFiGw==?= =?UTF-8?B?7IK87ISx7KCE7J6QG0VuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?TWF4aW0gT3N0YXBlbmtvG1NSUi1TVyBUb29scyBMYWIbU2Ft?= =?UTF-8?B?c3VuZ8KgRWxlY3Ryb25pY3MbRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1Nw==?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161107082555eucas1p217136a7bc11b9033cad23d9579361228 X-RootMTR: 20161107082555eucas1p217136a7bc11b9033cad23d9579361228 References: <582039C4.4040606@samsung.com> X-IsSubscribed: yes This is rewritten Jakub's fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63888. Upstream now supports new approach for ODR violation detection: compiler emits new __odr_asan_XXX symbol for each instrumented global that indicates whether this global was already registered and the library checks this indicator symbol at runtime. However, to preserve compatibility, the library still can fall to old, incompatible with GCC approach of ODR violation detection (say, when the odr indicator symbol wasn't emitted e.g. for static variable, libasan tries the old method). To avoid this, this patch removes CheckODRViolationViaPoisoning call and leaves only CheckODRViolationViaIndicator. >From 5cd9a7cb1c2dd668e533bee1bc15e367d367d84f Mon Sep 17 00:00:00 2001 From: Maxim Ostapenko Date: Fri, 28 Oct 2016 10:22:35 +0300 Subject: [PATCH 4/7] libsanitizer/ * asan/asan_globals.cc (RegisterGlobal): Do not call CheckODRViolationViaPoisoning. (CheckODRViolationViaPoisoning): Remove. --- libsanitizer/ChangeLog | 6 ++++++ libsanitizer/asan/asan_globals.cc | 19 ------------------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index 7e4f89f..d439f45 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,5 +1,11 @@ 2016-11-07 Maxim Ostapenko + * asan/asan_globals.cc (RegisterGlobal): Do not call + CheckODRViolationViaPoisoning. + (CheckODRViolationViaPoisoning): Remove. + +2016-11-07 Maxim Ostapenko + * 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. diff --git a/libsanitizer/asan/asan_globals.cc b/libsanitizer/asan/asan_globals.cc index 007fce72..f229292 100644 --- a/libsanitizer/asan/asan_globals.cc +++ b/libsanitizer/asan/asan_globals.cc @@ -147,23 +147,6 @@ static void CheckODRViolationViaIndicator(const Global *g) { } } -// Check ODR violation for given global G by checking if it's already poisoned. -// We use this method in case compiler doesn't use private aliases for global -// variables. -static void CheckODRViolationViaPoisoning(const Global *g) { - if (__asan_region_is_poisoned(g->beg, g->size_with_redzone)) { - // This check may not be enough: if the first global is much larger - // the entire redzone of the second global may be within the first global. - for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) { - if (g->beg == l->g->beg && - (flags()->detect_odr_violation >= 2 || g->size != l->g->size) && - !IsODRViolationSuppressed(g->name)) - ReportODRViolation(g, FindRegistrationSite(g), - l->g, FindRegistrationSite(l->g)); - } - } -} - // Clang provides two different ways for global variables protection: // it can poison the global itself or its private alias. In former // case we may poison same symbol multiple times, that can help us to @@ -211,8 +194,6 @@ static void RegisterGlobal(const Global *g) { // where two globals with the same name are defined in different modules. if (UseODRIndicator(g)) CheckODRViolationViaIndicator(g); - else - CheckODRViolationViaPoisoning(g); } if (CanPoisonMemory()) PoisonRedZones(*g); -- 1.9.1