Skip to content

fix(tools): bound total SELF alignment padding - #9291

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
veosett:codex/self-alignment-padding
Oct 22, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
veosett:codex/self-alignment-padding

Conversation

@veosett

@veosett veosett commented Oct 21, 2026 •

Copy link
Copy Markdown

What

A decrypted SELF smaller than 3 KiB can request an output buffer of roughly 1 TiB when a file-backed segment has a large alignment. The existing 64 MiB padding guard only covers empty PT_LOAD segments.

Count alignment gaps across all copied regions and the final empty-load extent against one 64 MiB budget before allocating output. Count padding rather than alignment values or payload bytes, preserving large alignments that need little padding. Rejection leaves the input and any existing output untouched. Document the input limit and add regression coverage for file-backed load/non-load regions, cumulative gaps and exact budget boundaries.

Tested

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/user/USAGE.md
PR 5925 docs/user/USAGE.md
PR 6171 docs/user/USAGE.md
PR 6788 docs/user/USAGE.md
PR 6924 docs/user/USAGE.md
PR 6946 docs/user/USAGE.md
PR 7642 docs/user/USAGE.md
PR 7918 docs/user/USAGE.md
PR 9408 docs/user/USAGE.md
PR 9508 docs/user/USAGE.md

@xXPBSXx

xXPBSXx commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Linux data point for da1d9407ed (WSL2, Ubuntu 24.04, kernel 6.18 - a virtualised kernel, not bare-metal Linux; Python 3.12.3), this head merged onto main 950388bfd (clean merge), python3 -I tools/tests/test_unwrap_self.py:

  • With the PR: 37 tests OK.
  • Without it (the PR's test_unwrap_self.py on top of main without the PR's source change): FAILED (6 failures, 6 errors).
    Not tested: macOS, Windows.

AI-assisted (Claude Code).

@THEMANnt THEMANnt left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at da1d9407ed on Windows 11 with Python 3.11.9. No actionable findings.

  • Exact PR-head SELF suite: 37 passed, no skips.
  • Cherry-picked onto local main f894ba69d300: 35 passed, no skips. The PR's newer base has two additional load-ownership regression tests.
  • Four safe negative controls reproduce main's roughly 1 TiB allocation attempts for load/non-load regions, with and without existing output. The PR refuses all four before allocating; input and existing output remain intact. No terabyte buffer was allocated.
  • Independent checks at 64 MiB minus one byte, exactly 64 MiB, and one byte above the padding budget behave as specified.
  • Unwrapped 44 existing local containers with output captured in memory; all ELF SHA-256 values match their main-generated outputs. No asset copies or uploads.
  • Conventions and whitespace checks pass.

Local validation covers the Python tool. No native rebuild, Linux/macOS run or game execution was performed for this review.

AI-assisted: yes (Codex); all results above were run locally.

@github-actions github-actions Bot added the docs label Oct 22, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 22, 2026
@oneandonlydean
oneandonlydean merged commit 44ce348 into boykopovar:main Oct 22, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants