Received: by 10.213.65.68 with SMTP id h4csp75087imn; Mon, 19 Mar 2018 20:11:44 -0700 (PDT) X-Google-Smtp-Source: AG47ELu/t1BxwX1Sni+Rma9I+IFsx2LAY13Xvj3N3EEi52FAFG/1Ksoz9XJHU7gilWZR16+kjBku X-Received: by 2002:a17:902:70cb:: with SMTP id l11-v6mr14563976plt.192.1521515504129; Mon, 19 Mar 2018 20:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521515504; cv=none; d=google.com; s=arc-20160816; b=nKpGhtNJ3zirlU7VT0P8B8rLn4y0UoUcWBJYfEJFzrp+AIg/mMZUY/NSOgR8vucKcm YAfcQupgSRBSxTmVEn9fRH5J8wFRJvumC/pFtutRDXeHl6RGkbuCZYaIXB6nn43wKpUZ v0F39O/FpgJlSE9wmkteENlCOFMsYO1is+xno6f8crMAGsR7x9QjS54WEvL8zMcZPI03 0xUzo/13eb1igAOJPgTn7q3qmodAz08g2xNzJUv8EwsBaPmVOTXkBBRVPTvtZfBgVlIA JJjrirsD0iBDG61PDCLQPzfp1xiv4dLTPLU50VWJ52C+ORuHnSQX8CCUfrVn164nFwPk 83fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=OTv8nFhMmaKR0uFi5wqmC3CbIlISij8Kn4L/bJTGf/w=; b=p4s1ORyAWueB8iSmNLjA7ci8akHdMmzjpWGmWP0pOfMUzG/kuajVORWNjeKQfXwelK vwMayF5nKJnQeqEg8HXiQ9B6FEd0AljO+M7NORp6pVZiKvKfzL8M11e+xYVS9+KWL6OK KCktEyUv3gnkyT/2ySBUEkGqol4rroEahi/lvlV8aIYNXFkxGybvGmprgDZGvTViJAcm MlgScaWYVBHBLAOurRXwKQrN+s0eTYRxwfszPMBzXdAGYVvXTOnhtqMDBGUuk6PDzz0E zyGieCgU2+Te9Lmifhjmv2W/R2qFlrlCQ6d87tcKVTuoorWkpWymGXYLtV9Egxub3fQZ BSAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=NMinMgtK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3-v6si688138pld.384.2018.03.19.20.11.26; Mon, 19 Mar 2018 20:11:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=NMinMgtK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751549AbeCTDKR (ORCPT + 99 others); Mon, 19 Mar 2018 23:10:17 -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-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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: 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 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