From patchwork Tue Oct 3 18:32:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9983349 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 5706B60365 for ; Tue, 3 Oct 2017 18:32:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3961128A0E for ; Tue, 3 Oct 2017 18:32:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C8D328A12; Tue, 3 Oct 2017 18:32:49 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 6A4D728A0E for ; Tue, 3 Oct 2017 18:32:46 +0000 (UTC) Received: (qmail 26069 invoked by uid 550); 3 Oct 2017 18:32:44 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 26031 invoked from network); 3 Oct 2017 18:32:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=HQZOkqE5P7YrlrRYlvxQwfZnvs0kgZm4JiBEMAYTtTU=; b=hsvoSQKcfg+01ozUNBjtnxtVmuUlcF9x56ht6bU8xkZqPswTDkzVPb4HJE6IHisNXO oKD6bUgkuGrdh7ppUCYPZG4I4jkmBOYYBhGYC41O2/x1QsyVU9Bdhi+L8VshlVeMoKPH fFTTS1309haF3J/RYT3IhVykVjHjoFrFRUtT8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=HQZOkqE5P7YrlrRYlvxQwfZnvs0kgZm4JiBEMAYTtTU=; b=J3A7UCczuHIEHSWqPLTaiATlA2LM2fbc6Zh6OGkncPkYg1J6WvSwEk3Pf4KU88cs+z 1PSyXN2otsDt+ZtJHHWlGInlHpEyhhurXTz4IsHog4n44UsOOK0atCSYyYTPy0pcfaUL EiPlCOlH0JONzSReXsQ4Y804P4Z1pJ/HzreLhLI6c0ZYTGNe+/StvVTEzJe2IJ2GFTe8 ZUaDEjXZFH8TGrcWVyXVUf0FJoZCePUm74MxPI8SPAtzwRi8tU+cnEKr42x17gQG5bV1 vgfR/J8X/JDVGowT9sFXIZJw2IBQ2XG0OsXxjCmJwwU8hFZVne04AoHV2zZ4FEQdma1x 91+A== X-Gm-Message-State: AMCzsaXj44WvmUnm4N40aMPFgB+Hfh2MjM3gk3ZBtOz13AV0Sq/F1BLL 4s2VohrUZCTv8db+3gMx3Tt1iQ== X-Google-Smtp-Source: AOwi7QBQ+TKAN+5HpOvi4psRNh/hULIWJlL1zy1UZOmemCBjsjYZ5DfsTuZrTbfg6jTkv0NREsHGwg== X-Received: by 10.99.138.76 with SMTP id y73mr9459570pgd.124.1507055551884; Tue, 03 Oct 2017 11:32:31 -0700 (PDT) Date: Tue, 3 Oct 2017 11:32:28 -0700 From: Kees Cook To: Andrew Morton Cc: Mark Rutland , Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Message-ID: <20171003183228.GA142273@beast> MIME-Version: 1.0 Content-Disposition: inline Subject: [kernel-hardening] [PATCH] Makefile: Fix CONFIG_CC_STACKPROTECTOR_AUTO to not enable SSP X-Virus-Scanned: ClamAV using ClamSMTP There was a think-o in the logic for CONFIG_CC_STACKPROTECTOR_AUTO, which would leave CONFIG_CC_STACKPROTECTOR defined when a compiler didn't support stack-protector. This usually won't cause a problem with a build, but it's not correct, and shouldn't happen. Reported-by: Mark Rutland Cc: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org Signed-off-by: Kees Cook --- Andrew, if possible, can you squash this as a fix for the mmots patch "makefile-introduce-config_cc_stackprotector_auto.patch"? If not, that's fine. --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9bd334b35003..2f8ff79fa9a5 100644 --- a/Makefile +++ b/Makefile @@ -693,14 +693,18 @@ else endif endif endif +# If stack-protection was requested (and available, in the case of _AUTO), +# then prepare the build for it being enabled. ifdef stackp-name - # If the stack protector has been selected, inform the rest of the build. +ifneq ($(stackp-flag),) + # If the stack protector is active, enable code that depends on it. KBUILD_CFLAGS += -DCONFIG_CC_STACKPROTECTOR KBUILD_AFLAGS += -DCONFIG_CC_STACKPROTECTOR # Find arch-specific stack protector compiler sanity-checking script. stackp-path := $(srctree)/scripts/gcc-$(SRCARCH)_$(BITS)-has-stack-protector.sh stackp-check := $(wildcard $(stackp-path)) endif +endif KBUILD_CFLAGS += $(stackp-flag) ifeq ($(cc-name),clang)