Skip to content

🐛 bug: Fix usage of runtime RO data for ppc64 and s390x platforms#3772

Merged
ReneWerner87 merged 1 commit intomainfrom
fix-alignment-issues-for-non-amd64-architectures
Oct 1, 2025
Merged

🐛 bug: Fix usage of runtime RO data for ppc64 and s390x platforms#3772
ReneWerner87 merged 1 commit intomainfrom
fix-alignment-issues-for-non-amd64-architectures

Conversation

@gaby
Copy link
Member

@gaby gaby commented Sep 30, 2025

Summary

  • restrict the runtime rodata alignment helper to platforms other than s390x/ppc64/ppc64le
  • provide a strict-alignment fallback that always treats pointers as writable on those platforms

Fixes #3771

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 30, 2025

Walkthrough

Introduces architecture-specific build constraints for read-only checks. Excludes readonly.go on s390x/ppc64/ppc64le and adds readonly_strict.go for those architectures with isReadOnly always returning false. No exported API changes; behavior on other architectures remains unchanged.

Changes

Cohort / File(s) Summary of Changes
Arch-specific build constraints for read-only check
readonly.go, readonly_strict.go
readonly.go now excluded on s390x, ppc64, ppc64le via build tag. Added readonly_strict.go for those architectures, defining unexported isReadOnly(_ unsafe.Pointer) bool that returns false. No public declarations modified.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Build System
    participant App as Application
    participant RO as isReadOnly

    rect rgb(240,245,255)
    note over Dev: Compile-time selection
    Dev->>Dev: Check GOARCH
    alt GOARCH in {s390x, ppc64, ppc64le}
        Dev->>App: Include readonly_strict.go
        note over App: isReadOnly always false
    else Other architectures
        Dev->>App: Include readonly.go
        note over App: isReadOnly performs .rodata check
    end
    end

    rect rgb(245,255,245)
    note over App,RO: Runtime call
    App->>RO: isReadOnly(ptr)
    alt Strict-arch build
        RO-->>App: false
    else Other archs
        RO-->>App: result of .rodata check
    end
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A bunny bounds through arches three,
S/390 winds and PPC,
I sniff the bytes—no trips today,
Read-only checks hop out the way.
On friendly fields they still may run,
But strict terrains? We keep it fun. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning While the description includes a concise summary and the issue reference, it omits several required sections from the repository’s template—such as “Changes introduced,” “Type of change,” and the PR checklist—and therefore does not fully adhere to the prescribed structure. Please expand the description to include a “Changes introduced” section detailing the new build constraints and fallback implementation, specify the type of change, and complete the checklist items as outlined in the template.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ⚠️ Warning The title captures the core intent of fixing runtime read-only data handling on non-AMD64 architectures but includes distracting noise with an emoji and a redundant “bug:” prefix while also omitting the ppc64le platform addressed by the changeset, which detracts from clarity and completeness. Please revise the title to remove the emoji and redundant prefix and explicitly list all affected architectures; for example: “Fix runtime rodata alignment on s390x, ppc64, and ppc64le platforms.”
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues Check ✅ Passed The changes add the correct build constraints to exclude the unsafe alignment helper on s390x, ppc64, and ppc64le and introduce a fallback that treats pointers as writable, directly satisfying the objectives of linked issue #3771.
Out of Scope Changes Check ✅ Passed All modifications are confined to adding build tags and a no-op fallback for strict-alignment architectures, addressing only the alignment issue without introducing unrelated changes.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-alignment-issues-for-non-amd64-architectures

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.64%. Comparing base (b25339d) to head (82b09b3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3772      +/-   ##
==========================================
- Coverage   91.70%   91.64%   -0.06%     
==========================================
  Files         113      113              
  Lines       11940    11940              
==========================================
- Hits        10949    10943       -6     
- Misses        728      733       +5     
- Partials      263      264       +1     
Flag Coverage Δ
unittests 91.64% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gaby gaby changed the title Refine read-only detection build constraints 🐛 bug: Add build tags for ppc a Sep 30, 2025
@gaby gaby changed the title 🐛 bug: Add build tags for ppc a 🐛 bug: Add build tags for ppc64 and s390x platforms Sep 30, 2025
@gaby gaby marked this pull request as ready for review September 30, 2025 23:59
@gaby gaby requested a review from a team as a code owner September 30, 2025 23:59
@gaby gaby requested review from ReneWerner87, Copilot, efectn and sixcolors and removed request for Copilot September 30, 2025 23:59
@gaby gaby added this to v3 Sep 30, 2025
@gaby gaby added this to the v3 milestone Sep 30, 2025
@gaby gaby moved this to In Progress in v3 Sep 30, 2025
@gaby gaby changed the title 🐛 bug: Add build tags for ppc64 and s390x platforms 🐛 bug: Fix usage of runtime RO data for ppc64 and s390x platforms Oct 1, 2025
@ReneWerner87 ReneWerner87 merged commit 58514f3 into main Oct 1, 2025
16 checks passed
@ReneWerner87 ReneWerner87 deleted the fix-alignment-issues-for-non-amd64-architectures branch October 1, 2025 10:21
@github-project-automation github-project-automation bot moved this from In Progress to Done in v3 Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: Fiber crashes on non-amd64/arm64 architectures because of unsafe .rodata check

2 participants