Skip to content

fix: check .gopclntab before .data.rel.ro for PIE binaries#330

Open
jiridanek wants to merge 1 commit intoopenshift:mainfrom
jiridanek:fix-go126-pie-gopclntab
Open

fix: check .gopclntab before .data.rel.ro for PIE binaries#330
jiridanek wants to merge 1 commit intoopenshift:mainfrom
jiridanek:fix-go126-pie-gopclntab

Conversation

@jiridanek
Copy link
Copy Markdown
Member

Summary

Go 1.26 changed the ELF layout for PIE builds: .gopclntab is now emitted as a
separate section instead of being embedded in .data.rel.ro (the Go <= 1.25
behavior). ReadTable unconditionally redirected to .data.rel.ro when it saw
-buildmode=pie, causing "could not find magic number" failures on any Go
1.26-built PIE binary.

This fix always checks .gopclntab first, falling back to .data.rel.ro only
if absent. This is backward-compatible since Go <= 1.25 PIE binaries don't have
.gopclntab.

Fixes #329

Evidence

Binary comparison of two s390x skopeo builds from RHEL 9 container images:

Binary Go version .gopclntab section Magic in .data.rel.ro check-payload result
skopeo 1.22.2 (appstream) go1.26.1 Present (magic at offset 0) Not present FAIL
skopeo 1.18.1 (appstream-eus) go1.25.8 Absent Present PASS

This will affect all architectures once more RPMs are rebuilt with Go 1.26.

Made with Cursor

Go 1.26 changed the ELF layout for PIE builds: .gopclntab is now
emitted as a separate section instead of being embedded in
.data.rel.ro (the Go <= 1.25 behavior).

ReadTable unconditionally redirected to .data.rel.ro when it saw
-buildmode=pie, causing "could not find magic number" failures on
any Go 1.26-built PIE binary.

Fix: always check .gopclntab first, fall back to .data.rel.ro only
if absent. This is backward-compatible since Go <= 1.25 PIE binaries
don't have .gopclntab.

Fixes openshift#329

Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci openshift-ci Bot requested review from rhmdnd and richardsonnick May 9, 2026 10:46
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 9, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jiridanek
Once this PR has been reviewed and has the lgtm label, please assign mrunalp for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 9, 2026

@jiridanek: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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.

ReadTable fails on Go 1.26 PIE binaries that have a separate .gopclntab section

1 participant