Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp860726ybt; Fri, 26 Jun 2020 13:22:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzmB/Tg4tcjEMDS8C8Gcjgj/GqyRb9zVCNgCly0XR3iOGwDtp3eZqAQR+HY7QfUJwdazCh X-Received: by 2002:a17:906:5250:: with SMTP id y16mr4126520ejm.3.1593202969948; Fri, 26 Jun 2020 13:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593202969; cv=none; d=google.com; s=arc-20160816; b=D+13bICSmbFK9z4CU1mDFIElnED/jzIhf7oMRlkz+DNd6dagKFB2CCoDt+k/0p6rRC y3ixGEXPsyPyXIdtQH6L3fj0zvil1JOOrTrSFBGVmOEDQw6EWLdcVjsVi2HdD/CcEKcV 86YLyBC2PLm4eelPO3SQKYKoSjFSMALlcbxoFRkRB94eeGrMp/5B0wvxVTdJlFPNRReo 7IOF/8tHuJziSYmUAInb7i0r0pM1M0HVnWThGp4Cf3Vng3GHjiZ9NO3vNDqHaPf40bQG vO8+I8EopUFl5mXlff5FUHjuB8jhbsLeGfL3uCi9sE9bqjighPjkY1QyshuHuk+C8z6Q sExg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mCCNxLWvOEPbR1jlpJw8AgOuTdUdrqJ6GuWfi7uxTow=; b=SfwH+uWIURj4AM+dGoCJanEtnWIHEbgE9NU9kq6FIbJfU0LOv/1rCMwYthBf7C/ggl 0wR4nUYQidXIl15xaT6KJcG/xrWr/rRVNMRj6XasGEkutHeI99RcF6DUbQD8wFR9LwIa HzqMyFVkbgFXcoFm0mRHKP0mZAXMRIRLwvUAc1VYJyW+lrUVFKS+KvJvzaYZCWzrBxJC d8yCqnb3t6nb8K/qXgUgzNpi4hDAfI19tL+biCkQp044WLesesD3wmWTzOHrfJ8Qk9GW 5D2wKtE+zygg0Hmvg7szTCOoY9EOv/hbkaTF+Fl3T1Ozqh4o7sKT3n7Uh0lWP7LU5ngj 8Etw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QypkpiSs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y3si18457607edm.183.2020.06.26.13.22.27; Fri, 26 Jun 2020 13:22:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QypkpiSs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725958AbgFZUVx (ORCPT + 99 others); Fri, 26 Jun 2020 16:21:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725780AbgFZUVw (ORCPT ); Fri, 26 Jun 2020 16:21:52 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10FA0C03E979 for ; Fri, 26 Jun 2020 13:21:53 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id j1so5098274pfe.4 for ; Fri, 26 Jun 2020 13:21:53 -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:references:mime-version :content-disposition:in-reply-to; bh=mCCNxLWvOEPbR1jlpJw8AgOuTdUdrqJ6GuWfi7uxTow=; b=QypkpiSsx4NUwMWxcUn+8hePyF1+R2042GPj2XUDzNHJadpb6r+7aOaNBGB70MTNuG MLJtSscoNogqziRuqfrwx+9ELZoJAm3hPZrH7CiW+G/4HKkqtcUubzBzcLxs9Ny9D6yK UZOoZ/Iy2mRWZiJ2nV3raq74FOeM7j5zXApjI= 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:references :mime-version:content-disposition:in-reply-to; bh=mCCNxLWvOEPbR1jlpJw8AgOuTdUdrqJ6GuWfi7uxTow=; b=SJr3I1Z6DuY90n99G18Vu9KLoyVnVXBBLS/QROqFHtDMWgsGKVsX9KlK3Vu68R9QAp /TAuE39hIMMcEKDcup+OGZ4fo6SOktGAAyQXDt9tyyQ8ljuBzh/0IBO4167ug+6j5VNL lFpKLP63Xzs8ldiH77tZdWoQbHCSXEwIko04pwwaY7drMuK1On6gkeqm/yjZcQMfDbwx VvmZlPm2btJ6yqFzFWAuJjxcIITPK/0fPYQBYBC952URHV1WiWu3V6RfgZqjK8aAocD0 M22TCjjhlflP4ATOpN89N4iCg9pcGduZqsh65G/0uzFcsazasZUkEsW++vr3qgU9ueLR L32g== X-Gm-Message-State: AOAM533SDfztcQpmIiGJXOzBwfv6x76gjrry+NpjHUBinBz2yBnjIRNZ q9di8IcRHylUIKd+qtwdPiFajA== X-Received: by 2002:a63:1910:: with SMTP id z16mr441252pgl.50.1593202912639; Fri, 26 Jun 2020 13:21:52 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id o8sm15798576pgb.23.2020.06.26.13.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 13:21:51 -0700 (PDT) Date: Fri, 26 Jun 2020 13:21:51 -0700 From: Kees Cook To: Nick Desaulniers Cc: Masahiro Yamada , Linux Kbuild mailing list , clang-built-linux , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , linux-efi , LKML Subject: Re: [PATCH 1/2] kbuild: remove cc-option test of -fno-stack-protector Message-ID: <202006261319.F130204@keescook> References: <20200626185913.92890-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 26, 2020 at 01:13:20PM -0700, Nick Desaulniers wrote: > On Fri, Jun 26, 2020 at 12:00 PM Masahiro Yamada wrote: > > > > +++ b/Makefile > > @@ -762,7 +762,7 @@ ifneq ($(CONFIG_FRAME_WARN),0) > > KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN) > > endif > > > > -stackp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector > > +stackp-flags-y := -fno-stack-protector > > stackp-flags-$(CONFIG_STACKPROTECTOR) := -fstack-protector > > stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong > > So it looks like the previous behavior always added > `-fno-stack-protector` (since CONFIG_CC_HAS_STACKPROTECTOR_NONE was > always true), but then we append either `-fstack-protector` or > `-fstack-protector-strong` based on configs. While that's ok, and you > patch doesn't change that behavior, and it's good to be explicit to > set the stack protector or not...it seems weird to have > `-fno-stack-protector -fstack-protector` in the command line flags. I > would prefer if we checked for not having CONFIG_STACKPROTECTOR or > CONFIG_STACKPROTECTOR_STRONG before adding `-fno-stack-protector`. > That doesn't have to be done in this patch, per se. No, it would add only what was latest and most selected. (They're all ":=" assignments.) If CONFIG_STACKPROTECTOR_STRONG, only -fstack-protector-strong is set. If only CONFIG_STACKPROTECTOR, only -fstack-protector is set. Otherwise -fno-stack-protector. -- Kees Cook