From patchwork Fri Dec 18 02:45:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11981077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 671ADC4361B for ; Fri, 18 Dec 2020 02:47:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0E4F92228A for ; Fri, 18 Dec 2020 02:47:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E4F92228A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=8DCjv22hN4AVF+I1Wne92ZwfOlcjOW+HYKv74pMgjHw=; b=DMR5rP/pbpA7tns4qkD5wOY2RB GlAjitgWCKtD8iSG3XVYBtf3/YDKaM1JrIAPHk4N70boGm0UXnmdgLCVPqwPMTq6/tNuYSvRG731l H+/LId9zX6q/3MyX+oDrvc4J0d23N1MdB7l4F25NpGW1hIWSTqpqNrkpyUBDt9gKsCxGrWCHqi9zM JRXHK1fxyTNGzLKEWvPCtADURFLFC8BlpXxHaUMlO5J+KXA4ly+NcxHyxXioppTXyvnCs9nOOpKDr Fa/E+BecsexX+A6884UP7+xV8W+ZdNJRfsoBsS/OJ/y0rqnZEBb7a/sSoMuGshPQ/TWNu8rl45C7M mhOF9iZg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kq5mg-0000WF-3J; Fri, 18 Dec 2020 02:46:22 +0000 Received: from conuserg-09.nifty.com ([210.131.2.76]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kq5mc-0000VN-9h for linux-arm-kernel@lists.infradead.org; Fri, 18 Dec 2020 02:46:20 +0000 Received: from oscar.flets-west.jp (softbank126090214151.bbtec.net [126.90.214.151]) (authenticated) by conuserg-09.nifty.com with ESMTP id 0BI2jiPf019455; Fri, 18 Dec 2020 11:45:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 0BI2jiPf019455 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1608259545; bh=qPO/CeFS916iiTlmoorEws7SZCbGYT3y30FxASNWlXY=; h=From:To:Cc:Subject:Date:From; b=ASh8EJOKtMoLmEkmBgZrSl/3bpm2TTRDE51v7Cvn4Qm1u5vopOVBmYaTgc0kfBGnX MwNa1SytSQZHFG9kE+fKdZ5TTZJWzNFbPo4gjJR3KKFTX9mXjJPb2GHN6oV//8tPn0 H4fP5ucdPYRx2w459we6f3OUqWyGzYanqy6mx3YnFpnnI0ODY5eZqo+SLF9ndT+5Nh 22NJIgXte2tBEn/iqEs/SpbRaBNVJY3kzRb+bDAu51S90UuU7eHLd3UouXjph0wLvj GACdLjGcgiJSkZEVjhACRT/YvrJ9+fNykSY0DJTRdamIJy+S4drpeLzA8ZEanmPsiX ENDwZ4iLBuuCA== X-Nifty-SrcIP: [126.90.214.151] From: Masahiro Yamada To: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: do not descend to vdso directories twice Date: Fri, 18 Dec 2020 11:45:40 +0900 Message-Id: <20201218024540.1102650-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201217_214618_819009_98B03DB3 X-CRM114-Status: GOOD ( 14.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Ellerman , Masahiro Yamada , linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org arm64 descends into each vdso directory twice; first in vdso_prepare, second during the ordinary build process. PPC mimicked it and uncovered a problem [1]. In the first descend, Kbuild directly visits the vdso directories, therefore it does not inherit subdir-ccflags-y from upper directories. This means the command line parameters may differ between the two. If it happens, the offset values in the generated headers might be different from real offsets of vdso.so in the kernel. This potential danger should be avoided. The vdso directories are built in the vdso_prepare stage, so the second descend is unneeded. [1]: https://lore.kernel.org/linux-kbuild/CAK7LNARAkJ3_-4gX0VA2UkapbOftuzfSTVMBbgbw=HD8n7N+7w@mail.gmail.com/T/#ma10dcb961fda13f36d42d58fa6cb2da988b7e73a Signed-off-by: Masahiro Yamada --- arch/arm64/Makefile | 10 ++++++---- arch/arm64/kernel/Makefile | 5 +++-- arch/arm64/kernel/{vdso/vdso.S => vdso-wrap.S} | 0 arch/arm64/kernel/vdso/Makefile | 1 - arch/arm64/kernel/{vdso32/vdso.S => vdso32-wrap.S} | 0 arch/arm64/kernel/vdso32/Makefile | 1 - 6 files changed, 9 insertions(+), 8 deletions(-) rename arch/arm64/kernel/{vdso/vdso.S => vdso-wrap.S} (100%) rename arch/arm64/kernel/{vdso32/vdso.S => vdso32-wrap.S} (100%) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 6a87d592bd00..f18d20a68170 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -179,10 +179,12 @@ ifeq ($(KBUILD_EXTMOD),) # this hack. prepare: vdso_prepare vdso_prepare: prepare0 - $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso include/generated/vdso-offsets.h - $(if $(CONFIG_COMPAT_VDSO),$(Q)$(MAKE) \ - $(build)=arch/arm64/kernel/vdso32 \ - include/generated/vdso32-offsets.h) + $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso \ + include/generated/vdso-offsets.h arch/arm64/kernel/vdso/vdso.so +ifdef CONFIG_COMPAT_VDSO + $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 \ + include/generated/vdso32-offsets.h arch/arm64/kernel/vdso32/vdso.so +endif endif define archhelp diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 86364ab6f13f..42f6ad2c7eac 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -59,9 +59,10 @@ obj-$(CONFIG_CRASH_CORE) += crash_core.o obj-$(CONFIG_ARM_SDE_INTERFACE) += sdei.o obj-$(CONFIG_ARM64_PTR_AUTH) += pointer_auth.o obj-$(CONFIG_ARM64_MTE) += mte.o +obj-y += vdso-wrap.o +obj-$(CONFIG_COMPAT_VDSO) += vdso32-wrap.o -obj-y += vdso/ probes/ -obj-$(CONFIG_COMPAT_VDSO) += vdso32/ +obj-y += probes/ head-y := head.o extra-y += $(head-y) vmlinux.lds diff --git a/arch/arm64/kernel/vdso/vdso.S b/arch/arm64/kernel/vdso-wrap.S similarity index 100% rename from arch/arm64/kernel/vdso/vdso.S rename to arch/arm64/kernel/vdso-wrap.S diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index a8f8e409e2bf..85222f64f394 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile @@ -45,7 +45,6 @@ endif # Disable gcov profiling for VDSO code GCOV_PROFILE := n -obj-y += vdso.o targets += vdso.lds CPPFLAGS_vdso.lds += -P -C -U$(ARCH) diff --git a/arch/arm64/kernel/vdso32/vdso.S b/arch/arm64/kernel/vdso32-wrap.S similarity index 100% rename from arch/arm64/kernel/vdso32/vdso.S rename to arch/arm64/kernel/vdso32-wrap.S diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile index a1e0f91e6cea..789ad420f16b 100644 --- a/arch/arm64/kernel/vdso32/Makefile +++ b/arch/arm64/kernel/vdso32/Makefile @@ -155,7 +155,6 @@ c-obj-vdso-gettimeofday := $(addprefix $(obj)/, $(c-obj-vdso-gettimeofday)) asm-obj-vdso := $(addprefix $(obj)/, $(asm-obj-vdso)) obj-vdso := $(c-obj-vdso) $(c-obj-vdso-gettimeofday) $(asm-obj-vdso) -obj-y += vdso.o targets += vdso.lds CPPFLAGS_vdso.lds += -P -C -U$(ARCH)