public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Radostin Stoyanov <rstoyanov@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/checkpointctl] f44: Fix ppc64le syscall crashes in PIE builds
Date: Mon, 19 Oct 2026 11:32:11 GMT [thread overview]
Message-ID: <179240953160.1.3829758954184012932.rpms-checkpointctl-b7fe14bcbe4a@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/checkpointctl
Branch : f44
Commit : b7fe14bcbe4ae2681857a4f44ae7ac5bd77eb2f9
Author : Radostin Stoyanov <rstoyanov@fedoraproject.org>
Date : 2026-10-19T12:31:28+01:00
Stats : +77/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/checkpointctl/c/b7fe14bcbe4ae2681857a4f44ae7ac5bd77eb2f9?branch=f44
Log:
Fix ppc64le syscall crashes in PIE builds
Apply the proposed x/sys fix that sets R12 before jumping to the syscall
wrappers. Without it, PIE binaries compute an incorrect TOC pointer and
crash when calling unix syscalls, including during the package tests.
The patch comes from https://go.dev/cl/850585 and fixes Go issue #82324.
---
diff --git a/checkpointctl.spec b/checkpointctl.spec
index 9a09ad3..1174c21 100644
--- a/checkpointctl.spec
+++ b/checkpointctl.spec
@@ -19,6 +19,9 @@ Source0: %{gosource}
Source1: %{archivename}-vendor.tar.bz2
Source2: go-vendor-tools.toml
+# https://go.dev/cl/850585
+Patch0: golang-x-sys-ppc64-pie.patch
+
BuildRequires: asciidoctor
BuildRequires: golang >= 1.26.0
BuildRequires: python3-click
@@ -31,6 +34,7 @@ container checkpoints created with Podman and Kubernetes.
%prep
%goprep -A
%setup -q -T -D -a1 %{forgesetupargs}
+%patch -P 0 -p1 -d vendor/golang.org/x/sys
%generate_buildrequires
%go_vendor_license_buildrequires -c %{S:2}
diff --git a/golang-x-sys-ppc64-pie.patch b/golang-x-sys-ppc64-pie.patch
new file mode 100644
index 0000000..6648ea2
--- /dev/null
+++ b/golang-x-sys-ppc64-pie.patch
@@ -0,0 +1,73 @@
+From fdc93002c14b8a3224c0bb94c6a1e8f8940d9793 Mon Sep 17 00:00:00 2001
+From: Juan Manuel Mendez Rey <vejeta@gmail.com>
+Date: Mon, 19 Oct 2026 02:33:30 +0200
+Subject: [PATCH] unix: set R12 before the ppc64x syscall branch
+
+The four ppc64x syscall trampolines jump to the global entry point of
+the generated ABI0 wrapper without setting R12. In a PIE that entry
+point derives its TOC from R12, as ELFv2 requires of a caller entering
+there, so the callee computes a wrong TOC and every global access
+afterwards reads or writes the wrong memory. Any PIE binary that calls
+unix.Syscall dies at startup on ppc64le.
+
+Setting R12 to the target address fixes it and keeps the indirect jump,
+so this does not reintroduce the linker range problem that
+golang/go#81981 reported. In a non-PIE build the wrapper has no TOC
+prologue and never reads R12, so the extra instruction costs nothing.
+
+Measured on a ten line program that calls unix.Syscall once, cross
+compiled for ppc64le and run under qemu-user, three runs each:
+
+ unpatched -buildmode=pie SIGSEGV 3/3
+ patched -buildmode=pie ok 3/3
+ unpatched no -buildmode=pie ok 3/3
+
+Debian's ppc64el buildd hit this on real hardware while building siso,
+which is how it was found.
+
+Fixes golang/go#82324
+
+Change-Id: I5f65469083461519f87597065646bf8b10750f72
+---
+
+diff --git a/unix/asm_linux_ppc64x.s b/unix/asm_linux_ppc64x.s
+index 2e1f4c3..e754442 100644
+--- a/unix/asm_linux_ppc64x.s
++++ b/unix/asm_linux_ppc64x.s
+@@ -12,14 +12,22 @@
+
+ // Just jump to package syscall's implementation for all these functions.
+ // The runtime may know about them.
++//
++// The indirect branch targets the global entry point of the generated ABI0
++// wrapper, which in a PIE derives its TOC from R12 as ELFv2 requires of a caller
++// entering there. Each trampoline must set R12 to the target address first. In a
++// non-PIE build the wrapper has no TOC prologue and never reads R12, so the
++// extra instruction is harmless.
+
+ TEXT ·Syscall(SB),NOSPLIT,$0-56
+ MOVD $syscall·Syscall(SB), R31
++ MOVD R31, R12
+ MOVD R31, CTR
+ JMP (CTR)
+
+ TEXT ·Syscall6(SB),NOSPLIT,$0-80
+ MOVD $syscall·Syscall6(SB), R31
++ MOVD R31, R12
+ MOVD R31, CTR
+ JMP (CTR)
+
+@@ -40,11 +48,13 @@
+
+ TEXT ·RawSyscall(SB),NOSPLIT,$0-56
+ MOVD $syscall·RawSyscall(SB), R31
++ MOVD R31, R12
+ MOVD R31, CTR
+ JMP (CTR)
+
+ TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
+ MOVD $syscall·RawSyscall6(SB), R31
++ MOVD R31, R12
+ MOVD R31, CTR
+ JMP (CTR)
+
reply other threads:[~2026-10-19 11:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=179240953160.1.3829758954184012932.rpms-checkpointctl-b7fe14bcbe4a@fedoraproject.org \
--to=rstoyanov@fedoraproject.org \
--cc=git-commits@fedoraproject.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