7475 Commits
Author SHA1 Message Date
xwings 86c927cb32 Merge pull request #1658 from qilingframework/dev
Dev
v1.4.11
2026-09-05 21:35:58 +08:00
xwings d19bf180ce Merge pull request #1637 from monoidic/dev
implement FlsGetValue2
2026-09-05 21:31:07 +08:00
xwings 748e254bd8 Merge pull request #1641 from retrocpugeek/fix/mips-socket-options
Fix MIPS socket option (SO_*) values
2026-09-05 21:29:49 +08:00
xwings d0ba235b04 Merge pull request #1644 from H1ghC0ntr4sT/fix/dllmain-exception-emu-state
Reset emu state after a failing DllMain
2026-09-05 20:54:34 +08:00
xwings 4ee2ab144e Merge pull request #1636 from retrocpugeek/fix/getdents64-alignment
Align getdents and getdents64 records to fix unaligned access on MIPS
2026-09-05 20:51:08 +08:00
xwings f444f8171a Merge pull request #1639 from retrocpugeek/fix/clone3-syscall
Implement the clone3 syscall
2026-09-05 20:49:30 +08:00
xwings 7364789c14 Merge pull request #1646 from w1tcher/fix/fiber-manager-last-error
Fix FLS FiberManager writing last_error to a dead attribute
2026-09-05 17:05:09 +08:00
xwings 97bfe03906 Merge pull request #1649 from qilingframework/dependabot/pip/setuptools-83.0.0
Bump setuptools from 78.1.1 to 83.0.0
2026-09-05 17:04:28 +08:00
xwings ace8191991 Merge pull request #1650 from Jvlegod/feature/riscv64-debugger
feat: add riscv debugger support
2026-09-05 17:03:36 +08:00
xwings deca26e4ba Merge pull request #1651 from Jvlegod/feature/qdb-riscv
feat: add qdb riscv support
2026-09-05 17:02:46 +08:00
xwings e1f0526fa3 Merge pull request #1652 from Gigithecode/fix/idaplugin-future-import
Fix broken __future__ import in IDA plugin custom_script
2026-09-05 17:02:12 +08:00
xwings 638ee864a5 Merge pull request #1657 from xwings/dev
Dev
2026-09-05 17:01:47 +08:00
xwings 6f7b256f66 Merge branch 'dev' of github.com:xwings/qiling into dev 2026-09-05 16:59:35 +08:00
xwings 2dbbf48588 bump to 1.4.11 2026-09-05 16:59:26 +08:00
xwings d8c2e30b2f Merge branch 'qilingframework:dev' into dev 2026-09-05 16:57:54 +08:00
xwings 206b90fd89 minor refactor and pypi fix 2026-09-05 16:57:28 +08:00
xwings c54e4078c8 Merge pull request #1655 from xwings/dev
update new ARCHITECTURE docs
2026-09-01 14:54:59 +08:00
xwings 64054a0129 update new ARCHITECTURE docs 2026-09-01 12:15:35 +08:00
xwings 83c5b1b0ed Merge pull request #1654 from retrocpugeek/fix/gdb-async-interrupt
gdb: fix stop-replies for step, signalled vCont resume, and ctrl-c interrupt
2026-09-01 11:48:44 +08:00
retrocpugeekandClaude Opus 5 a13a8c8c1f gdb: accept vCont C/S actions carrying any signal
A client that resumes while a signal is pending sends a vCont action of the
form 'C<sig>' (continue and deliver) or 'S<sig>' (step and deliver), e.g.
'vCont;S0f:pa410.1996;c:pa410.-1' -- the exact packet reported in issue
#1377. handle_v matched only 'c'/'C05' and 's'/'S05', so any other signal
fell through to an empty reply and clients aborted the session with
'Invalid remote reply:'.

We do not deliver host signals to the guest, so the signal value carries no
meaning for us: accept any of them and carry the action out as a plain
resume or step, which is what the client asked for. This matters more now
that the stub can stop with SIGINT on an async interrupt, since a client
may well resume from such a stop with 'C02'.

Also stop assuming os.exit_code exists when reporting termination: bare-metal
os layers (QlOsMcu) do not define it, which turns the exit path into an
AttributeError (seen in issue #1276). The underlying MCU interrupt handling
of #1276 is out of scope here.

Add a regression test asserting the '#1377' packet is answered with a
SIGTRAP stop-reply and that a signalled continue runs the guest to
termination; both replies are empty without the fix.

Fixes #1377

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-08-23 22:15:04 +10:00
retrocpugeekandClaude Opus 4.8 c5a8a9b73e gdb: support async interrupt (ctrl-c) to break into a running guest
The stub drove continue by calling emu_start synchronously and only read
the socket again once the target stopped on its own, so the bare \x03 break
byte a client sends to pause a running target was never seen. A guest that
free-runs (e.g. an idle/event loop) could not be interrupted at all --
gdb/Ghidra reported 'Cannot execute this command while the target is running'.

Poll the client socket for the break byte from the per-instruction run hook
(dbg_hook), which does run on the emulation thread during emu_start:

- GdbSerialConn.poll_interrupt(): non-blocking select+recv, True on \x03.
- QlGdbUtils.dbg_hook: throttled (every INTR_POLL_INTERVAL insns) check of an
  installed check_interrupt callback; on a break, stop emulation and record it.
- handle_c: reply SIGINT when the stop was an interrupt rather than a
  breakpoint or normal exit.

Add a regression test that lets an infinite-loop guest free-run, sends the
bare break byte and asserts the stop-reply is 'S02' (SIGINT). Without the
fix no reply ever arrives, so the test stops the guest itself and fails
rather than hanging the run.

Also verified against a free-running MIPS64 BE guest: \x03 -> S02 in <1ms.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-08-23 22:14:50 +10:00
retrocpugeekandClaude Opus 4.8 de34db212d gdb: report SIGTRAP (not SIGTERM) on single-step
handle_s answered every single-step ('s') with a SIGTERM stop-reply
whenever ql.emu_state was QL_STATE.STOPPED. But emu_start always leaves
the state STOPPED after running the requested step count, so the guard
was true on every step and gdb clients saw a spurious termination signal,
disconnecting mid-debug (issues #1377, #1538).

Give handle_s the same exit-vs-trap discrimination handle_c already uses:
a step reports SIGTRAP unless it carried pc to the emulation exit point,
in which case the guest has actually terminated and we reply W{exit_code}.
Also wrap the step in the same UcError/KeyboardInterrupt handling as
handle_c so a fault while stepping maps to a signal instead of crashing
the stub, and hoist the shared uc-error->signal map to a module constant.

Add a regression test that single-steps over the gdb stub and asserts the
stop-reply is 'S05' (SIGTRAP), which fails as 'S0f' (SIGTERM) without the fix.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-08-07 22:28:08 +10:00
GigithecodeandClaude Opus 5 dbf1cab94a Fix broken __future__ import in IDA plugin custom_script
The first line reads `from future import __annotations__`, with the
module name and the imported symbol swapped. The intent was clearly the
PEP 563 future statement `from __future__ import annotations`.

As written, the line fails in both possible situations:

- without the third-party `future` package installed (the common case),
  the import raises `ModuleNotFoundError`, so `QILING_IDA` is never
  defined;
- with that package installed, the import silently succeeds but binds
  the module's empty `__annotations__` dict, so PEP 563 is *not*
  enabled — while the annotations in this file (`ql: Qiling`) rely on
  it, `Qiling` being imported under `TYPE_CHECKING` only.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Pru9dwqPVrDakERYZwzjUx
2026-08-07 18:32:55 +07:00
Jvle 718280f684 fix: render trailing qdb register row
Signed-off-by: Jvle <[email protected]>
2026-08-04 16:40:30 +08:00
Jvle b69128fee9 feat: add riscv qdb support
Signed-off-by: Jvle <[email protected]>
2026-08-04 16:40:00 +08:00
Jvle 493e1f0b82 fix: flush gdb tb cache
Signed-off-by: Jvle <[email protected]>
2026-08-03 14:01:11 +08:00
Jvle 88ca4d475e feat: add riscv gdb support
Signed-off-by: Jvle <[email protected]>
2026-08-03 13:43:04 +08:00
dependabot[bot] 455b2bca6e Bump setuptools from 78.1.1 to 83.0.0
Bumps [setuptools](https://github.com/pypa/setuptools) from 78.1.1 to 83.0.0.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v78.1.1...v83.0.0)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-version: 83.0.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2026-07-22 14:09:43 +00:00
w1tcherandClaude Opus 4.8 d8f904c44a Fix FLS FiberManager writing last_error to a dead attribute
FiberManager.free/set/get set `self.last_error` on the FiberManager
instance, but nothing ever reads that attribute. The Windows last-error
that GetLastError returns lives on `ql.os.last_error`, so FlsFree,
FlsSetValue and FlsGetValue never actually reported ERROR_INVALID_PARAMETER
for an invalid FLS index. Route the three writes to `self.ql.os.last_error`,
consistent with every other kernel32 hook.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-07 17:37:59 +08:00
H1ghC0ntr4sT ce6f08d71f Reset emu state after a failing DllMain
call_dll_entrypoint() caught the DllMain UcError and restored registers but
left ql._state at STARTED, since emu_start() only clears it on success. The
'emu_state is not STARTED' gate then silently skipped DllMain for every DLL
loaded afterward. Reset the state to STOPPED on the exception path.
2026-07-02 23:21:17 +07:00
xwings 499218bd1a Merge pull request #1642 from xwings/dev
Add AGENT documentation.
2026-07-02 09:57:41 +08:00
xwings e522d7e089 fix documents and minor changes 2026-07-02 08:54:12 +08:00
xwings abc4855388 Add documents for AGENTS 2026-07-02 08:52:20 +08:00
retrocpugeekandClaude Opus 4.8 9e21eb9d66 Fix MIPS socket option (SO_*) values
linux_mips_socket_options used generic/incorrect values. MIPS has its own
SO_* numbering (arch/mips/include/uapi/asm/socket.h) with the buffer/timeout/
type options in the 0x1000 range. The table listed SO_SNDBUF=0x01,
SO_RCVBUF=0x02 (should be 0x1001/0x1002), SO_SND/RCVLOWAT and SO_SND/RCVTIMEO_OLD
all wrong, SO_RCVLOWAT=0x04 silently collided with SO_REUSEADDR (Enum alias),
and SO_OOBINLINE/SO_REUSEPORT were 0x00.

A guest setsockopt(SOL_SOCKET, SO_RCVBUF, ...) (e.g. busybox ping) therefore
raised 'Could not convert emulated socket option 4098'. Correct all values to
the MIPS uapi and add the missing SO_TYPE/SO_ERROR/SO_ACCEPTCONN/SO_PROTOCOL/
SO_DOMAIN.

Add test_elf.ELFTest.test_setsockopt_mips_so_rcvbuf: opens a socket on a MIPS
guest and asserts setsockopt(SOL_SOCKET, SO_RCVBUF) succeeds. Self-contained,
runs on stock unicorn; fails on dev, passes with the fix.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-25 22:38:50 +10:00
retrocpugeekandClaude Opus 4.8 a4ca725e4e Align legacy getdents records too
Extend the record alignment to the legacy getdents path. The kernel rounds
both getdents and getdents64 records up to the alignment of their leading
d_ino (ALIGN(reclen, sizeof(long))); without it a strict-alignment guest
(MIPS) faults walking the buffer, e.g. older glibc busybox 'ls' (which uses
the legacy getdents syscall) crashes on directory listings.

Legacy linux_dirent stores d_type in the record's last byte (offset
d_reclen-1), so the alignment padding goes between d_name and d_type to keep
d_type there -- padding without relocating d_type is what got the earlier
blanket attempt (PR #1419) reverted. getdents64 (d_type before d_name) is
unchanged.

Add test_linux_getdents_alignment: walks legacy getdents records on a
big-endian MIPS guest and asserts each is aligned, tiles the buffer, and
keeps d_type (DT_DIR for '.'/'..'). Runs on stock unicorn.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-25 21:55:21 +10:00
retrocpugeekandClaude Opus 4.8 f5c0afab58 Implement the clone3 syscall
Modern glibc (recent toolchains) issues clone3 from pthread_create rather
than clone, so thread creation fails on any guest built against it: Qiling
does not return -ENOSYS for unimplemented syscalls (it logs a warning and
leaves the return register untouched), so glibc's clone3->clone fallback
never fires.

Add ql_syscall_clone3, which unpacks struct clone_args and delegates to the
existing clone() handler. Translations: child_stack = stack + stack_size
(clone3 passes the stack base plus a size; legacy clone wants the highest
address), exit_signal folded into the flags' CSIGNAL byte, and an x8664
pre-swap that cancels ql_syscall_clone's arch-specific newtls<->child_tidptr
swap.

Add a self-contained regression test (test_clone3_translates_to_clone) that
drives ql_syscall_clone3 directly and asserts the translation for both the
generic path and the x8664 swap. Runs on stock unicorn; no clone3 binary
needed.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-25 20:22:02 +10:00
Mikk Margus Möll ed25f7319f implement FlsGetValue2 2026-06-25 09:38:07 +03:00
retrocpugeekandClaude Opus 4.8 0e48da4be8 Add regression test for getdents64 record alignment
Calls ql_syscall_getdents64 on a directory and walks the returned
linux_dirent64 records, asserting every record (and thus its leading u64
d_ino) starts on an 8-byte boundary. Before the fix d_reclen was not
rounded up, so records were misaligned and a strict-alignment guest (e.g.
MIPS) faulted with an unaligned load. Self-contained; runs on stock unicorn.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-25 00:31:16 +10:00
retrocpugeekandClaude Opus 4.8 012726f272 Align getdents64 records to fix unaligned access on MIPS
getdents64 wrote linux_dirent64 records with d_reclen = header + name,
without rounding up to the alignment of the leading u64 d_ino. The next
record's d_ino then lands unaligned, and a strict-alignment guest (e.g.
MIPS/MIPS64) faults with UC_ERR_READ_UNALIGNED when walking the buffer.
x86 tolerates the unaligned load, which is why this was never caught.

Round d_reclen up to the d_ino alignment, matching the kernel. The rounding
is scoped to the getdents64 (is_64) branch only: getdents64 places d_type
before d_name so the trailing pad bytes are inert, whereas the legacy
getdents layout stores d_type at offset d_reclen-1 and would break if padded
the same way -- that is what got the earlier blanket fix (PR #1419) reverted.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-25 00:28:41 +10:00
xwings a42fb28579 Bump version to 1.4.11-dev and update classifiers 2026-04-28 16:02:08 +08:00
xwings da210f0757 Update pyproject.toml 1.4.10 2026-04-28 15:58:29 +08:00
xwings c33a59cc08 Merge pull request #1624 from qilingframework/dependabot/pip/setuptools-78.1.1
Bump setuptools from 75.3.0 to 78.1.1
2026-04-28 15:57:51 +08:00
dependabot[bot] f5d7a745a3 Bump setuptools from 75.3.0 to 78.1.1
Bumps [setuptools](https://github.com/pypa/setuptools) from 75.3.0 to 78.1.1.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v75.3.0...v78.1.1)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-version: 78.1.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2026-04-28 07:56:51 +00:00
xwings bd263898e5 Merge pull request #1623 from qilingframework/dev
Preparing 1.4.9
2026-04-28 15:54:29 +08:00
xwings 2eba2cdc32 Merge pull request #1622 from xwings/dev
update rootfs branch
2026-04-28 15:53:09 +08:00
xwings b6ced6fa21 update rootfs branch 2026-04-28 15:51:49 +08:00
xwings f77b4c5233 Merge pull request #1621 from xwings/dev
update rootfs branch
2026-04-28 15:07:52 +08:00
xwings d18027e7ef update rootfs branch 2026-04-28 15:06:26 +08:00
xwings 483916e0a8 Merge pull request #1620 from xwings/dev
Version 1.4.8
2026-04-28 15:04:24 +08:00
xwings ef898e68d7 Version 1.4.8 2026-04-28 15:03:09 +08:00