From patchwork Wed Dec 7 18:44:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Vyukov X-Patchwork-Id: 87159 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp467616qgi; Wed, 7 Dec 2016 10:45:49 -0800 (PST) X-Received: by 10.98.33.133 with SMTP id o5mr69137765pfj.32.1481136349443; Wed, 07 Dec 2016 10:45:49 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y186si25126904pfy.31.2016.12.07.10.45.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Dec 2016 10:45:49 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443717-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-443717-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443717-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=REJECT dis=NONE) header.from=google.com DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=focPEVNALOr4BgQ3eJyDIkTn2qmxGGePt71rwyzEREJw9H smbHBEZdlbNxINm8PsrPHhByptJdw7839/lT3t8dRj/haW0X16aaXM7Bm6u4E2qQ 5sBUN1q1RKC1vgGmjkBRthAS0xEmXonmUj/zRSfqd0IBhD0qo31Jw0BbtvidQ= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=aA2z4t9GXEsMESicQTZQcCNapUs=; b=U4y8yyZ4OyCze6x8pG/P kSXxBbKZ6qyvDCWORD3tISxGzKuh937AS4o3RyUzoAnG39oIXawrb5DQbM4frm/i /CwRpLw6D+ugWzv5C2hN7NtdnPiXBBt2MTllFQYL8jbyDQzFWpGvKqCz3dssa5Da Vhya6UAkDh87Mlvui71qfJM= Received: (qmail 66001 invoked by alias); 7 Dec 2016 18:45:34 -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 65814 invoked by uid 89); 7 Dec 2016 18:45:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, KAM_MANYTO, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1659, H*Ad:D*googlegroups.com X-HELO: mail-wm0-f48.google.com Received: from mail-wm0-f48.google.com (HELO mail-wm0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Dec 2016 18:45:03 +0000 Received: by mail-wm0-f48.google.com with SMTP id a197so181800879wmd.0 for ; Wed, 07 Dec 2016 10:45:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=dy2gi9xxFpdKQms84Q2KoHhgYPhFoU7jWlw1EArtD2k=; b=i9q39PsTaKYdXNpPz5PHfSPfmjyzHpyF0Y91ocDQwbmYaybE2ZYtfCY6Uqi8aEmozO SxleRQJWL8JybBVxUNqApqLVp656e/+oMt0bJP3WWV4+tSS6vwBZlp94plJsl9pXKgo8 XFgTrciAzElLjGM89bYTzMCsPKiL5o9JK2ey+kjYF/ych+cOWBExQBk7xroA1/g06OuG 14LyPzHsmv3iMnWAIL8NC9xJC9DzNuIxMRXEsCX9hrMoHGtx0mAeKdrXBn22TRmHGNQx VNGI6eEMaF6np6ZEZFfJJdDRrc+0rjjuFjmnk5w4ybn/Nv5Lf5hkY5mqJP6dhwEN7XuZ 7TuA== X-Gm-Message-State: AKaTC03Kzo8kAp3PMLYv3Hosk7QW8sFJJY1yFEyW7L/zkkwIJsDkX1svbGNxFgnRlw9GwBU6luLXhKGyYrbY5yLc X-Received: by 10.25.23.25 with SMTP id n25mr20541469lfi.152.1481136300569; Wed, 07 Dec 2016 10:45:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.183.238 with HTTP; Wed, 7 Dec 2016 10:44:39 -0800 (PST) From: Dmitry Vyukov Date: Wed, 7 Dec 2016 19:44:39 +0100 Message-ID: Subject: [PATCH] Enable -fsanitize-address-use-after-scope only if -fsanitize=address is enabled To: GCC Patches , marxin , Jakub Jelinek , Marek Polacek , Andrey Ryabinin , kasan-dev , Alexander Potapenko , andreyknvl X-IsSubscribed: yes Hello, Revision 241896 added -fsanitize-address-use-after-scope and enabled it whenever any sanitizer is enabled. This caused problems for kernel which does not have necessary callbacks for -fsanitize-address-use-after-scope. I've added the callbacks to kernel tip, but older kernel branches still don't have them. So enable -fsanitize-address-use-after-scope iff -fsanitize=address is enabled. In the kernel we will check if -fsanitize-address-use-after-scope is present and enable it only on versions that have the callbacks. As a side effect this also doesn't enable -fsanitize-address-use-after-scope for e.g. -fsanitize=thread, which is I believe unnecessary. OK for trunk? Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (revision 243344) +++ gcc/ChangeLog (working copy) @@ -1,3 +1,10 @@ +2016-12-07 Dmitry Vyukov + + * opts.c (finish_options): Enable + -fsanitize-address-use-after-scope only if + -fsanitize=address is enabled (not + -fsanitize=kernel-address). + 2016-12-07 Bin Cheng PR tree-optimization/78691 Index: gcc/opts.c =================================================================== --- gcc/opts.c (revision 243344) +++ gcc/opts.c (working copy) @@ -990,7 +990,7 @@ /* Enable -fsanitize-address-use-after-scope if address sanitizer is enabled. */ - if (opts->x_flag_sanitize + if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS) && !opts_set->x_flag_sanitize_address_use_after_scope) opts->x_flag_sanitize_address_use_after_scope = true;