From patchwork Fri Dec 16 12:04:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 88289 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1363390qgi; Fri, 16 Dec 2016 04:05:05 -0800 (PST) X-Received: by 10.98.196.89 with SMTP id y86mr2691117pff.172.1481889905406; Fri, 16 Dec 2016 04:05:05 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 79si7527622pfr.34.2016.12.16.04.05.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Dec 2016 04:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444584-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-444584-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444584-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:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=eVAA1oMDAapWe84MFx//RQBOnvISPzlTr12SdMLEh0XKKXfuvY cJkrUwQeLxPyQyKwfSpak+JAeeQtTwGe/C6lOS2S0czMu5MpDMuXefinEPPzxLdQ QvrbC2s2v02gRuVV5tHwpmvCtOL3eGsM03UHOy0UYekRSK7/s5OojjzA8= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=KseYJ2alclW5hKNK7SYgH3+6Qq0=; b=peuN2M8J3kHnS3flKu9u V7l6lGTnTlOsSeOxGz0CY2J1/M2xBywonUd4oUgbHNmN24QDU5ZNnQxO+WggL8wb yNWV4BqrmBlebZduL8sdXLK92dfnaGsmRMRoDShjmgoHbOqXIOZEBh9lFjt58mR/ Q4eyioMiA0BTGs/GS1dq/8c= Received: (qmail 80266 invoked by alias); 16 Dec 2016 12:04:51 -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 80256 invoked by uid 89); 16 Dec 2016 12:04:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Dec 2016 12:04:40 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6AB28AAB7; Fri, 16 Dec 2016 12:04:38 +0000 (UTC) To: GCC Patches Cc: Jakub Jelinek From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Do not sanitize in lower_omp_target context (PR, sanitizer/78815). Message-ID: Date: Fri, 16 Dec 2016 13:04:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 X-IsSubscribed: yes Currently, use-after-scope relies on fact that entry point of gimplify_decl_expr is gimplify_function_tree. Fixed by checking if asan_poisoned_variables is non-null. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin >From 6acf276399b574ced231096eb1eceb32771118e3 Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 15 Dec 2016 18:23:24 +0100 Subject: [PATCH] Do not sanitize in lower_omp_target context (PR sanitizer/78815). gcc/ChangeLog: 2016-12-15 Martin Liska PR sanitizer/78815 * gimplify.c (gimplify_decl_expr): Do not sanitize in lower_omp_target context. --- gcc/gimplify.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/gimplify.c b/gcc/gimplify.c index b738855a637..02c6eea638b 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1619,12 +1619,17 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p) is_vla = true; } + /* If gimplify_decl_expr is called from lower_omp_target context, then + asan_poisoned_varibles will be NULL and we do not want to sanitize + in such case. */ + if (asan_sanitize_use_after_scope () && !asan_no_sanitize_address_p () && !is_vla && TREE_ADDRESSABLE (decl) && !TREE_STATIC (decl) && !DECL_HAS_VALUE_EXPR_P (decl) + && asan_poisoned_variables && dbg_cnt (asan_use_after_scope)) { asan_poisoned_variables->add (decl); -- 2.11.0