From patchwork Tue Mar 20 03:10:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10296177 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8470960385 for ; Tue, 20 Mar 2018 03:10:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7543F291D6 for ; Tue, 20 Mar 2018 03:10:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 694B1291F0; Tue, 20 Mar 2018 03:10:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D794291D6 for ; Tue, 20 Mar 2018 03:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751468AbeCTDKQ (ORCPT ); Mon, 19 Mar 2018 23:10:16 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:42188 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750921AbeCTDKO (ORCPT ); Mon, 19 Mar 2018 23:10:14 -0400 Received: by mail-qt0-f193.google.com with SMTP id q11so179097qtl.9; Mon, 19 Mar 2018 20:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=OTv8nFhMmaKR0uFi5wqmC3CbIlISij8Kn4L/bJTGf/w=; b=NMinMgtKErCVs40lGetJ6krwMbyhkb8KIKnPv5q7eqZkQF/iOHiou8ku/2Xf6vAyhx GdAMwJyH0GVVEzjmgcBF+WqFdfs5QruhQ51+8HvtjjJ0X+7I0GKos7joQray8+QqA3oN srCkVL6aN6b3JEQH8pt18APobDXp4P9Pz4r65DW6r5euiRIvYPMPgmqjQWwNvsO7tFkg t/3v9b3pstLTc6wF7Krkcm2ggnwDltaVxHvFqufNB/0utDWGnUwjEOryf32JfREBilqA rvkoubB2SoL7ThW8QcT3PNPsyYREPnMzgIrPknel15edQzR2S2l1DrHVk+zMDxzQthxj H7pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=OTv8nFhMmaKR0uFi5wqmC3CbIlISij8Kn4L/bJTGf/w=; b=poHBeTZSVF3lydg7WLorJsEJ2G/ykvPrx+5+PnZiFKsFUiOSBkh6YBKcTbPCS/Uwm/ R7JHIACyqVNo8/pG6hr4z7JcWfB5Axj0YhiFEzbqRtW7LTBuCopwT7jYsSjXuQIDQVPO 3M033A6Hmk5+6pW7pcTdoYZ0RrstirJ01JOpd4XnubZ5bqHWRXQUqyPaPyGlbydqAjA4 Kv2ekNftjmLXAHyjteyE7kv5ZfWfAWCjQViqphrHAFfaITWT1pm4D49fNRFcyF9FxRm9 88ABjM/F45huusi+FenD6WI8g3fZlClAUU/f/+PyVhxltHaXDSBD1e2XQlUBIpD1M9br GgNw== X-Gm-Message-State: AElRT7ELEDhyI08+naDmRFKhnBiVGW4IiyFfhBwuQrSN5qz1NbVFf64i eJC42/WT0gYHvDZfR6vI/wjeVex2V0SgVrvaSO4= X-Google-Smtp-Source: AG47ELvs0qhFUJwHBlVEia4edOlAVtVDNbjAf+VLbVXMvAiYHG4/U3Af9dv2BZWh43t7JZaL/Y6rCHW1afbFcRRdrnU= X-Received: by 10.200.56.177 with SMTP id f46mr22740314qtc.9.1521515413066; Mon, 19 Mar 2018 20:10:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.185.46 with HTTP; Mon, 19 Mar 2018 20:10:12 -0700 (PDT) In-Reply-To: References: <1521174359-46392-1-git-send-email-keescook@chromium.org> <20180316175502.GE30522@ZenIV.linux.org.uk> <42b4342b-aefc-a16a-0d43-9f9c0d63ba7a@rasmusvillemoes.dk> <38b6da49-1138-017e-7307-f39ff067d6d2@rasmusvillemoes.dk> <0e94e9582bec4373b5e21c612be179ac@AcuMS.aculab.com> From: Arnd Bergmann Date: Tue, 20 Mar 2018 11:10:12 +0800 X-Google-Sender-Auth: 5Q0Lx5VtBJc2X9EAJQHvD9nAgHY Message-ID: Subject: Re: [PATCH v5 0/2] Remove false-positive VLAs when using max() To: Linus Torvalds Cc: David Laight , Rasmus Villemoes , Kees Cook , Al Viro , Florian Weimer , Andrew Morton , Josh Poimboeuf , Randy Dunlap , Miguel Ojeda , Ingo Molnar , Ian Abbott , linux-input , linux-btrfs , Network Development , Linux Kernel Mailing List , Kernel Hardening Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Mar 20, 2018 at 7:29 AM, Linus Torvalds wrote: > On Mon, Mar 19, 2018 at 2:43 AM, David Laight wrote: >> >> Is it necessary to have the full checks for old versions of gcc? >> >> Even -Wvla could be predicated on very recent gcc - since we aren't >> worried about whether gcc decides to generate a vla, but whether >> the source requests one. > > You are correct. We could just ignore the issue with old gcc versions, > and disable -Wvla rather than worry about it. This version might also be an option: Wiht -Wstack-usage=, we should get a similar warning to -Wvla for frames that contain real VLAs, but not when there is a VLA that ends up being a compile-time constant size in the end. Wstack-usage was introduced in gcc-4.7, so on older versions it turns back into Wframe-larger-than=. An example output would be security/integrity/ima/ima_crypto.c: In function 'ima_calc_buffer_hash': security/integrity/ima/ima_crypto.c:616:5: error: stack usage might be unbounded [-Werror=stack-usage=] Arnd --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Makefile b/Makefile index 37fc475a2b92..49dd9f0fb76c 100644 --- a/Makefile +++ b/Makefile @@ -687,7 +687,8 @@ KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \ endif ifneq ($(CONFIG_FRAME_WARN),0) -KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) +KBUILD_CFLAGS += $(call cc-option,-Wstack-usage=${CONFIG_FRAME_WARN}, \ + -$(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})) endif # This selects the stack protector compiler flag. Testing it is delayed