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: 9983345 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 50C6E60365 for ; Tue, 3 Oct 2017 18:32:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E74528A0C for ; Tue, 3 Oct 2017 18:32:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 235C128A10; Tue, 3 Oct 2017 18:32:34 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 7F9BA28A0C for ; Tue, 3 Oct 2017 18:32:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751101AbdJCScd (ORCPT ); Tue, 3 Oct 2017 14:32:33 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:55292 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812AbdJCScc (ORCPT ); Tue, 3 Oct 2017 14:32:32 -0400 Received: by mail-pg0-f53.google.com with SMTP id c137so5175987pga.11 for ; Tue, 03 Oct 2017 11:32:32 -0700 (PDT) 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=DKS+nfV6iIRCMqSZMf8eYx9PAzIbIR+O8zvXD0cOudSBlB1Ji6z0aSHk9f08F+hg53 SPo9mn0l0bLBM8aIOJKwNvDgIOhlhJW2jVLesEsziTreCNpphsyGH0NUyRpcO30OMhRt 9PcPcZunmNZzc0Y5hPsVpedbWMPFWJ4tQlnXx5gpSrztbXx655/mXNFlk2h7XsE+rgjn WeTJZuhSQxo7r3qv1Cxd/boEYygULqql7J+mrIi0fQumpj2McCvTKD47JwU9TbZTTo6V uqMef8wSWqA+gSTwhGFTLAk3uUtw5KztEEW47s+0xupOwfcMQoHL0bpUJQtHe/IwRvjo O2jw== X-Gm-Message-State: AMCzsaU08M596ZxofAbcc8fGlLvVdrY5ei+BBDmxxr5ZygOBmzXlpWa/ Mbb1/UZxail26TGjaoCAKLFP+w== 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) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id j12sm8153436pgs.35.2017.10.03.11.32.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 11:32:29 -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 Subject: [PATCH] Makefile: Fix CONFIG_CC_STACKPROTECTOR_AUTO to not enable SSP Message-ID: <20171003183228.GA142273@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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)