]> Git Repo - linux.git/commitdiff
arm64: do not descend to vdso directories twice
authorMasahiro Yamada <[email protected]>
Fri, 18 Dec 2020 02:45:40 +0000 (11:45 +0900)
committerWill Deacon <[email protected]>
Wed, 20 Jan 2021 12:18:46 +0000 (12:18 +0000)
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Will Deacon <[email protected]>
arch/arm64/Makefile
arch/arm64/kernel/Makefile
arch/arm64/kernel/vdso-wrap.S [new file with mode: 0644]
arch/arm64/kernel/vdso/Makefile
arch/arm64/kernel/vdso/vdso.S [deleted file]
arch/arm64/kernel/vdso32-wrap.S [new file with mode: 0644]
arch/arm64/kernel/vdso32/Makefile
arch/arm64/kernel/vdso32/vdso.S [deleted file]

index 90309208bb28dd39a7923eca0fd353ce93b14bf6..5b84aec31ed3bf08617d3e36edc9ab4706e56e6a 100644 (file)
@@ -188,10 +188,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
index 86364ab6f13fdfdce67beb1ba26798faee36f94e..42f6ad2c7eac30274fce6f7173d6de1d907c30ec 100644 (file)
@@ -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-wrap.S b/arch/arm64/kernel/vdso-wrap.S
new file mode 100644 (file)
index 0000000..c4b1990
--- /dev/null
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2012 ARM Limited
+ *
+ * Author: Will Deacon <[email protected]>
+ */
+
+#include <linux/init.h>
+#include <linux/linkage.h>
+#include <linux/const.h>
+#include <asm/assembler.h>
+#include <asm/page.h>
+
+       .globl vdso_start, vdso_end
+       .section .rodata
+       .balign PAGE_SIZE
+vdso_start:
+       .incbin "arch/arm64/kernel/vdso/vdso.so"
+       .balign PAGE_SIZE
+vdso_end:
+
+       .previous
+
+emit_aarch64_feature_1_and
index cd9c3fa25902fcff85958e2d3dd3b6a1a1e0756b..76c0255ecc91979cd8e28761a2e197b99d82245d 100644 (file)
@@ -44,7 +44,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/vdso/vdso.S b/arch/arm64/kernel/vdso/vdso.S
deleted file mode 100644 (file)
index c4b1990..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) 2012 ARM Limited
- *
- * Author: Will Deacon <[email protected]>
- */
-
-#include <linux/init.h>
-#include <linux/linkage.h>
-#include <linux/const.h>
-#include <asm/assembler.h>
-#include <asm/page.h>
-
-       .globl vdso_start, vdso_end
-       .section .rodata
-       .balign PAGE_SIZE
-vdso_start:
-       .incbin "arch/arm64/kernel/vdso/vdso.so"
-       .balign PAGE_SIZE
-vdso_end:
-
-       .previous
-
-emit_aarch64_feature_1_and
diff --git a/arch/arm64/kernel/vdso32-wrap.S b/arch/arm64/kernel/vdso32-wrap.S
new file mode 100644 (file)
index 0000000..e72ac7b
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2012 ARM Limited
+ */
+
+#include <linux/init.h>
+#include <linux/linkage.h>
+#include <linux/const.h>
+#include <asm/page.h>
+
+       .globl vdso32_start, vdso32_end
+       .section .rodata
+       .balign PAGE_SIZE
+vdso32_start:
+       .incbin "arch/arm64/kernel/vdso32/vdso.so"
+       .balign PAGE_SIZE
+vdso32_end:
+
+       .previous
index a1e0f91e6cea649a6527b367b16618c356905918..789ad420f16ba8567068f3e7e2dcb5f8d9e213e6 100644 (file)
@@ -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)
 
diff --git a/arch/arm64/kernel/vdso32/vdso.S b/arch/arm64/kernel/vdso32/vdso.S
deleted file mode 100644 (file)
index e72ac7b..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (C) 2012 ARM Limited
- */
-
-#include <linux/init.h>
-#include <linux/linkage.h>
-#include <linux/const.h>
-#include <asm/page.h>
-
-       .globl vdso32_start, vdso32_end
-       .section .rodata
-       .balign PAGE_SIZE
-vdso32_start:
-       .incbin "arch/arm64/kernel/vdso32/vdso.so"
-       .balign PAGE_SIZE
-vdso32_end:
-
-       .previous
This page took 0.073981 seconds and 4 git commands to generate.