mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Thomas Weißschuh" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Jan Stancek <jstancek@redhat.com>,
	thomas.weissschuh@linutronix.de,
	Thomas Gleixner <tglx@linutronix.de>,
	Catalin Marinas <catalin.marinas@arm.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/urgent] arm64: vdso: Work around invalid absolute relocations from GCC
Date: Fri, 02 May 2025 19:09:31 -0000	[thread overview]
Message-ID: <174621297192.22196.5751074600127323972.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250430-vdso-absolute-reloc-v2-1-5efcc3bc4b26@linutronix.de>

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     0c314cda93258cd1f0055a278a6576b5d4aeabf5
Gitweb:        https://git.kernel.org/tip/0c314cda93258cd1f0055a278a6576b5d4aeabf5
Author:        Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate:    Wed, 30 Apr 2025 11:20:13 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 02 May 2025 20:57:11 +02:00

arm64: vdso: Work around invalid absolute relocations from GCC

All vDSO code needs to be completely position independent.  Symbol
references are marked as hidden so the compiler emits PC-relative
relocations.

However GCC emits absolute relocations for symbol-relative references with
an offset >= 64KiB. After recent refactorings in the vDSO code this is the
case in __arch_get_vdso_u_timens_data() with a page size of 64KiB.

Work around the issue by preventing the optimizer from seeing the offsets.

Fixes: 83a2a6b8cfc5 ("vdso/gettimeofday: Prepare do_hres_timens() for introduction of struct vdso_clock")
Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/all/20250430-vdso-absolute-reloc-v2-1-5efcc3bc4b26@linutronix.de
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120002
Closes: https://lore.kernel.org/lkml/aApGPAoctq_eoE2g@t14ultra/
---
 arch/arm64/include/asm/vdso/gettimeofday.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h
index 92a2b59..3322c70 100644
--- a/arch/arm64/include/asm/vdso/gettimeofday.h
+++ b/arch/arm64/include/asm/vdso/gettimeofday.h
@@ -99,6 +99,19 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode,
 	return res;
 }
 
+#if IS_ENABLED(CONFIG_CC_IS_GCC) && IS_ENABLED(CONFIG_PAGE_SIZE_64KB)
+static __always_inline const struct vdso_time_data *__arch_get_vdso_u_time_data(void)
+{
+	const struct vdso_time_data *ret = &vdso_u_time_data;
+
+	/* Work around invalid absolute relocations */
+	OPTIMIZER_HIDE_VAR(ret);
+
+	return ret;
+}
+#define __arch_get_vdso_u_time_data __arch_get_vdso_u_time_data
+#endif /* IS_ENABLED(CONFIG_CC_IS_GCC) && IS_ENABLED(CONFIG_PAGE_SIZE_64KB) */
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __ASM_VDSO_GETTIMEOFDAY_H */

  parent reply	other threads:[~2025-05-02 19:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30  9:20 [PATCH v2 0/2] vdso: Work around and reject absolute relocations Thomas Weißschuh
2025-04-30  9:20 ` [PATCH v2 1/2] arm64: vdso: Work around invalid absolute relocations from GCC Thomas Weißschuh
2025-05-02 14:19   ` Catalin Marinas
2025-05-02 19:09   ` tip-bot2 for Thomas Weißschuh [this message]
2025-04-30  9:20 ` [PATCH v2 2/2] vdso: Reject absolute relocations during build Thomas Weißschuh
2025-05-02 19:09   ` [tip: timers/urgent] " tip-bot2 for Thomas Weißschuh
2025-04-30 15:33 ` [PATCH v2 0/2] vdso: Work around and reject absolute relocations Jan Stancek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=174621297192.22196.5751074600127323972.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=catalin.marinas@arm.com \
    --cc=jstancek@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®