From patchwork Tue Aug 30 23:31:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 12960134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64C52ECAAA1 for ; Tue, 30 Aug 2022 23:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=/VuywIKuUHhTW55NXq85jjKzBCyNZ5//ePmgdjrK+JA=; b=16y3lO5U1SrEMpIZGov+MK7sXz 7M0WjJ9V7I7bhkmO/am3EgilEjV8gAqYv3q8FU2y7ALx+4uoSImvRYqVE5OTL1f+riqpiSaU6ODu6 oMAbb6JBpdOzvPBAIQgp4UR1q/XyxKHLRLHVZkUfQJbkgdsCTFNVTn94rVFkBzaeWdrv16uCFDk1R auPifq4+7wnHOYK3KgPBSE7hx73nELsSvoSuNfT+UPPCVSAVndun5CnoER4COUGaWWkCtNR0+5hj+ wrwzH6yqSqYRajgTEW915L8AfTHBbZ+GL/ur+vq+CIyRIyvS8kQKH+Vq8bciYYfbhjjWdthPN2YXL AfF+PBog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oTAhv-002Sg6-QH; Tue, 30 Aug 2022 23:31:47 +0000 Received: from mail-pl1-x649.google.com ([2607:f8b0:4864:20::649]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oTAhl-002Sa2-Cw for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2022 23:31:38 +0000 Received: by mail-pl1-x649.google.com with SMTP id k3-20020a170902c40300b001743aafd6c6so8894209plk.20 for ; Tue, 30 Aug 2022 16:31:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date; bh=L25uLgv5hznFOW8C65x6whtc7Tn9BJysM2Vvz8HWyDE=; b=GlyX/udszzm3ETI6dGBsinPgbb2zH2Sx7UXYz/1vjC/nGY+/X7ZLW46uqN3etLOPT0 gV1SaWu+mT9dOl7PKHrdCe9i+XWpddw8gn1LLlyKiAiZDyL18nKBWphU62pG+hJKxRmM u+uoRGf2SWIvXTlojSYkQR+2T7yMZdfaE77HWRA76cmFOBZRkZN023sEPCVRGdvc5u7V WBxTSYiDyS+PUfPxQvu0l+seugBhnhEOip5lzg5qUgw3A6gDkzqA0gqRlSgn+YUgNTBq ekG0EJpcTzqD+Y4jhU0JnnShqvo1JQRejynQVVRjwAZ9ll4kYjRhz7z/Zm+n5si+aKge f35w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=L25uLgv5hznFOW8C65x6whtc7Tn9BJysM2Vvz8HWyDE=; b=Rjl436zNI0FvN3Ec2KoxQ9daoxDVDOlVALSlr1r/GF0fo6JuJa0NFchnCuYl0Av36w AhmvJu2P1xeq3MAEJHhePAgeLJfsQkh2w06MYDAN4mkYFiaUFbOAAkVtw7cAqDMms527 NxQV1II7BLiBAMd7uRQJJ++2RvJPnRJKk72Lp8NRJE2HrVZ5WiQUo9mK16O9xny8CmdX Q2bmXC/iMd+0meuW33SutUhmHtonYZOJ0ruXe3lGtR5KaArgYW6CI+EpDWuzGYJFU3V1 0SYB8SqFRq5wmKYJKqtrOSvwMXtP5y2aHeLnwgnXpPpEOXUCOFlxCas0eI4n4GC87Ay4 hFzw== X-Gm-Message-State: ACgBeo3HHYHS4rKqKFAUZTkZNyb60B/aLWFEm6OHmJ8avLotZSnEz0T1 WBPwOph2IZi6SIJPU0LAje5Ahp9+PL/SjThRthE= X-Google-Smtp-Source: AA6agR6t6+RmUgXGfCDMkXtgpmsLFiEpc19Ih8//1Ts8Vdoix/62fuolHALxDz5NswEPkfsF2/qhJD8nw7h8pAHo2gs= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:54d9:7143:6a7d:91d]) (user=samitolvanen job=sendgmr) by 2002:a17:90a:249:b0:1e0:a8a3:3c6c with SMTP id t9-20020a17090a024900b001e0a8a33c6cmr14044pje.0.1661902295271; Tue, 30 Aug 2022 16:31:35 -0700 (PDT) Date: Tue, 30 Aug 2022 16:31:09 -0700 In-Reply-To: <20220830233129.30610-1-samitolvanen@google.com> Message-Id: <20220830233129.30610-2-samitolvanen@google.com> Mime-Version: 1.0 References: <20220830233129.30610-1-samitolvanen@google.com> X-Developer-Key: i=samitolvanen@google.com; a=openpgp; fpr=35CCFB63B283D6D3AEB783944CB5F6848BBC56EE X-Developer-Signature: v=1; a=openpgp-sha256; l=2946; i=samitolvanen@google.com; h=from:subject; bh=Y2KllNLLe5W3ojqZsH1L8RGIJ3+vQcqt1B34SGCIoIw=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBjDp3LFZnyR8Aq9IX9f3NCTQfZ9PLKXxM9T7+t9pe6 XCRRtGeJAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCYw6dywAKCRBMtfaEi7xW7vF8C/ 0Q2tFR9IU/s09oK/aPYzy2OnR4Fl7grWpQwG8dbDwI9bQFdE58qu5aKvOkH1n5LoPMnx1oiPeKAua8 Xbr93KRYEltkTaD58AlXyUTQVb8W/+WK4z5r0qhm6P2JWbCqvDwg4StkJRSB7vDn+lmR/PA0lfUQob tOp1QJGiNuDLFc0TbTSfqkK/xMXR6a0+FdfMXg20QKWShLiYE7bYKvgl6pguSour1sba5xcznBLxV3 M+9Ri4Nnvzd0QnR7bku4sNbS59EpdZ9c5D6eJjbsmZwIrBklT2i9BvcfHx4n6HCM+M0pWiFtQTUUXK ZDwfY8tjUVanTK7afJi3m5XLWkUlmJhaxk1YjwGK1wpbf+kcj9ykRivZnnU/eqNPtW/jP1Tk3ixLUv ceQHLD74GD+/xpPl9+6/1b0LWdDFc2ephQ2+kiVVS5zMGX+bRduupKomCFdvdHgAf1GrFAJb7iKA9R JE6m9yMp4f9no/FyLoJGQiPKz1klAidmbOixNOnCretWc= X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Subject: [PATCH v4 01/21] treewide: Filter out CC_FLAGS_CFI From: Sami Tolvanen To: linux-kernel@vger.kernel.org Cc: Kees Cook , Josh Poimboeuf , Peter Zijlstra , x86@kernel.org, Catalin Marinas , Will Deacon , Mark Rutland , Nathan Chancellor , Nick Desaulniers , Joao Moreira , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, Sami Tolvanen X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220830_163137_454846_C3702019 X-CRM114-Status: GOOD ( 11.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In preparation for removing CC_FLAGS_CFI from CC_FLAGS_LTO, explicitly filter out CC_FLAGS_CFI in all the makefiles where we currently filter out CC_FLAGS_LTO. Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook --- arch/arm64/kernel/vdso/Makefile | 3 ++- arch/x86/entry/vdso/Makefile | 3 ++- drivers/firmware/efi/libstub/Makefile | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index bafbf78fab77..619e2dc7ee14 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile @@ -40,7 +40,8 @@ ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO # kernel with CONFIG_WERROR enabled. CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) \ $(RANDSTRUCT_CFLAGS) $(GCC_PLUGINS_CFLAGS) \ - $(CC_FLAGS_LTO) -Wmissing-prototypes -Wmissing-declarations + $(CC_FLAGS_LTO) $(CC_FLAGS_CFI) \ + -Wmissing-prototypes -Wmissing-declarations KASAN_SANITIZE := n KCSAN_SANITIZE := n UBSAN_SANITIZE := n diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index 12f6c4d714cd..381d3333b996 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -91,7 +91,7 @@ ifneq ($(RETPOLINE_VDSO_CFLAGS),) endif endif -$(vobjs): KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO) $(RANDSTRUCT_CFLAGS) $(GCC_PLUGINS_CFLAGS) $(RETPOLINE_CFLAGS),$(KBUILD_CFLAGS)) $(CFL) +$(vobjs): KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO) $(CC_FLAGS_CFI) $(RANDSTRUCT_CFLAGS) $(GCC_PLUGINS_CFLAGS) $(RETPOLINE_CFLAGS),$(KBUILD_CFLAGS)) $(CFL) $(vobjs): KBUILD_AFLAGS += -DBUILD_VDSO # @@ -153,6 +153,7 @@ KBUILD_CFLAGS_32 := $(filter-out $(RANDSTRUCT_CFLAGS),$(KBUILD_CFLAGS_32)) KBUILD_CFLAGS_32 := $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS_32)) KBUILD_CFLAGS_32 := $(filter-out $(RETPOLINE_CFLAGS),$(KBUILD_CFLAGS_32)) KBUILD_CFLAGS_32 := $(filter-out $(CC_FLAGS_LTO),$(KBUILD_CFLAGS_32)) +KBUILD_CFLAGS_32 := $(filter-out $(CC_FLAGS_CFI),$(KBUILD_CFLAGS_32)) KBUILD_CFLAGS_32 += -m32 -msoft-float -mregparm=0 -fpic KBUILD_CFLAGS_32 += -fno-stack-protector KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls) diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index d0537573501e..234fb2910622 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -39,6 +39,8 @@ KBUILD_CFLAGS := $(cflags-y) -Os -DDISABLE_BRANCH_PROFILING \ # remove SCS flags from all objects in this directory KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) +# disable CFI +KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_CFI), $(KBUILD_CFLAGS)) # disable LTO KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS))