From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 3F78C395ADA; Tue, 8 Sep 2026 06:33:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788849235; cv=none; b=N+gghTKEHLDJujAeyEjRLaIoRpgDPgEzBOHYxDoGIQ25RdIPtcSs02M7CXndb0oqqRHuuZAoJpW2phmOT86IzaLeHNUMMJM+YkZxaB/WqgmxkfCgN8UUEWBmZs1B8e6fkrocazo9SuFJTWpS1GP26tZCEIzGRFgnbRJbQoC/5I8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788849235; c=relaxed/simple; bh=HrYSsshejm3MdwopK0QyrP0YNb7baHfULTYkmKafnyk=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=mEr0ORhe9u+2TM31VNLJqnVG1SMjeonQVBO2xQnqRcLTh6NOj381ToeCm9JUTRmo8NXiFlJ/Se49D5YZMc0Yp75Zn4JmI/BSA+hyfY/hh7jQAlqCg2JVtOBLtw4wFCPidTH1OQFEThf06EkJb3+v1fg6f6EB8oMV1CRLfJYtosU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ugOOuW9q; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=An9/D7tx; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ugOOuW9q"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="An9/D7tx" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1788849227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Cp0o8EDFYqgaI/CEiEvUg/mXT7EeRnDPR+/NOomvS88=; b=ugOOuW9qKhAU3jefF5rh08PT3vrE2IXdbueWnqZqCpmyV5bvOudbWlrbHjpeje1u8xgjfv AKlGo1M9CxgVkcWML1tdQGO/+Yr8wRNl4W1A12PQz3BNS1oUOkekAz+Ae2u3Y3gaWX6IOs JtboaftOyUindIxACXrEnFvSVVXEFw0jfPd2Zaq9Wtkkl+YHzfskypxnguHiNVMOQLXuwJ ChiyKIktCY98YbQi6nKlJ+gVx5YgpcujMOZYC1T+Yw0xzGUGXsCB76CVtAr/DucEjwjQ3A sF3OFbYIbiqCePh0eg5o0M79ii6HYcWDmcoD0jLFasuMbIDQ6s/LvL3pagYykA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1788849227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Cp0o8EDFYqgaI/CEiEvUg/mXT7EeRnDPR+/NOomvS88=; b=An9/D7tx9snxErbmaoktle4MclQvGq4BeA4eqME/OXmkgI1ozhe/GSz/tKB6Fu1fAZBtoW ktDVIIqBQgCerXCw== Subject: [PATCH v5 00/24] vdso: Reject absolute relocations during build Date: Tue, 08 Sep 2026 08:33:34 +0200 Message-Id: <20260908-vdso-absolute-reloc-v5-0-3a93791af1cf@linutronix.de> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/23Ny2rDMBCF4VcJWldFGl3dVd+jZKHLuBEYK0iOS Al+9yiBklK0/A/MNzdSsSSs5ONwIwVbqimvPdTbgYSTW7+RptibAAPFJFjaYs3U+ZqXy4a04JI DdQAaJhG40Zz0y3PBOV2f6tex9ynVLZef55PGH+uvNw29ximjkzWOuTly5tXnktbLVvKaru8Ry cNs8McRbOxAdxTOIQgfpAc9csTL0ZyPHdEdaexkohHGSj9y5MuxHMaO7I7mznrNFSoM/5193+9 FRYP1kgEAAA== X-Change-ID: 20250428-vdso-absolute-reloc-a226293c1761 To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Vincenzo Frascino , Kees Cook , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Richard Weinberger , Anton Ivanov , Johannes Berg , Russell King , Catalin Marinas , Will Deacon , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Huacai Chen , WANG Xuerui , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Bogendoerfer , Miguel Ojeda , Alex Gaynor , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Thomas Gleixner , Christophe Leroy , Boqun Feng , Nicolas Schier Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-mm@kvack.org, linux-um@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, linux-s390@vger.kernel.org, linux-mips@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org, Jan Stancek , Arnaldo Carvalho de Melo , Alexandre Ghiti , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1788849226; l=5051; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=HrYSsshejm3MdwopK0QyrP0YNb7baHfULTYkmKafnyk=; b=6vZ688HbgWJhdTRQDorQBzK+M44QpmiNq6teG+NERQLRF70axqHuYGFGpQXkaBAwsvu/byckc GVjxkQ/ryyNA0SOqbZDiyxRuUih42hmJ5lsZUQGQM/E4vA20m25CVaf X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The compiler can emit absolute relocations in vDSO code, which are invalid in vDSO code. Detect them at compile-time. libc elf.h is missing some of the relocation constants, so make use of the kernels own UAPI headers instead. Patches 13 onward contain the architecture specific changes, interesting for the architecture maintaines. Kbuild and Rust folks: This contains custom definitions of hostprog bindgen and rust library commands. These are currently only defined inside the subsystem directory. Let me know if they should go into scripts/Makefile.host. Signed-off-by: Thomas Weißschuh --- Changes in v5: - Rebase on v7.3-rc1 - s/HOSTRUSTLIB/HOSTRUSTC L/ - Pick up review tags. - Also handle SPARC. - Build 'vdsocheck' during the prepare phase. - Drop now unnecessary riscv LTO preparation patches. - Link to v4: https://lore.kernel.org/r/20250812-vdso-absolute-reloc-v4-0-61a8b615e5ec@linutronix.de Changes in v4: - Replace the inline shell logic with a dedicated build-time tool - Link to v3: https://lore.kernel.org/r/20250611-vdso-absolute-reloc-v3-0-47897d73784b@linutronix.de Changes in v3: - Drop already applied bugfix for arm64 - Disable LTO for the riscv vDSO, as it is incompatible - Link to v2: https://lore.kernel.org/r/20250430-vdso-absolute-reloc-v2-0-5efcc3bc4b26@linutronix.de Changes in v2: - Link to openend (invalid) GCC bug containing more explanations - Refine commit messages - Don't fail on commit absolute relocations in debug info - Link to v1: https://lore.kernel.org/r/20250429-vdso-absolute-reloc-v1-0-987a0afd10b5@linutronix.de --- Thomas Weißschuh (24): elf, uapi: Add a header for relocation constants x86/elf, um/x86/elf: Move relocation constants to UAPI ARM: elf: Move relocation constants to UAPI arm64: elf: Move relocation constants to UAPI powerpc/elf: Move relocation constants to UAPI riscv: elf: Move relocation constants to UAPI LoongArch: Move relocation constants to UAPI s390/elf: Move relocation constants to UAPI MIPS: ELF: Move relocation constants to UAPI sparc: elf: Move relocation constants to UAPI tools headers UAPI: Sync ELF headers with the kernel sources vdso: Add the vdsocheck tool x86/vdso: Enable the vdsocheck tool ARM: vdso: Enable the vdsocheck tool arm64: vdso: Enable the vdsocheck tool powerpc/elf: Add 32-bit REL16 relocation definitions powerpc/vdso: Enable the vdsocheck tool riscv: vdso: Enable the vdsocheck tool LoongArch: vDSO: Enable the vdsocheck tool s390/vdso: Enable the vdsocheck tool MIPS: ELF: Add more PC-relative relocation definitions MIPS: vdso: Enable the vdsocheck tool sparc: vdso: Enable the vdsocheck tool vDSO: Automatically enable VDSO_CHECK Makefile | 19 + arch/arm/include/asm/elf.h | 24 - arch/arm/vdso/Makefile | 4 +- arch/arm64/include/asm/elf.h | 55 --- arch/arm64/kernel/vdso/Makefile | 4 +- arch/loongarch/include/asm/elf.h | 130 ----- arch/loongarch/vdso/Makefile | 4 +- arch/mips/include/asm/elf.h | 55 --- arch/mips/vdso/Makefile | 8 +- arch/powerpc/include/uapi/asm/elf.h | 201 -------- arch/powerpc/kernel/vdso/Makefile | 4 +- arch/riscv/include/uapi/asm/elf.h | 66 --- arch/riscv/kernel/vdso/Makefile | 4 +- arch/s390/include/asm/elf.h | 83 ---- arch/s390/kernel/vdso/Makefile | 4 +- arch/sparc/include/asm/elf_32.h | 43 -- arch/sparc/include/asm/elf_64.h | 44 -- arch/sparc/vdso/Makefile | 5 +- arch/x86/entry/vdso/common/Makefile.include | 2 +- arch/x86/include/asm/elf.h | 33 -- arch/x86/um/asm/elf.h | 33 -- include/uapi/linux/elf-r.h | 705 ++++++++++++++++++++++++++++ include/uapi/linux/elf.h | 1 + lib/vdso/Kconfig | 7 + lib/vdso/Makefile | 2 + lib/vdso/Makefile.include | 14 + lib/vdso/check/.gitignore | 3 + lib/vdso/check/Makefile | 34 ++ lib/vdso/check/elf.rs | 498 ++++++++++++++++++++ lib/vdso/check/vdsocheck.rs | 299 ++++++++++++ tools/include/uapi/linux/elf-em.h | 71 +++ tools/include/uapi/linux/elf-r.h | 705 ++++++++++++++++++++++++++++ tools/include/uapi/linux/elf.h | 112 ++++- 33 files changed, 2479 insertions(+), 797 deletions(-) --- base-commit: 2f737a133fad3808f9993f704fb27fd7791a0a41 change-id: 20250428-vdso-absolute-reloc-a226293c1761 Best regards, -- Thomas Weißschuh