From patchwork Wed Jul 11 20:36:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10520431 X-Patchwork-Delegate: snitzer@redhat.com 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 34DC9600CA for ; Wed, 11 Jul 2018 20:36:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09F662955E for ; Wed, 11 Jul 2018 20:36:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F21B42932A; Wed, 11 Jul 2018 20:36:53 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 908AE29541 for ; Wed, 11 Jul 2018 20:36:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE5B932B663; Wed, 11 Jul 2018 20:36:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 892F31001F3D; Wed, 11 Jul 2018 20:36:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4886D18037F2; Wed, 11 Jul 2018 20:36:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6BKaYY7014849 for ; Wed, 11 Jul 2018 16:36:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 93CCC16E26; Wed, 11 Jul 2018 20:36:34 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88E6719485 for ; Wed, 11 Jul 2018 20:36:34 +0000 (UTC) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C91873082A2B for ; Wed, 11 Jul 2018 20:36:33 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id k3-v6so3219011pgq.5 for ; Wed, 11 Jul 2018 13:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zbkP//JFKhVRhh8B5f8winKslJMgyIBJ8s7W/9N89AE=; b=fuPvhDmyzhG8j+GJ5IeIi7yZeY/GqMYyert8l2k//jXMBO3sU0SDBGII8thD440TLL H7E1gaHn3R6Iyp783UtiV3WLnEncJCEBAtL9to9l+o9L6/TJ41cezeme41IseUe+4oT+ clkBXCvHTpVBRlYWPBpF4E5J8jAi4DjUZNhBs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zbkP//JFKhVRhh8B5f8winKslJMgyIBJ8s7W/9N89AE=; b=YgrQHsh036axiEOl+KTyqFLe9wFIp2RBMlzCiGLlIBmgdSKg0RznOHVQShc8Q54D89 itSs7y4tAgklSrlqKI+YgMhtP1quOmWCcfCInX41rnX+pB02GMZR+qcFkqZUu2OXsAp+ 2gf93ZFMmqTxNcw7KawJj5gz6imYLMb/WTZJTFOVTdEdXKYLs9ybTLbYQKUycIdalyEP G1ny5oHKyH5skyDesH2FXpJ5UOil4xCrZu84cXH8i2CbSsjoK4jqFrGhiDpdzSKb/uQp hylhqifMVaDjLbJqqgcWIIv6rgUO/2kzLzkGvo2JoF347xFTgxKBZhKgaRZ1sBW422qK PAQQ== X-Gm-Message-State: AOUpUlGPvwXRY/QR4cZ47qbL0o6O/Io5WPcDiH67H3BmF86xJRJbPKRd IDWX6UgZLvvxfhEaEF3njUK+xQ== X-Google-Smtp-Source: AAOMgpepV5D3hXGjQPONIQWKHnKjYnMEWl4+AlUQZK99ilxTACsZh9+0+dEBeo0kkAvkBrSh5sgV+A== X-Received: by 2002:a62:c699:: with SMTP id x25-v6mr180974pfk.16.1531341393327; Wed, 11 Jul 2018 13:36:33 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id y85-v6sm17725654pfa.170.2018.07.11.13.36.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 13:36:28 -0700 (PDT) From: Kees Cook To: Herbert Xu Date: Wed, 11 Jul 2018 13:36:15 -0700 Message-Id: <20180711203619.1020-11-keescook@chromium.org> In-Reply-To: <20180711203619.1020-1-keescook@chromium.org> References: <20180711203619.1020-1-keescook@chromium.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 11 Jul 2018 20:36:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 11 Jul 2018 20:36:33 +0000 (UTC) for IP:'209.85.215.193' DOMAIN:'mail-pg1-f193.google.com' HELO:'mail-pg1-f193.google.com' FROM:'keescook@chromium.org' RCPT:'' X-RedHat-Spam-Score: -0.131 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.215.193 mail-pg1-f193.google.com 209.85.215.193 mail-pg1-f193.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.45 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: Giovanni Cabiddu , Kees Cook , Arnd Bergmann , Eric Biggers , Mike Snitzer , "Gustavo A. R. Silva" , qat-linux@intel.com, linux-kernel@vger.kernel.org, Masahiro Yamada , dm-devel@redhat.com, linux-crypto@vger.kernel.org, Lars Persson , Tim Chen , "David S. Miller" , Alasdair Kergon , Rabin Vincent Subject: [dm-devel] [PATCH v4 10/14] kbuild: Introduce FRAME_WARN_BUMP_FLAG X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 11 Jul 2018 20:36:52 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP When building with CONFIG_FRAME_WARN, it is sometimes useful to give certain compilation units small additional headroom. This is normally useful when VLA removal exposes a large stack allocation, especially with FRAME_WARN at 1024 or smaller. This adds 20%. Signed-off-by: Kees Cook --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index c9132594860b..06fe93edd052 100644 --- a/Makefile +++ b/Makefile @@ -684,7 +684,13 @@ endif ifneq ($(CONFIG_FRAME_WARN),0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) +# Small code (mostly exposed by VLA removal) needs some additional +# headroom, especially for a FRAME_WARN of 1024. This adds 20% which +# can be used by the CFLAG_FRAME_WARN_BUMP option. +FRAME_WARN_BUMP_SIZE := $(shell expr $(CONFIG_FRAME_WARN) / 5 + $(CONFIG_FRAME_WARN)) +FRAME_WARN_BUMP_FLAG := $(call cc-option,-Wframe-larger-than=$(FRAME_WARN_BUMP_SIZE)) endif +export FRAME_WARN_BUMP_FLAG stackp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector stackp-flags-$(CONFIG_STACKPROTECTOR) := -fstack-protector