Skip to content

Make ELF AT_RANDOM contents process-specific - #1693

Open
carlosqwqqwq wants to merge 1 commit into
qilingframework:devfrom
carlosqwqqwq:codex/qiling-d101-at-random
Open

carlosqwqqwq wants to merge 1 commit into
qilingframework:devfrom
carlosqwqqwq:codex/qiling-d101-at-random

Conversation

@carlosqwqqwq

Copy link
Copy Markdown

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; the existing os import is reused.
  • The direct standard-library call needs no additional code comment.
  • References for the ELF AT_RANDOM contract are included below.

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

Summary

The ELF loader currently stores the literal string 'a' * 16 at the address published as AT_RANDOM, so each newly loaded guest receives the same 16 bytes. This change writes 16 bytes from os.urandom through the existing stack helper and leaves the auxiliary-vector layout unchanged.

Fixes #1692.

Validation

  • cd tests && PYTHONPATH=.. python3 -m unittest test_elf_at_random — passed.
  • cd tests && PYTHONPATH=.. python3 test_posix.py ElfAtRandomTests — passed.
  • A static RV64 Linux probe was also run under Qiling and QEMU user; repeated Qiling launches returned distinct 16-byte values.

References

@carlosqwqqwq
carlosqwqqwq force-pushed the codex/qiling-d101-at-random branch from 0525acc to 42536bc Compare November 23, 2026 19:23
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.

1 participant