Commit Graph

52 Commits

Author SHA1 Message Date
Nguyen Anh Quynh 66adfff20d samples: fix a typo 2022-10-12 14:39:10 +08:00
lazymio c05fbb7e63
Add a handy example to show how to handle invalid memory read/write 2021-11-16 23:15:38 +01:00
lazymio e62b0ef255
Add clang-format and format code to qemu code style 2021-10-29 12:44:49 +02:00
Nguyen Anh Quynh aaaea14214 import Unicorn2 2021-10-03 22:14:44 +08:00
lazymio 225d387325
Fix wrong sync after UC_ERR_[READ, WRITE, FETCH]_[UNMAPPED, PROT] (#1368)
* Fix wrong sync after UC_ERR_[READ, WRITE, FETCH]_[UNMAPPED, PROT]

Note that:
1. We only guarantee the pc (and other internal states) is correct
if and only of `uc_emu_start` returns without any error (or errors
have been handled in callbacks.).
2. If memory read/write error isn't handled by hooks, the state is
undefined and the pc is probably wrong if no hook is installed.

This fixes #1323.

* Rename variables

* Add note in unicorn.h

* Refine test_i386_invalid_mem_read_in_tb
2021-05-12 00:10:45 +08:00
Nguyen Anh Quynh 95e539f3e6 samples: make sample_x86.c to use uc_context_free() to free context (instead of uc_free()) 2020-09-24 22:37:01 +08:00
Nguyen Anh Quynh fbef45b18f remove UC_ERR_TIMEOUT, so timeout on uc_emu_start() is not considered error. added UC_QUERY_TIMEOUT to query exit reason 2020-05-24 23:54:45 +08:00
Dominik Maier 9fedbd96f4
fixed leaks in test cases (#1247) 2020-05-02 18:18:18 +08:00
ζeh Matt 3a3bc0c22d Timeout error (#1173)
* Implement timeout state and new error for such case

* Adjust test_i386_loop sample

* Adjust test_i386_loop test
2019-12-29 00:16:54 +08:00
Nguyen Anh Quynh 8f2d6cd70f samples: comment out test_i386_invalid_c6c7() 2017-06-14 16:14:36 +07:00
vardyh 944658e920 samples::x86: introduce C6/C7 validation testcase
Signed-off-by: vardyh <vardyh.dev@gmail.com>
2017-05-25 17:55:40 +08:00
xorstream 770c5616e2 Automated leading tab to spaces conversion. 2017-01-21 12:28:22 +11:00
xorstream 1fea4e6d87 Some small changes to clean up before pull request. 2017-01-20 22:34:14 +11:00
xorstream 002151874a Unicorn interface working with test app in 32bit and 64bit builds. 2017-01-20 17:27:22 +11:00
xorstream 1aeaf5c40d This code should now build the x86_x64-softmmu part 2. 2017-01-19 22:50:28 +11:00
Nguyen Anh Quynh bc569f5a54 rename API uc_mem_free() to uc_free(). see #662 2017-01-10 20:59:14 +08:00
Nguyen Anh Quynh fdbbdc6216 rename uc_context_free() to uc_mem_free(). see #373 2017-01-09 20:52:14 +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
Adrian Herrera e1a2cb5fe8 [samples] Added uc_context_* sample 2016-10-31 11:56:32 +01:00
Nguyen Anh Quynh 14a7628098 samples: fix print format specifies for uint64_t 2016-08-23 06:57:33 +08:00
Andrew Dutcher 9c720092d3 Add xmm register read/write samples in C and python 2016-08-14 18:45:59 -07:00
Nguyen Anh Quynh cc6cbc5cf7 Merge branch 'memleak' into m2 2016-04-18 12:48:13 +08:00
Adrian Herrera 903fb04f29 Another typo 2016-03-22 23:09:38 +11:00
Adrian Herrera b5ea277900 Fixed minor typos 2016-03-22 22:32:59 +11:00
Nguyen Anh Quynh fb1ebac000 Merge branch 'master' into m1 2016-03-09 15:13:42 +08: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 7c9f851e72 sample: remove memleak test code in sample_x86.c 2016-01-11 00:08:04 +08:00
Nguyen Anh Quynh cd6c98f5df sample: make hook_out() of sample_x86.c more deterministic 2016-01-10 23:25:05 +08:00
Nguyen Anh Quynh 771f9f7c3b fix conflicts when merging map-ptr branch to master branch 2015-12-17 08:12:02 +08:00
xorstream f68077852f Fixed includes for moved unicorn_dynload.h file 2015-12-15 17:17:14 +11:00
Nguyen Anh Quynh 1b145f431b code style 2015-12-10 00:53:48 +08:00
xorstream c5c13e110a Added samples projects for MSVC binding.
Added MSVC support to unicorn samples.
2015-12-08 18:21:32 +11:00
Ryan Hileman 230cbd5330 add permissions to map_ptr api 2015-11-28 11:28:31 -08:00
Nguyen Anh Quynh f4882ae1a2 simplify code by replacing mem_map_start()/mem_map_finish() in uc.c with mem_map() 2015-11-28 18:26:08 +08:00
Nguyen Anh Quynh 8f1e8c0ab1 add sample code for API uc_mem_map_ptr() 2015-11-28 16:17:52 +08:00
practicalswift 2dc0451e3a Remove trailing whitespace. 2015-10-30 22:34:35 +01:00
Matt 938a118221 Fix typo in register name
Register should be `edx` (not `dex`).
2015-10-15 20:38:44 +02: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 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
Jonathon Reinhart 2c0556826f samples: remove (uint8_t*) casts to mem API calls
These casts are now unnecessary.
2015-09-07 13:09:05 -04:00
Nguyen Anh Quynh d1bdbd11e7 rename uchook to uc_hook, ucengine to uc_engine, uc_hook_t to uc_hook_type 2015-09-05 11:20:32 +08:00
Jonathon Reinhart 5f32e2c1ae s/uc_hook_h/uchook/g 2015-09-03 22:39:23 -04:00
Jonathon Reinhart 5b62d436a9 change public APIs to use `ucengine`
See #52.
2015-09-02 22:00:09 -04:00
Jonathon Reinhart 3bd705a060 Merge remote-tracking branch 'upstream/master' into change-handle-based-api 2015-08-30 00:23:51 -04:00
Chris Eagle 94ac0f02e6 file permissions changes 2015-08-28 20:03:36 -07:00
Chris Eagle 65787d415a rename uc_mem_map_ex to uc_mem_map and all associated changes 2015-08-28 20:02:21 -07:00
Nguyen Anh Quynh d3de7aa567 samples: add sample code for hooking SYSCALL instruction in sample_x86.c 2015-08-29 00:22:11 +08:00
Jonathon Reinhart 4c9e78d2f9 samples: update sample_x86 to use new API 2015-08-26 09:02:17 -04:00
Nguyen Anh Quynh 192f07c503 reset invalid_error after callbacks decide to continue after invalid memory accesses 2015-08-26 16:15:38 +08:00
Nguyen Anh Quynh 22b549a4db x86: add sample for 16bit mode 2015-08-26 09:25:29 +08:00