Skip to content

Bugfix: unaligned access in MIPS getdents64#1425

Open
ljucovic wants to merge 1 commit into
qilingframework:devfrom
ljucovic:bugfix_getdents64_alignment
Open

Bugfix: unaligned access in MIPS getdents64#1425
ljucovic wants to merge 1 commit into
qilingframework:devfrom
ljucovic:bugfix_getdents64_alignment

Conversation

@ljucovic

Copy link
Copy Markdown
Contributor

Checklist

Which kind of PR do you create?

  • This PR only contains minor fixes.
  • This PR contains major feature update.
  • This PR introduces a new function/api for Qiling Framework.

Coding convention?

  • The new code conforms to Qiling Framework naming convention.
  • The imports are arranged properly.
  • Essential comments are added.
  • The reference of the new code is pointed out.

Extra tests?

  • No extra tests are needed for this PR.
  • I have added enough tests for this PR.
  • Tests will be added after some discussion and review.

Changelog?

  • This PR doesn't need to update Changelog.
  • Changelog will be updated after some proper review.
  • Changelog has been updated in my PR.

Target branch?

  • The target branch is dev branch.

One last thing


@retrocpugeek

retrocpugeek commented Jun 24, 2026

Copy link
Copy Markdown

Cross-linking: I hit this same alignment bug on a big-endian MIPS guest and opened #1635 (issue + repro) and #1636 (fix + regression tests).

Brief summary of #1636's fix — it covers both getdents and getdents64:

  • Rounds each record up with (d_reclen + (n - 1)) & ~(n - 1) (canonical round-up, vs (d_reclen + n) which over-pads).
  • For the legacy getdents record it places the alignment padding between d_name and d_type, keeping d_type in the last byte (offset d_reclen - 1). Padding the legacy record without relocating d_type moves the consumer's read into the pad bytes — I suspect that's what got Bugfix: unaligned access in MIPS getdents64 #1419 reverted.

Supersedes #1425. Not trying to step on this PR — happy to consolidate whichever direction the maintainers prefer.

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.

2 participants