Commit Graph

286 Commits

Author SHA1 Message Date
xorstream
fa4fd72c5f Added test for uc_emu_stop() in code hook not always stopping the emu at the current instruction. 2015-12-20 14:59:29 +11:00
Nguyen Anh Quynh
771f9f7c3b fix conflicts when merging map-ptr branch to master branch 2015-12-17 08:12:02 +08:00
Nguyen Anh Quynh
c8853929b7 Merge pull request #320 from xorstream/threaded
Added test for uc_open() and uc_emu_start() being called by different threads.
2015-12-16 11:07:23 +08:00
xorstream
d871e17ffd Added return values in main() to rw_hookstack.c so that it builds in MinGW. 2015-12-16 13:13:15 +11:00
xorstream
6aa33e8359 Added test for uc_open() and uc_emu_start() being called by different threads. 2015-12-16 13:08:33 +11:00
xorstream
f111d7d1ca Added support for building tests from MinGW. 2015-12-16 12:59:30 +11:00
univm
845392de1e Test for stack hooking. 2015-12-12 00:48:46 +02:00
Nguyen Anh Quynh
0e62ebc038 unit: fix compilation warning for test_mem_high.c 2015-12-12 00:58:49 +08:00
Nguyen Anh Quynh
a142611f56 sparc: set compute functions for icc_table[] & xcc_table[]. this fixes issue #289 2015-12-12 00:41:09 +08:00
Nguyen Anh Quynh
ff7e4abd53 Merge pull request #308 from ranmrdrakono/master
Added testcase for int instruction tracing
2015-12-11 10:04:56 +08:00
coco
14e75252a5 added testcase for the values read from high addresses 2015-12-10 16:18:22 +01:00
Nguyen Anh Quynh
9d7f81d195 Merge pull request #307 from xorstream/mips_delayslot_codehook
Added mnemonic printing to disasm function.
2015-12-10 13:17:57 +08:00
xorstream
27128a9563 Added mnemonic printing to disasm function. 2015-12-10 13:09:31 +11:00
farmdve
0d98607121 Unmapped memory is not freed.
While uc_mem_unmap does unmap memory regions from Unicorn, it does not
free the memory. It accumulates over time when reusing a single Unicorn
instance.
2015-12-10 00:08:07 +02:00
xorstream
eb8d1b58c7 Added MIPS delay slot code hook test.
Tests that the code hook gets called for instructions in the branch delay slot for MIPS cpu.
2015-12-09 18:09:15 +11:00
xorstream
7f04b0f772 Added MIPS delay slot code hook test.
Tests that the code hook gets called for instructions in the branch delay slot for MIPS cpu.
2015-12-09 18:06:53 +11:00
coco
e4fe6b58b4 added test for memory quirks 2015-12-08 18:23:06 +01:00
practicalswift
31e32d1734 Crash case: Jump to invalid address (0x0), sparc32 2015-12-02 21:55:13 +01:00
practicalswift
23aa6aa9a6 Add invalid_read_in_tb_flush_x86_64 to .gitignore and Makefile 2015-12-02 07:15:44 +01:00
practicalswift
c50bf567c0 Crash case: Invalid read of size 8 in tb_flush_x86_64 2015-12-01 22:41:51 +01:00
practicalswift
7a1067ad4a Crash case: Invalid read of size 4 when tracing (MIPS32). See #282 2015-11-30 23:44:49 +01:00
practicalswift
75a325e8c6 Crash case: Invalid read of size 8 in tb_flush_x86_64. 2015-11-29 23:00:34 +01:00
Ryan Hileman
230cbd5330 add permissions to map_ptr api 2015-11-28 11:28:31 -08:00
Ryan Hileman
6d21ebabea implement host-controlled memory mapping for #261 2015-11-27 23:30:36 -08:00
practicalswift
36948320ce invalid_read_in_cpu_tb_exec_x86_64 → invalid_write_in_cpu_tb_exec_x86_64 2015-11-17 08:44:38 +01:00
practicalswift
ad5c2eb9c6 Crash case: Invalid write of size 4 in cpu_tb_exec_x86_64. 2015-11-16 23:19:23 +01:00
Nguyen Anh Quynh
edaea7020b x86: on self-modifying code, generate JIT code until end of block. this fixes issue #266 2015-11-16 21:55:42 +08:00
practicalswift
8af4967707 Remove space. 2015-11-15 18:18:04 +01:00
practicalswift
76ed117df6 Cast last two uc_hook_add(…) arguments to uint64_t. 2015-11-15 18:12:10 +01:00
practicalswift
5b34660b3f Add test case to Makefile and .gitignore. Add disassembly. 2015-11-15 17:31:06 +01:00
practicalswift
c8fe68fb3d Add test case for issue #266 ("Invalid read of size 4" in cpu_tb_exec). 2015-11-15 00:04:34 +01:00
Willi Ballenthin
eb73984763 run_across_bb: include expected vs actual PC in assertion error 2015-11-13 10:14:38 -05:00
Willi Ballenthin
d09cc88495 run_across_bb: whitespacing 2015-11-13 09:13:27 -05:00
Willi Ballenthin
c97fa4fd8a add test case to run_across_bb
demonstrates that calling emu_start from a BB start to another BB end works fine.
2015-11-13 08:59:36 -05:00
Willi Ballenthin
22d2d3bdbb add test for emulation within and across BB 2015-11-13 00:44:19 -05:00
Nguyen Anh Quynh
9f29fdf442 update regress.sh 2015-11-12 15:30:19 +08:00
Ryan Hileman
f93e342177 add mem_map_large regression (for #223) 2015-11-11 22:52:18 -08:00
farmdve
c8300587f7 Patch eflags_noset to compile on 32-bit and on 64-bit. 2015-11-10 15:01:23 +02:00
Nguyen Anh Quynh
272293556a do not abort() when memory is insufficient. this fixes issue #244 2015-11-10 11:44:29 +08:00
farmdve
726f45b33d Attempting to set some bits in the Unicorn EFLAGS doesn't work.
When attempting to set all flags except trap flag, the EFLAGS value
should be 0x00244ED7, I've tested this on Windows and here
https://ideone.com/WQAvk1 which is presumably Linux.

Unicorn however has the value 0x00000ED7, bits 11-21 are not set. Bit 21
is the ID bit indicating whether or not CPUID is available.
2015-11-10 00:49:01 +02:00
Nguyen Anh Quynh
4c5ecda908 regress: print with newline for 00opcode_uc_crash.c 2015-11-06 22:24:24 +08:00
Nguyen Anh Quynh
de86647dbe regress: fix compiled warning for 00opcode_uc_crash.c 2015-11-05 22:51:10 +08:00
Nguyen Anh Quynh
d818e2c485 Merge branch 'master' of https://github.com/unicorn-engine/unicorn 2015-11-05 21:34:55 +08:00
Nguyen Anh Quynh
4692f3445f Merge pull request #248 from farmdve/master
X86 zero-byte opcode causes Unicorn to crash.
2015-11-05 20:49:04 +08:00
Nguyen Anh Quynh
b3dfde8a17 Merge branch 'master' of https://github.com/unicorn-engine/unicorn 2015-11-05 20:41:51 +08:00
farmdve
7f3c567ae5 X86 zero-byte opcode causes Unicorn to crash.
The opcode 0x00 translates as `add byte ptr ds:[eax],al`, which leads to
a segfault in Unicorn.

Using a debugger, I believe the crash is located in
`qemu/translate-all.c` in function `page_flush_tb_1`, more specifically
this code `pd[i].first_tb = NULL;`
2015-11-05 14:41:15 +02:00
Nguyen Anh Quynh
95745eff3b regress: fix compiled warnings in eflags_nosync.c 2015-11-05 20:22:07 +08:00
farmdve
894739515e X86 EFLAGS not synced properly.
these commits should fix my previous ones.
2015-11-04 09:38:57 +02:00
Nguyen Anh Quynh
613ebbb20e Merge pull request #244 from emdel/master
SIGABRT issue
2015-11-04 10:07:48 +08:00
mariano
9f7d1812a3 SIGABRT issue 2015-11-03 12:58:20 -08:00
Nguyen Anh Quynh
68a2a0c7ab regress: add shebang for hook_code_stop_emu.py 2015-11-03 22:45:48 +08:00
practicalswift
696c58f9f0 Add test case for segfault-on-emu_stop() bug.
The following code segfaults:
unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_64).emu_stop()

Tested under Linux and OS X.
2015-11-03 14:11:49 +01:00
Nguyen Anh Quynh
f5cec3815a Merge pull request #240 from williballenthin/test-hook-code-stop-emu
add hook_code_stop_emu.py test for issue #232
2015-11-03 09:48:58 +08:00
practicalswift
29903c07f9 Fix typo. 2015-11-02 23:23:02 +01:00
practicalswift
b91df4af23 Test case for issue #236 (potential memory leak) 2015-11-02 23:19:38 +01:00
practicalswift
a435307543 Test case for issue #237 (OS X crash when creating 2048:th Uc object) 2015-11-02 23:18:30 +01:00
Willi Ballenthin
11dfaf4dec hook_code_stop_emu.py: show PC before asserting 2015-11-02 10:05:00 -05:00
Willi Ballenthin
1a8ca49db1 hook_code_stop_emu.py: formatting 2015-11-02 10:03:31 -05:00
Willi Ballenthin
f02d03dde3 add hook_code_stop_emu.py test for issue #232 2015-11-02 09:54:36 -05:00
Nguyen Anh Quynh
3a36e327ab support memory redirection, so the issue #217 is fixed 2015-10-27 14:37:03 +08:00
Nguyen Anh Quynh
cea1cf210d tests: mips_kseg0_1.c prints out friendly error message rather than just error code 2015-10-27 12:36:03 +08:00
Nguyen Anh Quynh
7553c9c1c2 tests: add mips_kseg0_1 to Makefile to compile it 2015-10-27 11:25:34 +08:00
Nguyen Anh Quynh
05d89da496 Merge pull request #222 from pkooiman/master
Test for executing from  MIPS kseg0/kseg1 memory ranges
2015-10-27 08:44:32 +08:00
Peter Kooiman
0bad2a8a90 Added test for executing from MIPS kseg0/ksegq1 memory ranges to tests/regress 2015-10-26 18:37:27 +01:00
gaffe
21ce78924c assert that PC was changed in callback-pc test 2015-10-23 11:28:10 -07:00
Nguyen Anh Quynh
dfc8658083 regress: fix compilation warning of mem_double_unmap.c 2015-10-23 11:36:09 +08:00
coco
dd56621bbb fix for use after free in case of double unmap 2015-10-21 22:25:49 +02:00
Nguyen Anh Quynh
b1d41d414b on some hook events, uc_hook_add() should not allow more than 1 handler. this add UC_ERR_HOOK_EXIST error type 2015-10-10 18:01:47 +08:00
Sean Heelan
bb4011efe2 Regression test for issue #165 2015-10-06 12:55:09 +07:00
egberts
347d863365 Issue #465 hook_count_cb doesn't stop at n instructions; unit test file 2015-10-03 22:52:15 -07:00
Nguyen Anh Quynh
9410b8fbe7 regress: add shebang for ensure_typedef_consts_generated.py 2015-10-04 11:21:37 +08:00
Sean Heelan
fd6b510038 Added a comment explaining what is being tested for 2015-10-03 12:36:17 +07:00
Sean Heelan
f62418fc07 Regression test for issue #161 2015-10-03 12:22:41 +07:00
Nguyen Anh Quynh
9e64cba6ec Rename some hook related enums:
- UC_ERR_READ_INVALID -> UC_ERR_READ_UNMAPPED
 - UC_ERR_WRITE_INVALID -> UC_ERR_WRITE_UNMAPPED
 - UC_ERR_FETCH_INVALID -> UC_ERR_FETCH_UNMAPPED
 - UC_MEM_READ_INVALID -> UC_MEM_READ_UNMAPPED
 - UC_MEM_WRITE_INVALID -> UC_MEM_WRITE_UNMAPPED
 - UC_MEM_FETCH_INVALID -> UC_MEM_FETCH_UNMAPPED
 - UC_HOOK_MEM_READ_INVALID -> UC_HOOK_MEM_READ_UNMAPPED
 - UC_HOOK_MEM_WRITE_INVALID -> UC_HOOK_MEM_WRITE_UNMAPPED
 - UC_HOOK_MEM_FETCH_INVALID -> UC_HOOK_MEM_FETCH_UNMAPPED
 - UC_HOOK_MEM_INVALID -> UC_HOOK_MEM_UNMAPPED

This also renames some newly added macros to use _INVALID postfix:

 - UC_HOOK_MEM_READ_ERR -> UC_HOOK_MEM_READ_INVALID
 - UC_HOOK_MEM_WRITE_ERR -> UC_HOOK_MEM_WRITE_INVALID
 - UC_HOOK_MEM_FETCH_ERR -> UC_HOOK_MEM_FETCH_INVALID
 - UC_HOOK_MEM_ERR -> UC_HOOK_MEM_INVALID

Fixed all the bindings Java, Go & Python.
2015-09-30 14:46:55 +08:00
Nguyen Anh Quynh
4a42041a83 handle 'bad ram pointer' case. this fixes issue #159 2015-09-29 18:22:22 +08:00
Nguyen Anh Quynh
976950d3c3 chmod +x tests/regress/bad_ram.py 2015-09-29 15:24:30 +08:00
mothran
0e258b9587 updated a few small errors in the script 2015-09-28 22:50:27 -07:00
mothran
eeebcc5a44 added bad_ram regress 2015-09-28 21:41:38 -07:00
Nguyen Anh Quynh
8b4d274c34 regress: convert some mips tests to use unittest 2015-09-28 11:57:24 +08:00
Nguyen Anh Quynh
2b0b4169bc mips: advance PC for SYSCALL instruction. this fixes issue #157 2015-09-28 10:58:43 +08:00
Ryan Hileman
13be3435c9 add regress for #157 2015-09-27 01:08:46 -07:00
Nguyen Anh Quynh
53ce8f217d mips: handle delay slot better for branch instructions. this should fix issue #155 2015-09-27 15:05:40 +08:00
Ryan Hileman
4b42b4be52 add regress for #155 2015-09-26 12:48:25 -07:00
Nguyen Anh Quynh
90eb8f2e72 This commit continues the PR #111
- Allow to register handler separately for invalid memory access
- Add new memory events for hooking:
   - UC_MEM_READ_INVALID, UC_MEM_WRITE_INVALID, UC_MEM_FETCH_INVALID
   - UC_HOOK_MEM_READ_PROT, UC_HOOK_MEM_WRITE_PROT, UC_HOOK_MEM_FETCH_PROT
- Rename UC_ERR_EXEC_PROT to UC_ERR_FETCH_PROT
- Change API uc_hook_add() so event type @type can be combined from hooking types
2015-09-24 14:18:02 +08:00
Nguyen Anh Quynh
14a01b5186 mips: handle delay slot so do not duplicate calling instruction handler. this fixes issue #133 2015-09-22 11:59:53 +08:00
danghvu
3c1d65ea66 Reorganize test directories 2015-09-21 20:47:45 -05:00