Skip to content

[PW_SID:990359] vdso: Reject absolute relocations during build - #758

Closed
linux-riscv-bot wants to merge 24 commits into
workflow__riscv__fixesfrom
pw990359
Closed

[PW_SID:990359] vdso: Reject absolute relocations during build#758
linux-riscv-bot wants to merge 24 commits into
workflow__riscv__fixesfrom
pw990359

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 990359 applied to workflow__riscv__fixes

Name: vdso: Reject absolute relocations during build
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=990359
Version: 4

t-8ch added 24 commits August 12, 2025 08:04
While the numeric constants for relocations are architecture specific,
it is still useful to get access to them from other architectures.
Also the definitions are useful for userspace in general.
For example tools processing elf files during a kernel cross-compilation
can make use of them.

Introduce a dedicated header for them, similar to the elf-em.h header.
For now the header is empty but it will be filled step by step in
upcomming commits.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These constants are useful for cross-platform userspace, for example to
process ELF files during kernel cross-compilation.

Move them from the kernel-private architecture-specific header to the UAPI.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These constants are useful for cross-platform userspace, for example to
process ELF files during kernel cross-compilation.

Move them from the kernel-private architecture-specific header to the UAPI.

One arm64 header is also changed as it duplicates an arm definition.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These constants are useful for cross-platform userspace, for example to
process ELF files during kernel cross-compilation.

Move them from the kernel-private architecture-specific header to the UAPI.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These constants are useful for cross-platform userspace, for example to
process ELF files during kernel cross-compilation.

Move them from the kernel-private architecture-specific header to the UAPI.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These constants are useful for cross-platform userspace, for example to
process ELF files during kernel cross-compilation.

Move them from the kernel-private architecture-specific header to the UAPI.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These constants are useful for cross-platform userspace, for example to
process ELF files during kernel cross-compilation.

Move them from the kernel-private architecture-specific header to the UAPI.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These constants are useful for cross-platform userspace, for example to
process ELF files during kernel cross-compilation.

Move them from the kernel-private architecture-specific header to the UAPI.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These constants are useful for cross-platform userspace, for example to
process ELF files during kernel cross-compilation.

Move them from the kernel-private architecture-specific header to the UAPI.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Pick up changes from the UAPI ELF header files.
This picks up general changes to elf.h, elf-em.h which was forgotten
previously and the new elf-r.h.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
All vDSO code needs to be completely position independent. Symbol
references are marked as hidden so the compiler emits PC-relative
relocations. However there are cases where the compiler may still
emit absolute relocations, as they are valid in regular PIC DSO code.
These would be resolved by the linker and will break at runtime.
This has been observed on arm64, see commit 0c314cd ("arm64: vdso:
Work around invalid absolute relocations from GCC")

Introduce a tool to check for absolute relocations during the build,
as the current inline-shell logic is not expressive enough.
The check is done on the object files as the relocations will not exist
anymore in the final DSO. As there is no extension point for the
compilation of each object file, perform the validation in vdso_check.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The vdsocheck tool validates the object files and final .so library.
It can detect if the compiler created relocations which are incompatible
with the vDSO which need to be worked around.

Wire it up for the architecture.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The vdsocheck tool validates the object files and final .so library.
It can detect if the compiler created relocations which are incompatible
with the vDSO which need to be worked around.

Wire it up for the architecture.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The vdsocheck tool validates the object files and final .so library.
It can detect if the compiler created relocations which are incompatible
with the vDSO which need to be worked around.

Wire it up for the architecture.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These are used by userspace and are necessary for the vdsocheck tool.
They share the numbers with their 64-bit variants.

Also update the copy in tools/ so they can be used by vdsocheck.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The vdsocheck tool validates the object files and final .so library.
It can detect if the compiler created relocations which are incompatible
with the vDSO which need to be worked around.

Wire it up for the architecture.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
All vDSO objects need the same treatment.
To make changes to both the list of objects and the list of removed flags
easier, introduce a helper variable.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
All the other architectures supporting LTO (x86, arm64, loongarch) do not
use it for the vDSO.

Its is problematic for some upcoming compile-time validation of the
generated object code.
The LTO object files do not contain the necessary relocation information
and -flto-fat-objects is not compatible with clang < 16.

For consistency and to enable the mentioned compile-time checks,
disable LTO for the vDSO.
The vDSO heavily uses __always_inline anyways.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The vdsocheck tool validates the object files and final .so library.
It can detect if the compiler created relocations which are incompatible
with the vDSO which need to be worked around.

Wire it up for the architecture.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The vdsocheck tool validates the object files and final .so library.
It can detect if the compiler created relocations which are incompatible
with the vDSO which need to be worked around.

Wire it up for the architecture.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The vdsocheck tool validates the object files and final .so library.
It can detect if the compiler created relocations which are incompatible
with the vDSO which need to be worked around.

Wire it up for the architecture.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
These are used by userspace and are necessary for the vdsocheck tool.

Also update the copy in tools/ so they can be used by vdsocheck.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The vdsocheck tool validates the object files and final .so library.
It can detect if the compiler created relocations which are incompatible
with the vDSO which need to be worked around.

Wire it up for the architecture.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
All users of the generic vDSO are now using the vdsocheck tool.

Remove the now unnecessary kconfig option.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4,01/24] elf, uapi: Add a header for relocation constants"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 104.89 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4,01/24] elf, uapi: Add a header for relocation constants"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 2265.13 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4,01/24] elf, uapi: Add a header for relocation constants"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2877.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4,01/24] elf, uapi: Add a header for relocation constants"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.98 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4,01/24] elf, uapi: Add a header for relocation constants"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 22.53 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4,01/24] elf, uapi: Add a header for relocation constants"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.95 seconds
Result: WARNING
Output:

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#28: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 12 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 9455f692a8d6 ("elf, uapi: Add a header for relocation constants") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 1 warnings, 0 checks, 12 lines checked
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?


@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 22: "[v4,22/24] MIPS: ELF: Add more PC-relative relocation definitions"
kdoc
Desc: Detects for kdoc errors
Duration: 0.91 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 22: "[v4,22/24] MIPS: ELF: Add more PC-relative relocation definitions"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 22: "[v4,22/24] MIPS: ELF: Add more PC-relative relocation definitions"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 22: "[v4,22/24] MIPS: ELF: Add more PC-relative relocation definitions"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 105.33 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1061.21 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1345.77 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 21.29 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 22.45 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.10 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 75.51 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
kdoc
Desc: Detects for kdoc errors
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 23: "[v4,23/24] MIPS: vdso: Enable the vdsocheck tool"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 106.38 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1083.77 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1383.31 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.94 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 22.65 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.97 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 77.00 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
kdoc
Desc: Detects for kdoc errors
Duration: 0.91 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 24: "[v4,24/24] vdso/vdsocheck: Drop the transitional kconfig option"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
linux-riscv-bot deleted the pw990359 branch August 20, 2025 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants