Commit Graph

455 Commits

Author SHA1 Message Date
Nguyen Anh Quynh
5f81c00559 Merge branch 'noglib' of https://github.com/cseagle/unicorn into cseagle-noglib 2016-12-19 17:32:27 +08:00
Chris Eagle
e46545f722 remove glib dependency by provide compatible replacements 2016-12-18 14:56:58 -08:00
Grazfather
795a241dd3 Add ARM bx crash regress test case 2016-11-26 12:51:01 -08:00
Stephen
75d90aff52 Make cleanup (#666)
* make cleanup

* Update .travis.yml
Update eflags_nosync.c
Update sigill2.c
Update ro_mem_test.c
Update ro_mem_test.c
Update nr_mem_test.c
Update mem_fuzz.c
Update mem_double_unmap.c
Update emu_stop_in_hook_overrun.c
Update eflags_nosync.c
remove unused
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update mem_64_c.c
Update mem_64_c.c
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update .travis.yml
try android ndk build
Update unicorn.py
Update unicorn.py
Update Makefile
Update unicorn.py
Update unicorn.py
remove an untrue comment

if a dll/so/dylib gets loaded at runtime is dependent on many different factors, primarily the LD/DYLD paths. Those do not always include the current working directory
Update Makefile
Update .appveyor.yml
Update .travis.yml
Update Makefile
Update .appveyor.yml
Fix bad sample

* Update Makefile

* Update Makefile

* Update install-cmocka-linux.sh

* remove verbose option from tar

* add upgrade to pacman for cmake

* pacman double update, needed to get new packages

* enable cmocka unit testing

* rejigger commands to fail on any step

should get fails in msys builds for cmocka

* fix quote

* make cmocka in cygwin only

* add msys cache
2016-11-19 17:17:48 +08:00
Peter Harliman Liem
7660768942 Fix leak and style in map_write.c (#658)
Fix potential leak, wrong text in log, and restyle
to a cleaner exit path
2016-10-25 23:47:55 +08:00
Stephen
bc08bfda67 Unit testing in CI (#651)
- in appveyor, install clang and cmake in cygwin, enable package upgrades, and build cmocka and enable testing for gcc only
- in `gitignore`, ignore generated cmocka folder
- in travis, use brew in osx to install cmocka, and enable testing for gcc and clang on os x and linux
- in `Makefile`, change to use `uname -s` to determine os type
- make `install-cmocka-linux.sh`, a simple shell script to download and install cmocka on linux
- in `bindings/Makefile`, enable `make -c` to call subdirectory makefiles instead of `cd [dir] && make` and include environment variables for runtime access to generated libraries
- in `samples/Makefile`, change to use `uname -s` to determine os type, remove `clean_bins` from `all` command, and include `Werror` for compile strictness
- in `tests/unit/Makefile`, add `cflags` for compile time access to cmocka headers and library, include execute vars for runtime access to cmocka and unicorn libs
- in `tests/unit/test_tb_x86.c`, comment out assert that would not compile
2016-10-22 00:21:10 +08:00
Andrew Dutcher
ea54204952 Tweak some names in a few places, encapsulate the uc_context struct to hide it from users for some reason 2016-10-10 14:04:51 -07:00
Andrew Dutcher
1ab2154fe5 Change save/restore API to have explicit alloc/free functions. Python has explicit save/update functions. 2016-10-07 11:39:42 -07:00
Nguyen Anh Quynh
73577cbcd1 rename uc_regstate_restore to uc_context_restore, uc_context_save to uc_context_save 2016-10-07 10:03:19 +08:00
Nguyen Anh Quynh
b7cdbe7a88 Merge branch 'feat/reg_save_restore' of https://github.com/rhelmot/unicorn into rhelmot-feat/reg_save_restore 2016-10-07 09:57:07 +08:00
Stephen
0137a66c61 Update test_hang.c 2016-10-05 10:29:16 -07:00
Stephen
f2998f14cd Update test_hang.c 2016-10-05 09:20:36 -07:00
Andrew Dutcher
e3b0e52013 Rename save/restore functions to match the style of the rest of the API 2016-09-28 21:21:44 -07:00
Andrew Dutcher
3deb9fdcad Fix save/restore to work while emulation is not active 2016-09-08 14:41:34 -07:00
Andrew Dutcher
f2af98942b Added (failing?) test for reg save/restore 2016-08-31 20:25:28 -05:00
Andrew Dutcher
f8ac51bb3d Document assembly instructions for x86_self_modifying 2016-08-30 14:40:26 -05:00
Nguyen Anh Quynh
10519d6864 regress: fix compilation warning in invalid_read_in_cpu_tb_exec.c 2016-08-30 21:23:50 +08:00
Nguyen Anh Quynh
69d976375e Merge branch 'fix/self_modifying' of https://github.com/rhelmot/unicorn into rhelmot-fix/self_modifying 2016-08-30 21:20:22 +08:00
Nguyen Anh Quynh
49d546b355 regress: fix some warnings on printing sizeof() 2016-08-28 01:38:37 +08:00
Nguyen Anh Quynh
89c9ea5f8f Merge branch 'fix/eflags' of https://github.com/rhelmot/unicorn into rhelmot-fix/eflags 2016-08-24 16:13:31 +08:00
Nguyen Anh Quynh
40ea64af19 Merge branch 'feat/xmm_regs' of https://github.com/rhelmot/unicorn into rhelmot-feat/xmm_regs 2016-08-23 06:52:45 +08:00
nnn
64e6fbc480 Fixed printf format specifier 2016-08-20 22:34:14 -07:00
nnn
d77fd18915 Fixed multiple bugs in test_x86_rip_bug.c
Fixed format warning in test_hang.c
2016-08-20 22:23:51 -07:00
nnn
4a67727f81 Updated Makefile 2016-08-20 18:47:45 -07:00
Neil
06fc5d1ea9 Add files via upload
Unit Test for Issue #534
2016-08-20 21:35:23 -04:00
Hors
90fb03cf5c Update mem_map_0x100000000.c 2016-08-19 23:33:04 +02:00
Hors
0fc3861699 Update Makefile 2016-08-19 23:32:19 +02:00
Hors
deeca1f722 Create mem_map_0x100000000.c 2016-08-19 11:19:06 +02:00
Andrew Dutcher
46c53fa4b7 Add regression test for new eflags patch 2016-08-15 00:12:32 -07:00
Andrew Dutcher
42949408ca Added test for real self-modifying code 2016-08-14 23:21:38 -07:00
Andrew Dutcher
b1f03a02f2 Add tests for xmm register read/write 2016-08-14 19:26:32 -07:00
Andrew Dutcher
97b10da133 Undo the disaster that was the patch to unicorn github issue #266 and fix it correctly. makes normal self-modifying code work. 2016-08-09 19:35:20 -07:00
samothtronicien
edd37f7a1c removing tests/regress/test_x86_shl.cpp 2016-08-01 10:31:10 +02:00
samothtronicien
92f97da49f bit of refactoring 2016-07-31 19:45:46 +02:00
samothtronicien
f1041a2615 renamed to test_x86_shl_enter_leave.c 2016-07-31 03:23:00 +02:00
samothtronicien
ae8e34173a added tests with enter/leave 2016-07-31 03:19:52 +02:00
samothtronicien
1ecc5abdbc fixed typo: test_x86_shl_pf -> test_x86_shl 2016-07-30 16:44:54 +02:00
samothtronicien
8120b7732e added test_x86_shl_pf to makefile 2016-07-30 16:42:51 +02:00
samothtronicien
c1cd06ec52 ported test to C 2016-07-30 16:41:40 +02:00
samothtronicien
6c3eecb2a3 added unit test for x86
This test highlight the issue with the SHL instruction in the form (SHL r, CL), the flags values retrieved in the code hook are not correct.
2016-07-30 04:18:12 +02:00
samothtronicien
6fc1f27492 completed the test
The issue noticed before only occurs while we are in the hook_code (eflags is not correctly updated after the execution of the SHL instruction using CL).
Once the emulation has finished executing the code the value of eflags is correct.
2016-07-29 18:52:53 +02:00
samothtronicien
2ba32922e4 Moved test_x86_shl.cpp to tests/regress 2016-07-29 12:00:48 +02:00
Nguyen Anh Quynh
07426d324b regress: chmod +x x86_fldt_fsqrt.py 2016-07-16 22:31:39 +08:00
Niklas Baumstark
3eaceec07e add regression test for fsqrt hang 2016-07-16 15:19:44 +02:00
Nguyen Anh Quynh
0a4ca0d365 regress: make some tests less noisy 2016-07-09 10:50:21 +08:00
Hoang-Vu Dang
9a2a5b15d8 Rename unhandled CPU exception 2016-07-05 11:10:39 -05:00
Hoang-Vu Dang
9cdca5a32b Unhandled interrupt will halt execution 2016-07-04 17:07:57 -05:00
Hoang-Vu Dang
3151451c87 Fix some invalid code in regress 2016-07-04 00:59:34 -05:00
Nguyen Anh Quynh
faef4365cf Merge pull request #583 from petmac/arm_fp_vfp_disabled
Fix incorrect end address passed to emu_start.
2016-06-27 22:17:12 +08:00
Peter Mackay
0e661cb3cb Fix incorrect end address passed to emu_start. 2016-06-21 09:26:27 +01:00
Nguyen Anh Quynh
65bef683d3 regress: more flexible .gitignore 2016-06-16 09:27:47 +08:00
Nguyen Anh Quynh
6193be73b7 tests: more flexible .gitignore for tests/unit/ 2016-06-16 09:14:32 +08:00
Nguyen Anh Quynh
fdcdaa3639 Merge branch 'master' of https://github.com/NUko32/unicorn into NUko32-master 2016-06-16 09:07:33 +08:00
Peter Mackay
d4f0ab7ba8 Add Thumb-2 code to enable FP and VFP. 2016-06-15 23:43:51 +01:00
nuko32
9b46a22cd5 final refactoring for test_hang 2016-06-15 20:52:28 +02:00
nuko32
3bec4b2cf1 refactored test_hang and fixed indentations 2016-06-15 20:44:22 +02:00
jndok
c6db9febe7 added ARM64 hang test 2016-06-15 19:18:51 +02:00
Peter Mackay
5d06e6638e Add arm_fp_vfp_disabled.py test. 2016-06-10 08:19:09 +01:00
Nguyen Anh Quynh
125f77a460 regress: chmod +x vld.py 2016-05-04 08:42:53 +08:00
Nguyen Anh Quynh
8b95cad550 regress: remove vmov.py 2016-05-04 08:41:09 +08:00
mkravchik
1afbee3a12 Merge pull request #3 from mkravchik/vld
Vld
2016-05-03 22:26:00 +03:00
mkravchik
33d105917d Added files via upload 2016-05-03 18:43:39 +03:00
Nguyen Anh Quynh
69cabed00f Merge branch 'asan' of https://github.com/zachriggle/unicorn into zachriggle-asan 2016-04-27 16:30:42 +08:00
Nguyen Anh Quynh
4084a385c2 regress: add mem_64_c.c from issue #523 by Chris Eagle 2016-04-24 22:53:30 +08:00
Nguyen Anh Quynh
df1de25db0 regress: chmod +x write_before_map.py 2016-04-24 18:09:06 +08:00
Tim Blazytko
0e52b913e7 added regression test write_before_map.py 2016-04-24 11:47:04 +02:00
Zach Riggle
93063d089b Add ASAN build target with UNICORN_ASAN or via './make.sh asan' 2016-04-20 16:16:06 -07:00
Nguyen Anh Quynh
cc6cbc5cf7 Merge branch 'memleak' into m2 2016-04-18 12:48:13 +08:00
practicalswift
06a64dc3b0 Add six crash cases (2 * ARM + 4 * M68K)
* 001-bad_condition_code_0xe.c (ARM)
* 002-qemu__fatal__unimplemented_control_register_write_0xffb___0x0.c (M68K)
* 003-qemu__fatal__wdebug_not_implemented.c (M68K)
* 004-segmentation_fault_1.c (ARM)
* 005-qemu__fatal__illegal_instruction__0000___00000404.c (M68K)
* 006-qemu__fatal__illegal_instruction__0421___00040026.c (M68K)

```
$ ./001-bad_condition_code_0xe # ARM
uc_emu_start(…)
Bad condition code 0xe
Aborted

$ ./002-qemu__fatal__unimplemented_control_register_write_0xffb___0x0 # M68K
uc_emu_start(…)
hook_code(…) called
qemu: fatal: Unimplemented control register write 0xffb = 0x0

Aborted

$ ./003-qemu__fatal__wdebug_not_implemented # M68K
uc_emu_start(…)
qemu: fatal: WDEBUG not implemented
Aborted

$ ./004-segmentation_fault_1 # ARM
uc_emu_start(…)
hook_code(…) called
Segmentation fault

$ ./005-qemu__fatal__illegal_instruction__0000___00000404 # M68K
uc_emu_start(…)
qemu: fatal: Illegal instruction: 0000 @ 00000404
Aborted

$ ./006-qemu__fatal__illegal_instruction__0421___00040026 # M68K
uc_emu_start(…)
hook_code(…) called
qemu: fatal: Illegal instruction: 0421 @ 00040026
Aborted
```
2016-04-09 15:27:20 -04:00
Zach Riggle
67ae30a2fb Add test showing failure to track targets properly when single-stepping.
This issue breaks emulation of conditional instructions on amd64.
2016-04-05 10:06:39 -07:00
Nguyen Anh Quynh
b138393a2b regress: chmod +x translator_buffer.py 2016-04-05 21:40:02 +08:00
Nguyen Anh Quynh
6ee7d22c68 Merge pull request #510 from emdel/master
test case for the dynmaic translator buffer issue
2016-04-05 20:37:52 +07:00
emdel
1120a22b4d test case for the dynmaic translator buffer issue 2016-04-05 06:11:21 -07:00
Nguyen Anh Quynh
1486ccce70 regress: fix all the calls to uc_hook_add() following recent change on this API 2016-04-03 23:32:14 +08:00
Nguyen Anh Quynh
4e07e71e04 regress: chmod +x x86_64_eflags.py 2016-03-31 10:06:33 +08:00
Zach Riggle
8cd23bcead Add test case for unicorn-engine/unicorn#499 2016-03-30 21:25:35 -04:00
Sascha Schirra
09784d85c1 bugfix read_reg -> reg_read 2016-03-27 11:26:57 +02:00
Nguyen Anh Quynh
90cefeb167 regress: adapt all C code to latest change in uc_hook_add() API 2016-03-26 00:33:24 +08:00
Nguyen Anh Quynh
08bd4b3f61 regress chmod +x x86_gdt.py tcg_liveness_analysis_bug_issue-287.py 2016-03-25 11:11:32 +08:00
Sascha Schirra
0c49f83cb5 GDT test added 2016-03-22 20:08:15 +01:00
Nguyen Anh Quynh
ad6bb8c9f8 unit: fix test_hookcounts.c 2016-03-20 01:54:37 +08:00
Nguyen Anh Quynh
0af4baac31 unit: fix warnings in printing uint64_t in test_hookcounts.c 2016-03-17 17:49:22 +08:00
egberts
ac21e74641 Issues #465
Pull Request #466
Added one more test case
Fixed two test case into passing (for a total of 3 passing out of 7)
2016-03-16 11:49:25 -07:00
egberts
ab5ed15044 Issue #465 - Enhanced test for more scenarios; fixed some semantic bugs. 2016-03-16 10:54:20 -07:00
Nguyen Anh Quynh
fb1ebac000 Merge branch 'master' into m1 2016-03-09 15:13:42 +08:00
Nguyen Anh Quynh
9c91a6ec28 fix a typo in tests/regress/LICENSE 2016-03-08 08:55:55 +08:00
Hoang-Vu Dang
9d9056c474 Add a license for regression tests 2016-03-07 12:22:20 -06:00
Nicolas PLANEL
1087ba9dea [query] add UC_QUERY_PAGE_SIZE uc_query helper
Return the current page size used by the current arch.
Useful to call uc_mem_map() with memory/size aligned.

Signed-off-by: Nicolas PLANEL <nplanel@redhat.com>
2016-03-04 15:54:24 +11:00
mkravchik
90d15b9a57 Added files via upload
VMOV emulation fails on ARM (in Thumb mode)
2016-02-29 14:52:47 +02:00
Nguyen Anh Quynh
aabcb95f01 unit: remove ^M from test_x86_soft_paging.c 2016-02-22 14:02:28 +08:00
Nguyen Anh Quynh
2f28f3f210 unit: make test_x86_soft_paging.c compilable. also update .gitignore for its binary 2016-02-22 14:01:00 +08:00
Ramirez57
2ab2b229ce test case: x86 guest paging
Test case for x86 paging using virtual addresses mapped by Unicorn, as well as unmapped.

Attempting to read/write from virtual address ranges unmapped by Unicorn wrongly causes protection faults, even when the virtual address points to read/write regions of Unicorn memory.
2016-02-22 00:03:14 -05:00
emdel
f010219a0f zf set to 1 2016-02-18 06:29:59 -08:00
emdel
0383db9d27 Added assert 2016-02-18 06:26:01 -08:00
Nguyen Anh Quynh
6e5a3a6d5b regress: chmod +x jumping.py 2016-02-18 21:58:48 +08:00
emdel
de5a887ed2 testcase to set ZF and modify eflags 2016-02-17 13:56:20 -08:00
Nguyen Anh Quynh
871cdb692f Merge branch 'hook' 2016-02-17 09:37:17 +08:00
Nguyen Anh Quynh
b69feb8d0b Merge branch 'master' into memleak2 2016-02-15 15:52:10 +08:00
coco
bfbe91834e two more testcases 2016-02-11 15:02:14 +01:00
Nguyen Anh Quynh
a7a1dcc661 uc_hook_add(): add begin & end arguments for all hook types. also update Python binding after this change 2016-02-11 08:02:13 +08:00
Nguyen Anh Quynh
6478a24404 Merge branch 'gdt_idt' of https://github.com/cseagle/unicorn into cseagle-gdt_idt 2016-02-06 17:31:42 +08:00
Chris Eagle
49b9f4f8da uc_x86_mmr type available in qemu/target-i386/unicorn.c 2016-02-04 19:09:41 -08:00
Nguyen Anh Quynh
07e8f2f60d Merge pull request #423 from lunixbochs/master
add regress for #421
2016-02-05 09:45:01 +08:00
Ryan Hileman
bcfa41c90d add regress for #421 2016-02-05 02:35:17 +01:00
Nguyen Anh Quynh
9b6d1bf324 regress: fix compilation warning for mem_fuzz.c 2016-02-05 08:54:52 +08:00
Nguyen Anh Quynh
a5d9daaef4 Merge branch 'mem_fuzzing' of https://github.com/eqv/unicorn into eqv-mem_fuzzing 2016-02-05 08:49:18 +08:00
Chris Eagle
59f7bf3be7 file perms 2016-02-04 16:48:27 -08:00
Chris Eagle
e59382e030 updated gdtr/idtr/ldtr/tr read/write code 2016-02-04 16:44:52 -08:00
coco
1e13777c91 added memory fuzzer and 2 resulting testcases 2016-02-04 19:57:20 +01:00
Chris Eagle
9977054a15 add support for setting gdtr, idtr, ldtr, and tr programatically 2016-02-03 09:22:29 -08:00
Nguyen Anh Quynh
101f14285a chmod +x arm_init_input_crash.py 2016-02-03 09:20:15 +08:00
McLovi9
ac806d3bfb Create arm_init_input_crash.py 2016-02-02 20:36:36 +01:00
Nguyen Anh Quynh
20b01a6933 fix merge conflict 2016-02-01 12:08:38 +08:00
Nguyen Anh Quynh
e42aba760f fix a typo in test_tb_x86.c 2016-01-31 14:07:35 +08:00
Nguyen Anh Quynh
32b9deca04 unit: use UC_HOOK_MEM_VALID for test_tb_x86.c 2016-01-31 13:14:11 +08:00
Nguyen Anh Quynh
1fb5416f4a unit: simplify test_tb_x86.c 2016-01-31 13:06:42 +08:00
Nguyen Anh Quynh
a5020c69bb Merge pull request #408 from egberts/master
Pull Request for Issue #364: Invalidating Translation Cache after self-modifying code
2016-01-31 10:37:04 +08:00
steve
fc22a359e2 Issue #364 - Move RIP/PC closer next to the offending self-modifying code
which modified the 2nd next instruction (imul) in which that escaped
our wonderful ability to invalidate the
instruction translation cache in which we badly need to pick up the
self-modification being made.
2016-01-30 19:30:17 -05:00
Nguyen Anh Quynh
5a04bcb115 allow to change PC during callback. this solves issue #210 2016-01-28 14:06:17 +08:00
Nguyen Anh Quynh
48ab148d1c Merge branch 'hook' 2016-01-26 22:52:29 +08:00
xorstream
7973f6b4c9 Added mode endian flags for sparc tests and fixed mode in sparc_jump_to_zero.c 2016-01-25 13:50:26 +11:00
xorstream
26d3b1e7d6 Added ppc 32bit mode and added sparc mode checks to bring it in line with other archs 2016-01-24 22:27:33 +11:00
Nguyen Anh Quynh
249e2ac0a0 Merge branch 'hook-refactor' of https://github.com/lunixbochs/unicorn into lunixbochs-hook-refactor 2016-01-23 10:58:37 +08:00
Nguyen Anh Quynh
d79925f477 sparc: add SPARC32 mode (= UC_MODE_32) 2016-01-23 10:48:18 +08:00
Ryan Hileman
33180b5afa add test for multiple basic block hooks 2016-01-22 18:42:14 -08:00
Nguyen Anh Quynh
5c6c67bb3a regress: fix Sparc mode for sparc_reg.py 2016-01-23 10:17:42 +08:00
xorstream
8763d426c2 Fix uc_mode usage in source code 2016-01-23 12:08:49 +11:00
Nguyen Anh Quynh
840eb54f05 Revert "arm64: fix the access to tcg_op_defs[] in arm64 backend (issue #387)"
This reverts commit 3000ca6abf.
2016-01-22 11:33:36 +08:00
Nguyen Anh Quynh
3000ca6abf arm64: fix the access to tcg_op_defs[] in arm64 backend (issue #387) 2016-01-22 11:33:28 +08:00
Nguyen Anh Quynh
6f0a01293d unit: fix some compilation warnings in test_tb_x86.c 2016-01-17 10:06:00 +08:00
steve
f0dac63b69 In response to issue #364, a unit test case has been created
for exercising proper flushing of the instruction translation cache.
2016-01-16 18:05:32 -05:00
Nguyen Anh Quynh
d0125eb8bf regress: add invalid_write.py to test issue #371 2016-01-13 11:35:09 +08:00
Nguyen Anh Quynh
7de48f2f75 regress: add emu_clear_errors to .gitignore 2016-01-12 01:02:45 +08:00
Nguyen Anh Quynh
e1fe63ae13 regress: fix compilation warnings for emu_clear_errors.c 2016-01-12 00:37:15 +08:00
Nguyen Anh Quynh
fa430b4ad4 Merge branch 'test/issue-351' of https://github.com/williballenthin/unicorn into williballenthin-test/issue-351 2016-01-12 00:22:33 +08:00
Willi Ballenthin
a9d4b4cfa7 add test case in C demonstrating issue 351 2016-01-11 09:57:13 -05:00
Nguyen Anh Quynh
f4a5273ce7 Merge pull request #365 from williballenthin/test/issue-351
add test case demonstrating issue 351
2016-01-11 16:13:52 +08:00
Ryan Hileman
b6db70808d add regress for #366 2016-01-10 23:51:11 -08:00
Willi Ballenthin
b2b1d0be01 add test case demonstrating issue 351 2016-01-10 23:56:34 -05:00
Nguyen Anh Quynh
2a269acac1 regress: add memleak_xxx.c to test memleak issue 2016-01-10 23:56:14 +08:00
Nguyen Anh Quynh
ec4a47fc19 regress: fix 1 more compilation warning on printf format 2016-01-10 23:55:19 +08:00
Nguyen Anh Quynh
32bca0bd02 regress: fix some compilation warnings on printf format 2016-01-10 23:45:02 +08:00
farmdve
264c4c1b54 Add some fixes to the tests.
My mem_nofree test fails on the latest code as apparently my address and
sizes overlap each other.

The mem_unmap test failed as the invalid memory hook case was incorrect.
2016-01-05 18:02:54 +02:00
Nguyen Anh Quynh
06108ea908 regress: add rep_hook.py 2016-01-01 10:44:08 +08:00
Nguyen Anh Quynh
91501bc2d1 unit: modify the testcase #349 to reflect the recent change on the semantics of uc_mem_map() 2015-12-30 09:19:34 +08:00
Nguyen Anh Quynh
6e534417f1 unit: change clang -> CC 2015-12-30 08:50:58 +08:00
coco
fa2da819b6 added test for unmap of doubly mapped region 2015-12-28 22:02:31 +01:00
Nguyen Anh Quynh
99b401c609 Merge branch 'la-fixed' of https://github.com/JCYang/unicorn into JCYang-la-fixed 2015-12-28 12:21:31 +08:00
Justin Campbell
9da93af861 Removed commented out code from MIPS kernel MMU test 2015-12-28 00:36:56 +00:00
Justin Campbell
822198ad16 Added new regression test for ability to execute MIPS at KSEG0 and higher when in kernel mode 2015-12-28 00:34:26 +00:00
Spl3en
c9f6648877 Add sysenter_hook_x86 to tests/regress/Makefile and sysenter_hook_x86 to .gitignore. 2015-12-24 18:25:35 +01:00
Spl3en
4c3ad139ea (Fix #341) SYSENTER instruction is not properly hooked with uc_hook_add in x86 emulation.
helper_sysenter in qemu/target-i386/seg_helper.c didn't check properly if a call interrupt callback was registred.
It has been fixed by copying the helper_syscall behavior.
2015-12-24 16:00:22 +01:00
Nguyen Anh Quynh
ed319bda0b x86: identity map guest address to host address. this fixes issue #300 2015-12-24 09:51:17 +08:00
Nguyen Anh Quynh
2984901f62 regress: fix testcase hook_code_add_del.py 2015-12-23 01:45:29 +08:00
Nguyen Anh Quynh
b29ce1c4fd chmod +x hook_code_add_del.py 2015-12-23 01:44:02 +08:00
Nguyen Anh Quynh
0f6d27cc88 Merge branch 'xorstream-mips_branch_likely_issue' 2015-12-23 01:40:51 +08:00
Nguyen Anh Quynh
24d344bf61 Merge branch 'master' of https://github.com/unicorn-engine/unicorn 2015-12-23 01:40:42 +08:00
Nguyen Anh Quynh
85c2bd31f5 indentation 2015-12-23 01:18:52 +08:00
Nguyen Anh Quynh
3bd2e1213d Merge pull request #335 from michalmalik/patch-1
Add regress test for issue #334
2015-12-22 21:30:22 +08:00
farmdve
784b8066e2 Add test for pre-instruction hook being called more times. 2015-12-22 12:33:36 +02:00
Michal Malik
39c7f0fb1d Add regress test for issue #334
https://github.com/unicorn-engine/unicorn/issues/334

The code is a bit different than in the issue, but it should demonstrate the main problem just fine.
2015-12-22 11:29:55 +01:00
xorstream
ae64fb370b Fix address in comments 2015-12-22 21:01:30 +11:00
JC Yang
5be70eb91b Add test case for issue 287. 2015-12-22 15:25:36 +08:00
Nguyen Anh Quynh
ee1772e28a indentation 2015-12-22 15:13:59 +08:00
xorstream
5fda79b38a Updated mips_branch_likely_issue test to check if executed and hooked. 2015-12-21 09:57:15 +11:00
Nguyen Anh Quynh
5e8af30110 indentation 2015-12-20 20:43:37 +08:00
xorstream
7c1297662c Added test for MIPS branch likely instructions. 2015-12-20 16:07:54 +11:00
Nguyen Anh Quynh
63e227a585 indentation 2015-12-20 12:16:03 +08:00
xorstream
caa437c0ff Added test for uc_emu_stop() in code hook not always stopping the emu at the current instruction. 2015-12-20 15:03:34 +11:00
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