From patchwork Fri Jun 10 23:34:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 12878196 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 7FC4ECCA47B for ; Fri, 10 Jun 2022 23:36:58 +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=98ZlQkmqhfFQnEwUWsMBlMUpbcwtndyhPKpeJP97stk=; b=zfDxIuTSl6TJApJ22oPWz1GUyy Udkd5iQgpjALbR+zgkxnpAM+0hIZ12K0TRvAmTHl32lRszmQFRKkM1B/qV3cw3pbSofFsPIODJm1Z qXYFBzymFRsjRww1nRVPtcLDIvNp14dsSpxbUhBDkFqEjqE8EJ6/1wRt3277CycNOp70wgHh2PDUo 77t/0B/ZF28tv7wjfMil/iEzGPU47LA4XXZcjSpSPkRmGAAzaQa74Xzi8xLEdbAbbqGoprO0LXsTF i0RfvvWfPEZfgyd22wecy6svUxxyWzcZeWbaPwcwvXiSPx/qUYltS+8R+IGihCrlsCnu693UXSQks 71blkMBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzoAB-00AQuh-Hm; Fri, 10 Jun 2022 23:35:35 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzo9w-00AQlx-PM for linux-arm-kernel@lists.infradead.org; Fri, 10 Jun 2022 23:35:22 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id k73-20020a25244c000000b0065ca88b381aso579698ybk.2 for ; Fri, 10 Jun 2022 16:35:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=f3tp75L0usvR7/HEBHFbI6zWEipD9O6WfG/DwXt9RxU=; b=CpMvF4+7DFsMpHOaBEWCwgkIhWmhi/au92bxFtbtvPGRHAWy6+tq7ZwZu3TPPp6veI 1/W4RvU4He66Cv/fRAUzOJbwPqP5t/6+n5lMIDjhd1533RUb8ih5FjbIPmGUMeaW8jIf xU7gRrLWGIVRD9KJKZ03AfCUIOIwFJXlqCXEEOrkTVeNd+8a/E4LGyBX3oKhbXxWT5B3 csHoZBf1G2k0NQEQX8j1k2TI/Q9kBr2M2OXzy7ksKoBCKvBOmItjQBca8AAX48N2bG++ S5ZYPEoMCY3S9ogw7q+CbyHd6CRL9UyVEsIUbUiKKnt2MraU/Shg+/CeAMN1ytZR8AGm UbFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=f3tp75L0usvR7/HEBHFbI6zWEipD9O6WfG/DwXt9RxU=; b=PzcDr9oXvrBfW4Zr6wVbVS9sBs/lDMJcKnVdakE/NZwZH/9U6e2HtERnJrAW47QeUo JNgT1qlFLPh6qQRJU/Irxwm/D3SgzqkZRDIL6BnsCS/oq0+KMNn/TT2pL85uG5AV5Bu8 Ya2Kr5Obrk5BlOfH7g8rDxVkuHi2PdHNUSc7DpfPqDCtsPjg0Y8rgBOaJ8GzebMLZ3ei Hwcd+rzSFr0SuQLmDqHW/n/QED11EPmzqQbJiqVZlRw53JdLmCR2+IRiCqjktQFljRYZ TLB7chCht9v2DrFySoihPPm7mBXNqOll3ZtmjLVrpKHzD6gNHfw3xKqhw4QPAcYFrAD/ 7z5w== X-Gm-Message-State: AOAM530kwhc6ZE2hxaA1hYdcyMtb6iEZ2NfR8WrbFnNMXydBuwCF2/TF L7fNXQPF7Utk1FtdS5/+gjB9SBvDYgqEAxl9a/I= X-Google-Smtp-Source: ABdhPJzufpaPghJca0m6g3l+aiVQwc4NlfpobT2IZhUHkW8s9pNjPsoYzNApitsOwyVnlrXfnO1/LO0AYH7qF3bsPIU= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:f464:6db6:3d47:ed14]) (user=samitolvanen job=sendgmr) by 2002:a0d:d9d7:0:b0:30c:2ba5:a151 with SMTP id b206-20020a0dd9d7000000b0030c2ba5a151mr51469497ywe.481.1654904118209; Fri, 10 Jun 2022 16:35:18 -0700 (PDT) Date: Fri, 10 Jun 2022 16:34:54 -0700 In-Reply-To: <20220610233513.1798771-1-samitolvanen@google.com> Message-Id: <20220610233513.1798771-2-samitolvanen@google.com> Mime-Version: 1.0 References: <20220610233513.1798771-1-samitolvanen@google.com> X-Developer-Key: i=samitolvanen@google.com; a=openpgp; fpr=35CCFB63B283D6D3AEB783944CB5F6848BBC56EE X-Developer-Signature: v=1; a=openpgp-sha256; l=2980; h=from:subject; bh=D9CF0FusOcHoK9N60QLxjpk1E2xsqSvmemFeS75j5/8=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBio9UsuUCdAj7U2+8Hnh3U+7yazPmqBk99zh6vJyhb 4/+cmdSJAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCYqPVLAAKCRBMtfaEi7xW7nGxC/ oCtMcUeK4KGJm7EoJ262u7jGOh4PjE0kWyNah1Np47MSwS2EpgThwsYg/oyPlMAKsuEiEb3Gv5G2zR spW3AtGXGZ0sI3SfFcZQj6N6iI4JfLIFsFq5+v0uN+ORUESg8JiD9jqja4KXEn8ZRFw37BLsnDIgUz Y40ii2rqHPjLuAijuImAO/uj/jTxUjtOmV0K9nD7YjXMGHCJsdAAAziA2VaAcLxsRuOtBDpD2LUd/X IkSmg3Zyl1mjt7AYMiZMoGZ3opA2HjBB+YTLefQHBJEPPm4Lcadtg6gNYhJfG32QWywx9g6qeJu5yT APfULpxls5FYQmIDIJK+sD/Mnieq4ClX2KzvtsaVStZA5iA5nV9rN3uSbh5eChZot5evyMMb/np5z2 np3oNKfQBlUMXkL7e1W3wyDjgIZ+Y+OSJdYSxXn50RhUc2x4vygGQNzJekBUrEL9rBri4RteAWfFZA 3Avw3bBx1N8qZbR0uS8ging4PqmrIqG68CqQowCZTc6Lw= X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog Subject: [RFC PATCH v3 01/20] 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-20220610_163520_862971_41EC0529 X-CRM114-Status: GOOD ( 11.48 ) 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 f6e25d7c346a..c7c123ed29cc 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile @@ -34,7 +34,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 c2a8b76ae0bc..0148df4f0425 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) # # vDSO code runs in userspace and -pg doesn't help with profiling anyway. @@ -152,6 +152,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))