From patchwork Mon Aug 19 16:02:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768563 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C4A917C98C; Mon, 19 Aug 2024 16:04:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083459; cv=none; b=P4xBazNuhpxutc/VxQmSze5EYyaYVAOJoLF9prNZG2EUx2HFBf1hLByAlPHu+WxBsl8gtBKm8hOn3UcgqGOPPwR3+Z8Q3VbCqQCdAu6FjhNM1ZN3sO3edsDxwTlDCWJWl+Xmj/XiAlQMk/MlWyzrH/8T+YtJMBufwU45g6IZwVE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083459; c=relaxed/simple; bh=Csihlk2vDZs70+nrzXlJHCOQudBO1ZCxtt99gI9gNEc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=T5DgKH3aSQxSnd85A9U0fjZsmc7Jcg0OXibinFbRf3SLGmY70BrbnyMWMrY4+yCo5eS+JRYIHUSdV8cvu0Nz44iAGbHwxOeFkEzJqguusEkaQbeTmBk86luPuBpLwUvBL2zSAL9LJ92PjY+Lb8vyV3xsPIYryxzGGo7jgFfaiIA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=kkRdwu8q; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="kkRdwu8q" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD6xWL019063; Mon, 19 Aug 2024 16:03:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=3 bnHuno5/U3qhB7809Tn0t9u8YGb5A9kVmLS19g7oZ0=; b=kkRdwu8qooKwhvRcJ EQmC791NkOIPKTP2DAZnOtglip/TusA8giF6He4kGsppQnXCpdINQZG1xcRY977o CX09qllYC6uRUPX939H+hT6WyLQBWvYPd5wDnyZMcI8r67py+TJNI8OnkW0mVEj7 tMLkLBuIdaHYgtGNpPFp4hTApPGOKrHExkSaBxZdqbQgUf0ReqUSh9olMM6evxKh UFkmVrhEfJuX7c4JC+nMYuqBAY4Xnh0PBT34yajfhkMqtIAENbst7TM/FDOZFYju RMBuASLTnPl31DgBLfQXP/+D28takuPhUTVoMsxWujKRPHV8xF7qlq2YpGhBixss fHimg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m3hjxsu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:03:53 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbHTv007813; Mon, 19 Aug 2024 16:03:52 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pba63-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:03:52 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Fed014254; Mon, 19 Aug 2024 16:03:51 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-2; Mon, 19 Aug 2024 16:03:51 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum Subject: [RFC PATCH 01/11] kbuild: ignore .config rule for make --always-make Date: Mon, 19 Aug 2024 18:02:58 +0200 Message-Id: <20240819160309.2218114-2-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-ORIG-GUID: 1_NWZdCAXjfwFV1hUeX64qkrZUNXouYh X-Proofpoint-GUID: 1_NWZdCAXjfwFV1hUeX64qkrZUNXouYh Before this patch, using 'make --always-make' would always result in the error message about the missing .config being displayed. Detect the -B/--always-make flag and leave this rule out, which allows the rest of the build to proceed. See [1] for an explanation of this particular construction. [1]: https://www.gnu.org/software/make/manual/make.html#Testing-Flags Signed-off-by: Vegard Nossum --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 44c02a6f60a14..f09c036daf2f5 100644 --- a/Makefile +++ b/Makefile @@ -757,6 +757,10 @@ ifdef may-sync-config # because some architectures define CROSS_COMPILE there. include include/config/auto.conf.cmd +ifeq (,$(findstring B,$(firstword -$(MAKEFLAGS)))) +# This is a dummy target, only meant as a help for the user invoking make. +# We don't want it to take effect when running 'make --always-make', since +# that renders the --always-make option effectively useless. $(KCONFIG_CONFIG): @echo >&2 '***' @echo >&2 '*** Configuration file "$@" not found!' @@ -765,6 +769,7 @@ $(KCONFIG_CONFIG): @echo >&2 '*** "make menuconfig" or "make xconfig").' @echo >&2 '***' @/bin/false +endif # The actual configuration files used during the build are stored in # include/generated/ and include/config/. Update them if .config is newer than From patchwork Mon Aug 19 16:02:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768567 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DBB5185628; Mon, 19 Aug 2024 16:04:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083466; cv=none; b=mYdRkJSfGUVE0mlNo7qrAdfP2Gpu/tcSVk1XHQ76fZKFbRohK/2kbnYcezDlVsGm8GRA5iJMl5oXk5+w6MG2rIbS/QfHYyfj9pJKNRDHPT26aqNnVCZlCSc2cH4Z9XnOYSpcH4pGGQSycC/Zudmydr72gQof3/TDESJ7M+VeDGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083466; c=relaxed/simple; bh=Lgs6ZEvUoE6ahteb1LVQbmKtq1z23xEPHUUsaDynp48=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JoCpVin5i+xBLKxPn1S99nUfWTgr9JfPoahUwJMQiBvQ2IN1Cr0SnShQ/sQQxwMGUQ35ScwejV1LaPvlgN9Fv35rqF6YfPnUPPgRyz4pVW2kYdLclrVKDYskJhTnFF1lvUD918ie+6lalUSlHuY2aeaup8/5msLkD683+VaJzWQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=cB0TTf4S; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="cB0TTf4S" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD6rPg018612; Mon, 19 Aug 2024 16:03:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=0 M1SFSQi9kM3TTIxkfL6OzR8Sp7hEUnHLCXI92OTYwI=; b=cB0TTf4Sjp6SnWN9S ///EyU9AJQsel30pBXTUrByhCxWN6NUHop3zKUEc8G1lbl6b5z+uZ61sbOgVIsNX GFbAlRPH7Dd/S+2dRJopOXK9lDRJjoaWLlGzRn8/p5RomElMZ0E8TAAthd2Vfw6h EYjco90NLhbmNHhKwV+jcIguCNsyr4HGXIvpzxQ50LTVpmzIsoAr4cXylN+TmNPt qu6yifia/BAynkRTEP3GVI+RlCLQ20bGNABur16MrKnJ9HoUQQu/FlvGvR5Yty91 ZlZJQSKpyTrdQPImesC8SeIu4mUm0myTnl6ofPOpGuds99snNSE6VeVtcbi4y1lu PwfXg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m3hjxt4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:03:57 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbHZ7007829; Mon, 19 Aug 2024 16:03:55 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pba8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:03:55 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Fef014254; Mon, 19 Aug 2024 16:03:55 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-3; Mon, 19 Aug 2024 16:03:55 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum Subject: [RFC PATCH 02/11] kbuild: document some prerequisites Date: Mon, 19 Aug 2024 18:02:59 +0200 Message-Id: <20240819160309.2218114-3-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-ORIG-GUID: Nmweai6S9-YZQz6e0TxbmoGzR2GXXV_y X-Proofpoint-GUID: Nmweai6S9-YZQz6e0TxbmoGzR2GXXV_y When running 'make --dry-run', make will invoke itself recursively for recipes using $(MAKE), but otherwise not execute the other commands in a recipe. However, if a prerequisite is missing and 'make' does not how to create it (which will be the case when running 'make -n'), it will complain with an error message like this: $ make -n ... make -f ./scripts/Makefile.modpost make[1]: *** No rule to make target 'modules.order', needed by 'modules-only.symvers'. Stop. make: *** [Makefile:1868: modpost] Error 2 In this case, the top-level makefile has reached a recipe that ran 'make' recursively on scripts/Makefile.modpost, which itself has a rule with modules.order as a prerequisite. Since the file doesn't exist, and make doesn't know how to create it, it errors out. We can document such prerequisites (which are expected to be created by the parent Makefile) by adding them to the PHONY list of each respective Makefile. Signed-off-by: Vegard Nossum --- arch/x86/boot/compressed/Makefile | 6 ++++++ scripts/Makefile.modfinal | 5 +++++ scripts/Makefile.modpost | 4 ++++ scripts/Makefile.vmlinux | 7 +++++++ scripts/Makefile.vmlinux_o | 3 +++ 5 files changed, 25 insertions(+) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index f2051644de943..ccef6f0e04bc7 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -80,6 +80,9 @@ quiet_cmd_voffset = VOFFSET $@ targets += ../voffset.h +# We don't know how to build this +PHONY += vmlinux + $(obj)/../voffset.h: vmlinux FORCE $(call if_changed,voffset) @@ -107,6 +110,9 @@ vmlinux-objs-$(CONFIG_EFI) += $(obj)/efi.o vmlinux-objs-$(CONFIG_EFI_MIXED) += $(obj)/efi_mixed.o vmlinux-libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a +# We don't know how to build this +PHONY += $(objtree)/drivers/firmware/efi/libstub/lib.a + $(obj)/vmlinux: $(vmlinux-objs-y) $(vmlinux-libs-y) FORCE $(call if_changed,ld) diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal index 1fa98b5e952b4..696888f0a0bde 100644 --- a/scripts/Makefile.modfinal +++ b/scripts/Makefile.modfinal @@ -15,6 +15,11 @@ include $(srctree)/scripts/Makefile.lib # find all modules listed in modules.order modules := $(call read-file, $(MODORDER)) +# We don't know how to build these +PHONY += $(modules) +PHONY += $(modules:%.o=%.mod.c) +PHONY += scripts/module.lds + __modfinal: $(modules:%.o=%.ko) @: diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 44936ebad161e..65f2bdc702369 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -140,6 +140,10 @@ quiet_cmd_modpost = MODPOST $@ echo >&2 " if you want to proceed at your own risk.";) \ $(MODPOST) $(modpost-args) +# We don't know how to build these +PHONY += vmlinux.o +PHONY += $(MODORDER) + targets += $(output-symdump) $(output-symdump): $(modpost-deps) FORCE $(call if_changed,modpost) diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index 49946cb968440..10d80e07f945c 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -18,6 +18,9 @@ quiet_cmd_cc_o_c = CC $@ $(call if_changed_dep,cc_o_c) ifdef CONFIG_MODULES +# We don't know how to build this +PHONY += .vmlinux.export.c + targets += .vmlinux.export.o vmlinux: .vmlinux.export.o endif @@ -29,6 +32,10 @@ cmd_link_vmlinux = \ $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) +# We don't know how to build these +PHONY += vmlinux.o +PHONY += $(KBUILD_LDS) + targets += vmlinux vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE +$(call if_changed_dep,link_vmlinux) diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o index 6de297916ce68..7af841eb1ce5b 100644 --- a/scripts/Makefile.vmlinux_o +++ b/scripts/Makefile.vmlinux_o @@ -58,6 +58,9 @@ define rule_ld_vmlinux.o $(call cmd,gen_objtooldep) endef +# We don't know how to build this +PHONY += vmlinux.a + vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE $(call if_changed_rule,ld_vmlinux.o) From patchwork Mon Aug 19 16:03:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768565 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D56C8287D; Mon, 19 Aug 2024 16:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083462; cv=none; b=SCfdRwH9FNTZL0R2gGKuKGummfmIjYW/kgq1EwdFR7TTCEKXGu2JeyrI8Qbr5+v0cocVuI6v8za1y0cVmX1QzS9V/00lWWCwh502ENgNXWAQfAEiEck8vWLBXP/xWeELFYrpCna7kTy/lcMDiA76/z6nbi35K4xmze2wWbDAM8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083462; c=relaxed/simple; bh=J57vH6+xb3CLqbGuaNDOp1pArYBV6p/7PeEANvE7wQ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aoN2mm3+3cszNM7OGkuuMgtQTFaZ1VoBQlTAvcgSvrT2mhgwD3dDOLVMC8D86Pv9Bj+omVavrBKjUQTz6puhMxzG34jY6zmDCQkoyKEEiCoAQl5PV41rPUwNNpYgkcp9ELwHPlNQwHn+h5gakkKX+6YeNsL85YfSYi3I/KfecbI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=LbeiPn3D; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="LbeiPn3D" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD6qVh004652; Mon, 19 Aug 2024 16:04:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=l ZBL59Au43pCklhhwPVB73vcLhjp+oPHjVQAId5X/PY=; b=LbeiPn3Dz0jei06Ur b8SWlRThDgg9vDj+cRLvTU0+pGMdyz92p+zyb5J6gcjGVv5i/9vr29pmKILcotyg QsENXwvO0xSZpYt4+m0Rwi/YdeCgJXx+QBP8rLn12hGW0FukwZxu1W0VCxTt7emK 0/YOb9/yaJMHsnFHkN6/6BsvbNsQgGpX8l0XZD6DVBupFB4TG7bVDdoRbakaUcmx ZAZOz++DB31YzlLrP47OJ0BUzin4KHfEPFzRL5ChcPml++sG8a9dmvTHAL2H1XgD oQtUFJIelPTeT2Ds0Pp6CKbOUG7YdNFiPmZoc42OK+ZB6ODzM4/MJutmgSSHVdKq omyLw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m2dayru-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:00 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbHVc007830; Mon, 19 Aug 2024 16:03:59 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pbadx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:03:59 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Feh014254; Mon, 19 Aug 2024 16:03:59 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-4; Mon, 19 Aug 2024 16:03:58 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum Subject: [RFC PATCH 03/11] kbuild: pass KERNELVERSION and LOCALVERSION explicitly to setlocalversion Date: Mon, 19 Aug 2024 18:03:00 +0200 Message-Id: <20240819160309.2218114-4-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-GUID: Ll0YTOBB0zw4SHfn5qMjkKr9bxP_O2jr X-Proofpoint-ORIG-GUID: Ll0YTOBB0zw4SHfn5qMjkKr9bxP_O2jr These environment variables are passed when invoking 'make', but if running 'make -n' we need to pass them explicitly so they become part of the printed command. Signed-off-by: Vegard Nossum Reviewed-by: Nicolas Schier --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f09c036daf2f5..58f3843ccfac6 100644 --- a/Makefile +++ b/Makefile @@ -1165,7 +1165,10 @@ vmlinux: vmlinux.o $(KBUILD_LDS) modpost $(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ; ifeq ($(origin KERNELRELEASE),file) -filechk_kernel.release = $(srctree)/scripts/setlocalversion $(srctree) +filechk_kernel.release = \ + KERNELVERSION="$(KERNELVERSION)" \ + LOCALVERSION="$(LOCALVERSION)" \ + $(srctree)/scripts/setlocalversion $(srctree) else filechk_kernel.release = echo $(KERNELRELEASE) endif From patchwork Mon Aug 19 16:03:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768566 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9828A185628; Mon, 19 Aug 2024 16:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083464; cv=none; b=ZbSkgTgMlqddTxj/otio6Oau+pdLFKC8U/OHwTwH87h2fi6KFwKXzHgUHg4vEdUwPYlM1fUa7VN7D12mJK+JYRpkvQgO7eBIun/O2nnFR8krsOlRHKcSbEyWwKkLTF9W2ZwXvsCDKImC9lN2MyvykLMFOmzcxeVabl65XiX1ddc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083464; c=relaxed/simple; bh=3w4Y2J/fOiqJ3huhO+LscgxZqE488ZLUMBysFo7u4+8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eCa6e1LjEINfDcpl8JrKPhE/hWw94t9TKMOwsdQ83vAKhP4ZoxDmKo9Gyc3RBdXvcXzLNuAIXvirYzDRBPPzeJBwsmVHbtmmLLcNqeddO0wJaRiIgMJPoku1RUWjU/GfiX2pnWt99rBU999enXX13W/ZmRLyj0zCSzNU24gMQk8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=HJbMfpW+; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="HJbMfpW+" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD7f3E003174; Mon, 19 Aug 2024 16:04:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=5 BgnP9uUFC04LGUJy6VfpUMDDksg1vYxSNcRrVpSIGA=; b=HJbMfpW+mP5KmfIHX 7dBg7zklEmemCobcXsOg9xHajhRtjBRBrAmmn5pCNB2DarN6SXS2qup6XrafLUPK jk7+VvNzynDa9qH+FJ6y17AzPFGwtCBkHMKADjfoJID0verOy8/PVTVCYfwwR/3H wTVgDQwyYAm8WX63yWVrxaqXs792AlFgpnpLM7wy1edIHhJ6JRamMBXwKfnpGSZN /CRwwh6A5WGbcVXeIVo5H2+Pqws3Yedr3M1TfdGUYQQhzH9xzknvqUtJ9mKTilg/ b0qDRUfDQx7ef6zwQ+6NewG33B40A+fhixKwjGKhhncbnuTACQqjFnoVJl5CSR3W HP2qQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m6gaync-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:05 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbHh4007843; Mon, 19 Aug 2024 16:04:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pbamp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:04 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Fej014254; Mon, 19 Aug 2024 16:04:03 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-5; Mon, 19 Aug 2024 16:04:03 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum , Andrii Nakryiko , Alexei Starovoitov Subject: [RFC PATCH 04/11] kbuild: don't execute .ko recipe in --dry-run mode Date: Mon, 19 Aug 2024 18:03:01 +0200 Message-Id: <20240819160309.2218114-5-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-ORIG-GUID: hqNG9Y67zETK8DzDVPDoy6kdoPkrmStE X-Proofpoint-GUID: hqNG9Y67zETK8DzDVPDoy6kdoPkrmStE Prefixing a line in a make recipe with + makes that command execute even in --dry-run mode. We don't need that here; remove it. Fixes: 5f9ae91f7c0d ("kbuild: Build kernel module BTFs if BTF is enabled and pahole supports it") Cc: Andrii Nakryiko Cc: Alexei Starovoitov Signed-off-by: Vegard Nossum --- scripts/Makefile.modfinal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal index 696888f0a0bde..2679304f158ad 100644 --- a/scripts/Makefile.modfinal +++ b/scripts/Makefile.modfinal @@ -60,9 +60,9 @@ if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \ # Re-generate module BTFs if either module's .ko or vmlinux changed %.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE - +$(call if_changed_except,ld_ko_o,vmlinux) + $(call if_changed_except,ld_ko_o,vmlinux) ifdef CONFIG_DEBUG_INFO_BTF_MODULES - +$(if $(newer-prereqs),$(call cmd,btf_ko)) + $(if $(newer-prereqs),$(call cmd,btf_ko)) endif targets += $(modules:%.o=%.ko) $(modules:%.o=%.mod.o) From patchwork Mon Aug 19 16:03:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768568 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6457C186289; Mon, 19 Aug 2024 16:04:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083467; cv=none; b=Ec1zU8PhJ2AXM+tq4liaeosgrNRzoaIDGFTUaTdwBvPUZO2cxLa0g6GZk8+RJNl5tNp1vcjCB8Mm3eo+A9KY5DavdyxuJHoQF70nkErXAVftguRbsRtUWcc82R3D0i1I5+I4z66/nJydUFmBCxMuDoljWcEqxdOcIyERWCozfUs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083467; c=relaxed/simple; bh=4xlZeP9eY5bvMNYZgvTnXZWDUEGzmXMbYJDjd9EvUsw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ptRZTRvygyZn5NJyHadHsy4w1+XvBRdspO7PdLKavnvGrrBeUzmeNdPwfqvBituFp6BrQJB/kQps1C3cD4azVjT3FH6lymMrdmmuU7jSZSfem0kYvK3A7AWgBJ36ekqrkycwi9jfXgyY9QARTGa21cq16lvYFAO+rxIIl49gNXQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=BHFG4CKV; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="BHFG4CKV" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD6qT1004656; Mon, 19 Aug 2024 16:04:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=f VL4d7OwTk5iZUhQ9Tud4T42E1TQK9FykGhDZVf+KwU=; b=BHFG4CKVg+GGkjWzM eG6ZV0vz2U0Ywii6MLlN00G1FOUnyH3U5agHLxo4vNKmn3fvhZ6yNx3NBQwFY38X TQtI37Co4yt4Hih7MKPE0NHOxTHzVNH0lOQAGJRvQBIc/w2Fj+MNQwBo1SZPRlZJ Ik+7goVIEr69DX/DG1Psmi3c3/2CcDGmlWLCl7ZZ1y8RU28prGYMdQUMN5rqA1xK 5ONfqsoBaiJVMHGuDi0Hiogxsc+fY234gk9gzoyHfCILyQw4CDSHHUY3r3kNSq4c G6R02nbq1MIHu2TWlGTkMkgNMRGenqdwA25EguJqRTvRqW+YPYRl9Ol2f3jLxEXN CvKDw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m2dayt5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:08 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbI9q007857; Mon, 19 Aug 2024 16:04:07 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pbarq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:07 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Fel014254; Mon, 19 Aug 2024 16:04:06 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-6; Mon, 19 Aug 2024 16:04:06 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum Subject: [RFC PATCH 05/11] kbuild: execute modules.order recipe in --dry-run mode Date: Mon, 19 Aug 2024 18:03:02 +0200 Message-Id: <20240819160309.2218114-6-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-GUID: Y8VCc3AHCh_c8hGF13RluGss-u2hi8nK X-Proofpoint-ORIG-GUID: Y8VCc3AHCh_c8hGF13RluGss-u2hi8nK modules.order is read by scripts/Makefile.modfinal to determine which modules to build, so we need this recipe to execute if we want to be able to output the recipes for building modules in dry-run mode. Signed-off-by: Vegard Nossum --- scripts/Makefile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index efacca63c8976..34f86dced67f3 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -417,7 +417,7 @@ cmd_gen_order = { $(foreach m, $(real-prereqs), \ > $@ $(obj)/modules.order: $(obj-m) FORCE - $(call if_changed,gen_order) + +$(call if_changed,gen_order) $(obj)/dtbs-list: $(dtb-y) FORCE $(call if_changed,gen_order) From patchwork Mon Aug 19 16:03:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768569 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B17C16D4E1; Mon, 19 Aug 2024 16:04:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083472; cv=none; b=sidTwlxsXka+ISMFH4vMcgtNgWp4aAafNNQ2gdSTZuZlWMS4OPrAH2r6uo+r7Tlb70CxGkgMIjoz5iqndRRhOTzz25cfmy1HHpvmOWDvLgSgDkGDJcuONnnMm5Ox+L/XukyZwOhmqa8jwHyuHk8rnQ3M3LovUydA90QxePuDAWo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083472; c=relaxed/simple; bh=Tq84KqCfctR+GEInmIwAfWnxRLjwEaKchRbUoOTRTnw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t9PNbhOyACBiV6EqCpNc/yJ2ar6lArxC3MoEfey3sb/2UAOwliPmi2ZjP/d1aCgOCDM1j4KeS3SYjzRpjf1eCdDz5nALY0FERQ7GqXOu/X4RV/51T0oMrhilcvf8TGNqcCjgQCkBZ6llJfWAaSHqvbudFFBkoUrSV8XB0SUWWw4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=jbdmjJlT; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="jbdmjJlT" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD6wBC004701; Mon, 19 Aug 2024 16:04:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=/ t9wxgjAaHurbMSjbjKpx20u+pH3Oh8bcX66OgQyT9I=; b=jbdmjJlTlJJGqQiOC Zo1rXgLeguCZRnJItvy4BqsJb9yDUUuC2K38hRRy3lZXb2GX+8Z6HHK1v0vuMPvV 33uc85PqWXCfzM2T3e4e+NA24NeuncuI89zb4Xvbe67W7qSlyb5HyB7SWANI8y9c +SnF9HgsFaaKxAmB693hwJwruRWzMCgU6NemkODeo2qOyTZcrnZGyh8Vo0crcKGH pDzIO++0ghInl9k0AF74G0aP5g/9JFXULluruZIqbYq3aYsaSAjed1Q0anI+cXUw UE1XwpsuTe+UnPsdb3bCs+Qs3Mf90EaQBqwKROfLBPdQHr/eDJu+q9HYwXkN0Hd2 SpvAA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m2daytf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:12 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbHn4007848; Mon, 19 Aug 2024 16:04:11 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pbaw3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:11 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Fen014254; Mon, 19 Aug 2024 16:04:11 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-7; Mon, 19 Aug 2024 16:04:10 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum Subject: [RFC PATCH 06/11] kbuild: set $dry_run when running in --dry-run mode Date: Mon, 19 Aug 2024 18:03:03 +0200 Message-Id: <20240819160309.2218114-7-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-GUID: dNqzGx34NOYtguYcjNPHdRVE3Y_jqhLE X-Proofpoint-ORIG-GUID: dNqzGx34NOYtguYcjNPHdRVE3Y_jqhLE Add a convenience variable that allows us to use 'ifdef dry_run...endif' in Makefiles or '[ -v dry_run ]' in shell scripts to test whether make was invoked with '-n'. See [1] for an explanation of this particular construction. [1]: https://www.gnu.org/software/make/manual/make.html#Testing-Flags Signed-off-by: Vegard Nossum --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 58f3843ccfac6..953951157ec92 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,11 @@ $(if $(filter __%, $(MAKECMDGOALS)), \ PHONY := __all __all: +# Was make invoked with --dry-run/-n? Record this in a convenience variable. +ifeq (n,$(findstring n,$(firstword -$(MAKEFLAGS)))) +export dry_run := 1 +endif + # We are using a recursive build, so we need to do a little thinking # to get the ordering right. # From patchwork Mon Aug 19 16:03:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768570 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 396B6184528; Mon, 19 Aug 2024 16:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083481; cv=none; b=Ew3eRRY4mUiFM9aUf1GES6OJgqXL/QtrDHbKHOU5Kq6RqdyodytThKkK1IHds3aikvB3+PigcwufOxitTAiv1HzkWZPGT9Y+V67RfEoNQWbatPeFW6Olkg8fHDvCPMGZv8wlltmxZ7rqat4Nkp/+yVvvNVp8mesjZC7KFn6V5yA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083481; c=relaxed/simple; bh=d3elD88fZIEaKNWJwRokI50chu9Ry7OezwpNId9EsUQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t0nrbVn7BDT/Lv76xzG5GDshoLOS5ENjFROXc9+MJKUB8Kk19xo8nLW3Ck5EQJvhy0Qgi/Drm+v8QIpFu2vbvCWcnN4LkOokHz+oNqlHaauyeMfqodBt34XUQtWLn+Nt+R8i2HvjHgFnnaf95lGOHlMIvn6GIurd+ikNDrU0fLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=S7ZtxWIU; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="S7ZtxWIU" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD6xab022423; Mon, 19 Aug 2024 16:04:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=f wjNpatZXKEVUIxn1sL7/EqLVpS6bcnnOEWTBSsVVDc=; b=S7ZtxWIU/Mip+Q/mK 2/H6p5tUEaGHb/ML2mubtoWfyXNAJ2xVkmNwNtMlzpQK3F5KvUfceZN5SGIJQ1Rw eU9Br5hbuITK6IIbx0NwXvVbVBaPOyQzNJcbo1MKuhvNQmG08DgY+UOElm9k4VOG RumiNGxnW70qDOgWTEotrhIUZlBC+r9L/TExNEzfEQSrdivgsHw4VdxTW6lMJAVQ TZDnxBiDceZHNHcXlt/a9KUg8KAYsz7Tc3ZKtDIpuFTiWw/mN2Eyi/0TYymicKsM VYbfrlrvjiQ4POD4aLIx3AAhlILYVyUkujqquwVf71YUhTN8uNnUn+Zx5y1NJyAk CV+QQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m3dk14g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:16 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbHoS007842; Mon, 19 Aug 2024 16:04:16 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pbb0m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:15 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Fep014254; Mon, 19 Aug 2024 16:04:15 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-8; Mon, 19 Aug 2024 16:04:15 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum Subject: [RFC PATCH 07/11] kbuild: define 'make' as a no-op in --dry-run mode Date: Mon, 19 Aug 2024 18:03:04 +0200 Message-Id: <20240819160309.2218114-8-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-ORIG-GUID: BaZ3RWBemoMov_g8Pk82EfAgUCAUb7n6 X-Proofpoint-GUID: BaZ3RWBemoMov_g8Pk82EfAgUCAUb7n6 Output 'make() { :; }' at the start of the script in order to make all 'make' invocations in the resulting build script no-ops (GNU Make will actually execute -- and print -- all recipe lines that include $(MAKE), even when invoked with -n). Signed-off-by: Vegard Nossum --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 953951157ec92..d08ade5791c2e 100644 --- a/Makefile +++ b/Makefile @@ -226,6 +226,12 @@ $(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make # Invoke a second make in the output directory, passing relevant variables __sub-make: +ifdef dry_run + # define 'make' as a no-op alias so that those commands are not + # actually run + @make() { :; } + @export -f make +endif $(Q)$(MAKE) $(no-print-directory) -C $(abs_objtree) \ -f $(abs_srctree)/Makefile $(MAKECMDGOALS) From patchwork Mon Aug 19 16:03:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768572 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2E72171E40; Mon, 19 Aug 2024 16:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083485; cv=none; b=u0xJrMRQm+G3jJ38kAReOE/ypgPPkKTMIQUYuXuCZhynViIkbtL6jD3arGb62xt96ih9+WW1hjSV2udjWA3B7WYrA58sMk/8EpGur1lfl1o8Mg9ZglaiXjcLr33x3zkH6LGmC7AOX0h9bS4K1O3in2CTX4OuOWO5hOybooc1P3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083485; c=relaxed/simple; bh=0xkrW+vuKDfRMFvlsJ+hmSwlR+hITyNXGV5ox6DCigc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dAKa1j4rrm00MwQlbBDn31U6hO7huXvq/sAiP4XDZJvQ0uLvUQAvN5YsfdfpqeH1rNKSY3wc4+glkMcIY6iRpt0Mus3resz6IBZ3yVyi2ZNZInjagudB4sATldKDEQXgvIlRO9VNOu4szeU5bWGZB781aZl4sc4lYI+ZOLdVKUY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=JZxwyD7t; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="JZxwyD7t" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD6vqe018670; Mon, 19 Aug 2024 16:04:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=5 HCW0PQEz/mpn2E4tb1qNVdeD1lQfcMuieQszFL2LbI=; b=JZxwyD7tdf7xCS4Ne uUPIhMK8VoVo64FgRT0vd0lL+vR3dXU/4GdGoa2MJi4HcpjoTKcojP7uJ8hifji9 vYYk3xORMwHGgnXBon95UYIJAsW+tkPh/B/8Avsf+yyg7sQZMBbqkybnh888g3WU 9qUAQdreAvmKNGLjsv8kq0S7btMU3j86LEyb4glteqIAsiCO+jLz8PWoAGkgH4J6 hm0RqymfsZ6j0xreNAJ3oD8eMh5VsMmfUi7/HYOiDzAhwZqKrbX+0J6Gs9lI081a K1n2dKSaim9+1/Diol2/XUqcMzLJpX6xhpxupXC1Zddo+GupvKCJI7d0eapy73cR aI9gQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m3hjxvr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:20 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbI2v007879; Mon, 19 Aug 2024 16:04:19 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pbb4a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:19 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Fer014254; Mon, 19 Aug 2024 16:04:19 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-9; Mon, 19 Aug 2024 16:04:18 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum Subject: [RFC PATCH 08/11] kbuild: make link-vmlinux.sh respect $dry_run Date: Mon, 19 Aug 2024 18:03:05 +0200 Message-Id: <20240819160309.2218114-9-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-ORIG-GUID: KhSvNXLr-St7C3eJBbCoTqLhZ412VHt8 X-Proofpoint-GUID: KhSvNXLr-St7C3eJBbCoTqLhZ412VHt8 Make link-vmlinux.sh print the commands it wants to run instead of actually running them when $dry_run is defined. This is needed in order for make -n/--dry-run to output a complete build script. Signed-off-by: Vegard Nossum --- scripts/Makefile.vmlinux | 15 ++++++++++++-- scripts/link-vmlinux.sh | 44 ++++++++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index 10d80e07f945c..1fe0faab52889 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -1,5 +1,12 @@ # SPDX-License-Identifier: GPL-2.0-only +# there doesn't seem to be a straightforward way for 'make -n' to output +# one command while actually executing another, so we resort to this hack +# where we set an environment variable differently depending on whether +# we are executing from 'make' or executing from the 'make -n' log. +LINK_VMLINUX=scripts/link-vmlinux.sh +export LINK_VMLINUX + PHONY := __default __default: vmlinux @@ -29,7 +36,8 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) # Final link of vmlinux with optional arch pass after final link cmd_link_vmlinux = \ - $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \ + "$${LINK_VMLINUX}" \ + "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) # We don't know how to build these @@ -37,7 +45,10 @@ PHONY += vmlinux.o PHONY += $(KBUILD_LDS) targets += vmlinux -vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE +vmlinux: $(LINK_VMLINUX) vmlinux.o $(KBUILD_LDS) FORCE +ifdef dry_run + @LINK_VMLINUX=/bin/true +endif +$(call if_changed_dep,link_vmlinux) # Add FORCE to the prequisites of a target to force it to be always rebuilt. diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index f7b2503cdba95..fd32e48a8a455 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -32,6 +32,17 @@ LD="$1" KBUILD_LDFLAGS="$2" LDFLAGS_vmlinux="$3" +# If $dry_run is set, just echo the command instead of executing it. +run() +{ + if [ ! -v dry_run ] + then + eval "$1" + else + echo "$1" + fi +} + is_enabled() { grep -q "^$1=y" include/config/auto.conf } @@ -40,7 +51,10 @@ is_enabled() { # Will be supressed by "make -s" info() { - printf " %-7s %s\n" "${1}" "${2}" + if [ ! -v dry_run ] + then + printf " %-7s %s\n" "${1}" "${2}" + fi } # Link of vmlinux @@ -97,10 +111,10 @@ vmlinux_link() ldflags="${ldflags} ${wl}-Map=${output}.map" fi - ${ld} ${ldflags} -o ${output} \ + run "${ld} ${ldflags} -o ${output} \ ${wl}--whole-archive ${objs} ${wl}--no-whole-archive \ ${wl}--start-group ${libs} ${wl}--end-group \ - ${kallsymso} ${btf_vmlinux_bin_o} ${ldlibs} + ${kallsymso} ${btf_vmlinux_bin_o} ${ldlibs}" } # generate .BTF typeinfo from DWARF debuginfo @@ -129,8 +143,8 @@ gen_btf() # deletes all symbols including __start_BTF and __stop_BTF, which will # be redefined in the linker script. Add 2>/dev/null to suppress GNU # objcopy warnings: "empty loadable segment detected at ..." - ${OBJCOPY} --only-section=.BTF --set-section-flags .BTF=alloc,readonly \ - --strip-all ${1} "${btf_data}" 2>/dev/null + run "${OBJCOPY} --only-section=.BTF --set-section-flags .BTF=alloc,readonly \ + --strip-all ${1} "${btf_data}" 2>/dev/null" # Change e_type to ET_REL so that it can be used to link final vmlinux. # GNU ld 2.35+ and lld do not allow an ET_EXEC input. if is_enabled CONFIG_CPU_BIG_ENDIAN; then @@ -161,11 +175,11 @@ kallsyms() fi info KSYMS "${2}.S" - scripts/kallsyms ${kallsymopt} "${1}" > "${2}.S" + run "scripts/kallsyms ${kallsymopt} \"${1}\" > \"${2}.S\"" info AS "${2}.o" - ${CC} ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS} \ - ${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} -c -o "${2}.o" "${2}.S" + run "${CC} ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS} \ + ${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} -c -o \"${2}.o\" \"${2}.S\"" kallsymso=${2}.o } @@ -184,12 +198,12 @@ sysmap_and_kallsyms() mksysmap() { info NM ${2} - ${NM} -n "${1}" | sed -f "${srctree}/scripts/mksysmap" > "${2}" + run "${NM} -n \"${1}\" | sed -f \"${srctree}/scripts/mksysmap\" > \"${2}\"" } sorttable() { - ${objtree}/scripts/sorttable ${1} + run "${objtree}/scripts/sorttable ${1}" } cleanup() @@ -270,13 +284,13 @@ if is_enabled CONFIG_KALLSYMS; then strip_debug=1 sysmap_and_kallsyms .tmp_vmlinux1 - size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso}) + [ -v dry_run ] || size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso}) vmlinux_link .tmp_vmlinux2 sysmap_and_kallsyms .tmp_vmlinux2 - size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso}) + [ -v dry_run ] || size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso}) - if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then + if [ ! -v dry_run ] || [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then vmlinux_link .tmp_vmlinux3 sysmap_and_kallsyms .tmp_vmlinux3 fi @@ -289,7 +303,7 @@ vmlinux_link vmlinux # fill in BTF IDs if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then info BTFIDS vmlinux - ${RESOLVE_BTFIDS} vmlinux + run ${RESOLVE_BTFIDS} vmlinux fi mksysmap vmlinux System.map @@ -303,7 +317,7 @@ if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then fi # step a (see comment above) -if is_enabled CONFIG_KALLSYMS; then +if [ ! -v dry_run ] && is_enabled CONFIG_KALLSYMS; then if ! cmp -s System.map "${kallsyms_sysmap}"; then echo >&2 Inconsistent kallsyms data echo >&2 'Try "make KALLSYMS_EXTRA_PASS=1" as a workaround' From patchwork Mon Aug 19 16:03:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768571 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A98BA16D4EA; Mon, 19 Aug 2024 16:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083484; cv=none; b=d1niIX1F+AWhpw/RAwjWyOBPuP4sEJscraTOuXR5ScM31qwaGGNl/Roh3XyCyGRfSdmJLmhSbcX8UrhaQ38o7nNCL4SxPQ6i+kyf74oYCa2HvCNwII0mWD2HbLVB1nMKjSdXLkedfG9NJYFwPMu3VRA7I4jEGcn/ZpM6uLlAAc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083484; c=relaxed/simple; bh=j4nvRQqupybs8zsQ97VkdPp8rl05S+bMUkwomglK+gs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VZWCJr7uNCPcjJAgyoVZ3AWDhf69aWSlXP45Kr1XXWqt3s4i2wd/vMzhcKYNGEm7D0OJe7rbcrWU3gefy/y2P7GJOZ+2OehWZr947krWfeoZN76O9cfTs5hHPblFxi2MthfVJSYc4jjOUn0iQM7sxZ3AhA1pZIg7MWzaVU3Hmug= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=IAJMv4XE; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="IAJMv4XE" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD6vLe022408; Mon, 19 Aug 2024 16:04:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=Q FptFzk97EtGYovpo4SLZYT+QuG65DqlTOQxoV011pE=; b=IAJMv4XEMdI88g3ij 71Oa6Go2x3swu55ml2VkBbTlLGMXsh8AFMAQpimicFDeKZxQr9HpYH5vyMu7dVuQ xBYYpIrtaOqccPuyfBQY4LPg9wcG6Jw/Vec+u70U/U2QTWPYck8J9VzqLMP+2aPJ UrHCzuFeLe4jbeWT33P7zjX/ER9knQiHhH0/QWN75LM7jzgc0eDJhbkoH+p6XR7t qKZnd0f/Lq8gPHYtBPDbkYTbX1y52gt66qhU4in40C1Z45KhwE7YV51LYXHzStpR xMWIH3CxGNp4fX4ZS1FEY5Gmp248+Hb9mOsDcc4RfiVKAoexupKKvoLGN4czG3ta 4yMJg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m3dk14x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:24 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbHhO007843; Mon, 19 Aug 2024 16:04:23 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pbb7h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:23 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Fet014254; Mon, 19 Aug 2024 16:04:22 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-10; Mon, 19 Aug 2024 16:04:22 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum Subject: [RFC PATCH 09/11] kbuild: simplify commands in --dry-run mode Date: Mon, 19 Aug 2024 18:03:06 +0200 Message-Id: <20240819160309.2218114-10-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-ORIG-GUID: 2S5DyqFBWt4B_J4K_yjFpmQjqe900A57 X-Proofpoint-GUID: 2S5DyqFBWt4B_J4K_yjFpmQjqe900A57 - $filechk is used to check if a file is up to date. - $cmd includes logic for echoing commands and deleting intermediate files on interrupt. Skip all of that in --dry-run mode and just execute the command. - $cmd_and_savecmd executes the command and echoes it into ..cmd. - $if_changed_dep executes the command if any dependencies have changed. - $cmd_and_fixdep executes the command and updates ..cmd. Skip all of that in --dry-run mode and just execute the command. Signed-off-by: Vegard Nossum --- scripts/Kbuild.include | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index ed8a7493524b2..a1ef3b1828bb3 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -94,6 +94,7 @@ kecho := $($(quiet)kecho) # - If no file exist it is created # - If the content differ the new file is used # - If they are equal no change, and no timestamp update +ifndef dry_run define filechk $(check-FORCE) $(Q)set -e; \ @@ -105,6 +106,14 @@ define filechk mv -f $(tmp-target) $@; \ fi endef +else +# simplify and write the output directly if we're just printing +# the commands +define filechk + mkdir -p $(dir $@) + { $(filechk_$(1)); } > $@ +endef +endif ### # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= @@ -149,8 +158,13 @@ delete-on-interrupt = \ $(foreach sig, HUP INT QUIT TERM PIPE, \ trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);)) +ifndef dry_run # print and execute commands cmd = @$(if $(cmd_$(1)),set -e; $($(quiet)log_print) $(delete-on-interrupt) $(cmd_$(1)),:) +else +# just execute (...which will actually "just print" with make -n) +cmd = @$(if $(cmd_$(1)),$(cmd_$(1)),) +endif ### # if_changed - execute command if any prerequisite is newer than @@ -196,17 +210,30 @@ if-changed-cond = $(newer-prereqs)$(cmd-check)$(check-FORCE) # Execute command if command has changed or prerequisite(s) are updated. if_changed = $(if $(if-changed-cond),$(cmd_and_savecmd),@:) +ifndef dry_run cmd_and_savecmd = \ $(cmd); \ printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd +else +cmd_and_savecmd = $(cmd) +endif +ifndef dry_run # Execute the command and also postprocess generated .d dependencies file. if_changed_dep = $(if $(if-changed-cond),$(cmd_and_fixdep),@:) +else +# Just execute the command directly +if_changed_dep = $(cmd) +endif +ifndef dry_run cmd_and_fixdep = \ $(cmd); \ scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\ rm -f $(depfile) +else +cmd_and_fixdep = $(cmd) +endif # Usage: $(call if_changed_rule,foo) # Will check if $(cmd_foo) or any of the prerequisites changed, From patchwork Mon Aug 19 16:03:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768573 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 044D316D4EA; Mon, 19 Aug 2024 16:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083486; cv=none; b=hCaGG9zbzAe//H6KEpqOjzhEVaMF9n70I1Aseiv8jIGo1Yfuz9q7Sgahsb2lHf3yJKp4nDk0ZNbUbBeCnyPuq0l4Em/1xtfrGPfsooy+YgFJqv3uKIWE2G3LTKt6pZxKrqCdf1EFmn03H2i+s8zhM936Yo7LDB56EqgGmVwVcyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083486; c=relaxed/simple; bh=iDgdDjvLeA3c1RUJaOpeZqGAnyV3W+vMth9fSp7FUKw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TRJyRdxFDbV0jLyoOzRA8yXaCuFbq4jfPMc3En6dIqH1JQM4YL8Rjs704nrRrspQbAr/sLs/zGWCZH2FZ8HrHnzF9GiDcwxZ+2ws8/0/8xSN6i4xqYkqFe+9WiKVAQ3CVvs7cYMvZ3MNj2m7USu116e+Pw/vgdvhw/moaXJophY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=JK6o8PGo; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="JK6o8PGo" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD6we5004698; Mon, 19 Aug 2024 16:04:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=y JAUYg+BxVCuyiXZyU2h1A/9sQ4OxkyC85U6c8PKAPQ=; b=JK6o8PGo5rARAg0MM mxwVniuB1QUjQRtadLYbbYCQkZw8YUNKg1kW8oe+6shFfwpDFW9OsCJrZOOfa3lG 1fLD17VB1H1WouH74sttSQwjU7T+DTgbTqqvalA6m/Rw8amwqy3v9qaDfbEekanF hJ95wiFd36iSDHv5GDCkvZKk/vT7lvppI70uo491Ba8kNKAVqG38Afy/B/1b8kYS oiDrM++LUPr3iqCqEgswlwlG3dPKSz+9H51SD8rQSqHd3ZXSg0JIN1jd4eJD47qo m3i+s/4t6KFzgNKfVngvZrcnW9/ismWZHWiCvjOtJnEaMHPcHpst/gnGWtv2c2qo X1Gnw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m2dayu5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:28 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbHoe007842; Mon, 19 Aug 2024 16:04:27 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pbba5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:27 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Fev014254; Mon, 19 Aug 2024 16:04:26 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-11; Mon, 19 Aug 2024 16:04:26 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum Subject: [RFC PATCH 10/11] kbuild: don't test for file presence in --dry-run mode Date: Mon, 19 Aug 2024 18:03:07 +0200 Message-Id: <20240819160309.2218114-11-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-GUID: y83bWz6pT--oiwbk3p3YrmU5sfo4WeNx X-Proofpoint-ORIG-GUID: y83bWz6pT--oiwbk3p3YrmU5sfo4WeNx I'm not really sure if this is correct as I'm not sure under which circumstances the files tested for with $(wildcard) would NOT be present. I'm not even sure if this is the right approach to take. However, it _should_ keep working the same as before for regular 'make' invocations and is necessary for 'make --dry-run' to work. Signed-off-by: Vegard Nossum --- scripts/Makefile.modpost | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 65f2bdc702369..139fa0b087b6d 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -99,7 +99,7 @@ modpost-args += -t $(addprefix -u , $(ksym-wl)) modpost-deps += $(ksym-wl) endif -ifeq ($(wildcard vmlinux.o),) +ifeq ($(or $(wildcard vmlinux.o), $(dry_run)),) missing-input := vmlinux.o output-symdump := modules-only.symvers else @@ -119,7 +119,7 @@ include $(kbuild-file) output-symdump := $(KBUILD_EXTMOD)/Module.symvers -ifeq ($(wildcard Module.symvers),) +ifeq ($(or $(wildcard Module.symvers), $(dry_run)),) missing-input := Module.symvers else modpost-args += -i Module.symvers From patchwork Mon Aug 19 16:03:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vegard Nossum X-Patchwork-Id: 13768574 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B5BE17BED0; Mon, 19 Aug 2024 16:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083492; cv=none; b=qHb61V+u0gL7gEjkvJap9Lf5V0LCD6hHAt7ujxQC8BYgGQbmNuqmV0grCdfzpiRZ/+51CDzT4yt3AP38rmUS1VqGoOAzQfiZ9oN8kCP5auzoF5UjxDY+xMDi26nkCkq0jEubJrqkUKUjInStNTA10DnZyK61Or4B1QiwEAi5UDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083492; c=relaxed/simple; bh=UROqIgc9Nq6hwnGbMe5qpcJ5S3JpUgYDfQ3zqb/R2lU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LFkU65Vp68yDSXgQbJr6d0CUcCxkbi6bVi7VgBVyDDlt77QWXvnomRXm7jq/yJfoOJ7nVkF5dUigO9fqhgL2/cC1e7w2LCgJeVafVb8XQ+lkMlcaNUremupF+xn+UsM4geGhi0Pe2URhquDBPFmS9Nc6N1JyOa3vQsgk3N9YIa8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=B5+Ydgci; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="B5+Ydgci" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47JD6vqf018670; Mon, 19 Aug 2024 16:04:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=o UGJoOzcNlu4e1Btzz6EDrdKUE5D/s09/B09A0jdYhQ=; b=B5+Ydgcil8DBJ/7SE 4AQIQxYvzEfOq+aIQmzbr9p9JsbOq+mnF4dsxBIy9o9aLm7OlwMsJMSbu3oNUhZN jgAqAUsE2jdWVUhwwbuAdQN8PSemZuEF8Oao9qFxKpsTBLChgr3DFKeAOns1q6ox u+wFp9vqyF+PVNC5w6l8HpikOC0MZjYi5jUgT+q8r7aBqhxFNmWpviU9vt09VnH3 dSn5Edgdod7u9fihxuAXB4aszrXlBs0qC5+z/zAuTEpJuGccHFEDCDwNoHraOSl7 rpzI2yja+J5invp1N6VmK1JXkoB/u7l9pXKMbEg9tBtyYhTEFkL09dFELqQSUA6J LQcyw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m3hjxw4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:32 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47JEbJJQ008119; Mon, 19 Aug 2024 16:04:31 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 413h3pbbcx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2024 16:04:31 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47JG3Fex014254; Mon, 19 Aug 2024 16:04:30 GMT Received: from localhost.localdomain (dhcp-10-175-39-147.vpn.oracle.com [10.175.39.147]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 413h3pb9w5-12; Mon, 19 Aug 2024 16:04:30 +0000 From: Vegard Nossum To: Masahiro Yamada , linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nicolas Schier , Michael Ellerman , Morten Linderud , Haelwenn Monnier , Jann Horn , Kees Cook , James Bottomley , Theodore Ts'o , linux-hardening@vger.kernel.org, Vegard Nossum Subject: [RFC PATCH 11/11] kbuild: suppress echoing of commands in --dry-run mode Date: Mon, 19 Aug 2024 18:03:08 +0200 Message-Id: <20240819160309.2218114-12-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819160309.2218114-1-vegard.nossum@oracle.com> References: <20240819160309.2218114-1-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_13,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408190107 X-Proofpoint-ORIG-GUID: 0NvHgeI2o8y5pGCXm_gQktbN_3koB2c4 X-Proofpoint-GUID: 0NvHgeI2o8y5pGCXm_gQktbN_3koB2c4 If the user ran 'make -n' then we will already print all commands. Signed-off-by: Vegard Nossum --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d08ade5791c2e..a1a3e96a10ea2 100644 --- a/Makefile +++ b/Makefile @@ -96,9 +96,10 @@ ifneq ($(findstring 1, $(KBUILD_VERBOSE)),) Q = endif -# If the user is running make -s (silent mode), suppress echoing of -# commands -ifneq ($(findstring s,$(firstword -$(MAKEFLAGS))),) +# If the user is running make -s (silent mode) or -n (dry run mode), +# suppress echoing of commands +ifneq (,$(or $(findstring s,$(firstword -$(MAKEFLAGS))), \ + $(findstring n,$(firstword -$(MAKEFLAGS))))) quiet=silent_ override KBUILD_VERBOSE := endif