Skip to content

Conversation

@elicn
Copy link
Member

@elicn elicn commented Oct 10, 2024

[Merge only after Unicorn 2.1.2 is officially released]

Highlights:

  • Introduced co-processor register accessors to AArch32 and AArch64 (ql.arch.cpr)
  • Replaced deprecated pseudo registers with cpr definitions to be used with the new accessors
  • Separated x86 64-bit only registers from the rest as Unicorn became less tolerant to accessing unsupported registers
  • SSE instructions are no longer supported on the default Intel CPU model. x86 tests that use SSE instructions are now set to use Intel Haswell CPU model to make sure SSE is supported
  • Various opportunistic styling and annotation fixes

Fixes: #1495, #1329

@elicn elicn requested review from wtdcode and xwings October 10, 2024 15:46
@wtdcode
Copy link
Member

wtdcode commented Oct 10, 2024

The next release will be 2.1.2 and it seems only Separated x86 64-bit only registers from the rest as Unicorn became less tolerant to accessing unsupported registers needs 2.2?

@elicn
Copy link
Member Author

elicn commented Oct 10, 2024

Ah, no, that's probably my mistake. I'll fix the title accordingly.

@elicn elicn changed the title Adjust Qiling to comply with latest changed in Unicorn 2.2 Adjust Qiling to comply with latest changed in Unicorn 2.1.2 Oct 10, 2024
@elicn elicn linked an issue Oct 10, 2024 that may be closed by this pull request
@wtdcode
Copy link
Member

wtdcode commented Feb 13, 2025

2.1.2 is alive. I will give this PR a shot recently.

@xwings
Copy link
Member

xwings commented Feb 16, 2025

@elicn looks like we need few more fix ?

@elicn
Copy link
Member Author

elicn commented Feb 16, 2025

@xwings, this is mostly because Qiling is still set to use the older Unicorn release.
We can start by setting Qiling to use the most recent one, and then see if it fails. From a quick smoke test it looks like there are a few additional fixes to be made.

@wtdcode
Copy link
Member

wtdcode commented Feb 17, 2025

The mips breakage (testing test_mips32eb_fake_urandom) breaks with 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2 with:

[=] 	brk(inp = 0x0) = 0x56568000
[=] 	mmap2(addr = 0x0, length = 0x2000, prot = 0x3, flags = 0x802, fd = 0xffffffff, pgoffset = 0x0) = 0x1000000
[=] 	uname(buf = 0x7ff3c674) = 0x0
[=] 	access(path = 0x47dcb04, mode = 0x4) = -0x2 (ENOENT)
E
======================================================================
ERROR: test_mips32eb_fake_urandom (__main__.ELFTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mio/opensource/qiling/tests/test_elf.py", line 462, in test_mips32eb_fake_urandom
    ql.run()
  File "/home/mio/opensource/qiling/qiling/core.py", line 588, in run
    self.os.run()
  File "/home/mio/opensource/qiling/qiling/os/linux/linux.py", line 178, in run
    self.ql.emu_start(self.ql.loader.entry_point, entry_address, self.ql.timeout)
  File "/home/mio/opensource/qiling/qiling/core.py", line 768, in emu_start
    raise self.internal_exception
  File "/home/mio/opensource/qiling/qiling/core_hooks.py", line 141, in wrapper
    return callback(*args, **kwargs)
  File "/home/mio/opensource/qiling/qiling/core_hooks.py", line 190, in _hook_intr_cb
    raise QlErrorCoreHook("_hook_intr_cb : not handled")
qiling.exception.QlErrorCoreHook: _hook_intr_cb : not handled

Is it possible that the breakage was introduced in the Qiling side?

@wtdcode
Copy link
Member

wtdcode commented Feb 17, 2025

Additional context:

2.0.0 2.0.1 2.1.0 2.1.2
dev y y UC_ERR_ARG UC_ERR_WRITE_UNMAPPED
uc2.2-adjustments _hook_intr_cb : not handled _hook_intr_cb : not handled _hook_intr_cb : not handled UC_ERR_WRITE_UNALIGNED

I think this suggests a breakage on Qiling side? Note UC_ERR_WRITE_UNMAPPED seems from the lack of correct regiser access.

@elicn
Copy link
Member Author

elicn commented Feb 18, 2025

Everything should be OK now, depending on the fixes applied in Unicorn 2.1.3.

@wtdcode
Copy link
Member

wtdcode commented Feb 19, 2025

Local test shows test_onlinux.sh passes with unicorn-engine/unicorn@56ba347 except m0hamed_rootkit.ko which I don't see the link to download.

Note this include the fix to MIPS delay slot so no longer need to tune the count of emulation. =)

Hooray!

@wtdcode
Copy link
Member

wtdcode commented Mar 7, 2025

The integration test passes here:

https://github.com/wtdcode/unicorn_downstream/actions/runs/13713368975/job/38353861397

@wtdcode
Copy link
Member

wtdcode commented Mar 7, 2025

2.1.3 is out and we can move on.

@xwings
Copy link
Member

xwings commented Mar 7, 2025

Still some failure ? we need to merge and fix it later ?

@wtdcode
Copy link
Member

wtdcode commented Mar 7, 2025

Restarted CI. This shall pass.

@xwings xwings merged commit 5dbde89 into qilingframework:dev Mar 8, 2025
6 of 7 checks passed
@elicn elicn deleted the uc2.2-adjustments branch March 8, 2025 19:48
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.

3 participants