Skip to content

Initialize the ELF shellcode entry point for Qdb - #1677

Open
Lisoon22 wants to merge 1 commit into
qilingframework:devfrom
Lisoon22:fix/elf-shellcode-entry-point
Open

Lisoon22 wants to merge 1 commit into
qilingframework:devfrom
Lisoon22:fix/elf-shellcode-entry-point

Conversation

@Lisoon22

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.
  • Essential comments are added. (No additional code comments are needed for this one-line fix; the loader contract is documented.)
  • The reference of the new code is pointed out. (Fixes Shellcode does not have an entry_point set #1608.)

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


ELF shellcode loading sets the OS entry point and load address but leaves the loader entry point undefined. Initializing Qdb then raises AttributeError when it reads ql.loader.entry_point.

Set the loader entry point to the mapped shellcode start while preserving Qiling.entry_point as the optional run(begin=...) override.

Add a regression that initializes real Qdb instances for x86 and x86-64 shellcode, mocking only the interactive command loop and context rendering. It verifies the mapped code, initial PC and debugger startup.

Fixes #1608.

Validation

  • The regression fails before the fix with the reported AttributeError on both architectures.
  • The focused Qdb regression and existing shellcode suite pass: 9 tests, including x86 and x86-64 subtests.
  • These 9 tests also pass locally on Arch Linux with Python 3.12.16 and Unicorn 2.1.3.
  • Additional validation on Linux with Python 3.12.14: ordinary x86-64 ELF loading, ARM Qdb and ARM U-Boot tests pass.
  • The patch applies to a clean worktree, where the focused regression and shellcode suite also pass.
  • CLI help, Python syntax checks and git diff --check pass.

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