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: 703713 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 3tYnWD0yJ0z9t2n for ; Thu, 8 Dec 2016 05:45:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="whU6Bb5I"; 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 :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=m4UMtYG01QOJAeYILUYH8UjZfYR66JHfS/rRv0X/c4sUV5 kfeLFf5uN7EQl1ru0Blwwk8NPQ14WYiwz87b6FGmzZD3lKYpVcPskuVRxjsDf05P XeW6Nkj2o7OZ1DxPdBUKRD8froJXmhZL+xmJV93ULxw/5G1p7BEvbL5TvwR0I= 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=whU6Bb5IJQR5DtIEofa2 Wsl45ubDPWAEeEHnBIV7AzE9B8BmSEvqRvFQRI9H6M3UIah9vzDx+DsIECFxpbiy a61kh6uysS2vXQWn8GLmELpEaJWn9XjIj4vRFf1jLJZy6M2mbZ4K/ixHqVIylg/X khMzKSY76aBRUkdfpqE2+NM= 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;