Commit graph

56 commits

Author SHA1 Message Date
Anton Kochkov
25fd417a28
Add user pointer to RzListComparator (#4204) 2024-02-11 13:28:33 +08:00
Siddharth Mishra
9ab709bc34
Improve cmd_help.yaml and fix random number generator (#3452)
* Improve cmd_help.yaml and fix a small bug
* Add support for 64bit random numbers
* Make a distinction between 32- and 64-bit PRNG
* Add documentation for new functions
* Change the RBTree test to use 32-bit random numbers
2023-04-07 20:22:01 +08:00
Riccardo Schirone
c4767cf1ac
Fix plugin removal and clean code (#3277)
* cmd: Fix summary of few "L" sub-commands
* util: start decluttering plugins handling

- Add Doxygen docs
- Remove unused API functions and make others internal only
- Use RzLibType enum for plugin type instead of int

* util: move dlopen/dlsym/dlclose to rz_sys
* util: make rz_lib_open/close return bool
* util: simplify rz_lib_add_handler and rz_lib_open*
* libs: implement rz_*_plugin_del to remove a plugin
* core: remove commands from RzCmd when removing plugins
* librz: call plugins 'fini' method when removing a plugin
* core/cmd: do not fail if the hashmap removal fails

When removing a group command, the inner command might have the same
name, thus it would result in trying to remove the same name twice.
Ignore it, as it is fine.

* librz: make RzCrypto plugins handling like the others
* librz/crypto: add rz_crypto_reset and use it
* librz: allocate the plugin structures before adding them
2023-01-16 13:32:46 +01:00
Giovanni
55e690990b
Fix endianness for win pagedump and winkd (#3204) 2022-12-09 11:41:28 +01:00
Dean
59b38e6efa
Add /*<type>*/ comments everywhere (#2986)
Adds /*<type>*/ comments and a linter check from rz-bindgen to enforce
their existence and consistency

Also includes the following fixes made when adding the annotations:
* removed unused intern_table arguments in pyc_dis.c, pyc_dis.h, asm_pyc.c
* removed unused classes argument from place_nodes in agraph.c
* removed unused recurse and recurse_bb functions in canalysis.c
* removed unused vars field from RzPrint struct
* removed unused RzAnalysisType* structs from rz_analysis.h
* removed unused list field from RzEgg struct
* fixed bug in bp_plugin.c where duplication-checking logic iterates over the wrong list
* removed unused q_regs field from RzDebug struct
* removed unused backtrace field from RzDebugPlugin struct
* removed unused classes_list field from RzBinNXOObj struct
* removed unused methods_list and classes_list fields from RzBinZimgObj struct
2022-09-11 13:04:53 +08:00
Riccardo Schirone
2987e035da hash: use RzHash in most hash APIs 2022-06-28 21:55:26 +08:00
Riccardo Schirone
9ea7c2fa5a RzHash: rename everything in librz/hash to RzHash prefix 2022-06-28 21:55:26 +08:00
Riccardo Schirone
fdd7c6200c
Fix compilation on Termux and Haiku (#2671)
* build: fix compilation on Termux by using meson checks
* build: fix compilation on termux, which is recognized as linux

meson identifies termux as "linux" system, however pthread_sigmask is
not available there. Since pthread-fixes.c just defines
uv__pthread_sigmask we include it also in regular linux builds, because
the function is then used automatically instead of pthread_sigmask only
when __ANDROID__ is defined.

* subprojects/rzwinkd: define cc in meson.build before use
2022-06-07 23:44:41 +02:00
GustavoLCR
3bc60f6800 WinKD: Add nullability/ownership markers to functions 2022-06-05 00:27:35 +08:00
GustavoLCR
ab498718c3 WinKD: Use ut* macros instead of uint_* types 2022-06-05 00:27:35 +08:00
GustavoLCR
f10e5d865a Debug: Allow dce in all platforms
* Used for `WinKD` and `Windows` debug
2022-06-05 00:27:35 +08:00
GustavoLCR
953ffb47fb WinKD: Switch to current process and thread 2022-06-05 00:27:35 +08:00
GustavoLCR
cd1f5469ab WinKD: Use kernel module address from version packet 2022-06-05 00:27:35 +08:00
GustavoLCR
811a9a2819 WinKD: Fixes for packet sending/receiving
* Ignore resent packets
* Resend packet if we didn't get an ACK
* Break if Ctrl-C is pressed
* Always wait for a state change packet in debug event wait function
2022-06-05 00:27:35 +08:00
GustavoLCR
e63faa6005 WinKD: Fix incomplete register write
* Fix register read size
2022-06-05 00:27:35 +08:00
GustavoLCR
4f3c4935af WinKD: Fix incomplete reads 2022-06-05 00:27:35 +08:00
GustavoLCR
dbed351f19 DMP/WinKD: Basic memory mapping info 2022-06-05 00:27:35 +08:00
GustavoLCR
43b9f6487a WinKD: Fix OOB write 2022-05-11 18:39:51 +08:00
GustavoLCR
d70e0b01ba WinKD: Fix kd connection through a pipe 2022-05-11 18:39:51 +08:00
GustavoLCR
be498444ec WinKD/DMP: Add Windows 10 20H2 and 21H2 profiles 2022-05-10 10:22:49 +08:00
GustavoLCR
0cb346e39a WinKD: Only modify seq_id after receiving an acknowledgment packet 2022-05-10 10:22:49 +08:00
GustavoLCR
de1b2e8d50 WinKD: Timeout if amount of tries to get packet exceeeds limit 2022-05-10 10:22:49 +08:00
GustavoLCR
a19ac23ee8 WinKD: Verbose log if address is not mapped 2022-05-10 10:22:49 +08:00
GustavoLCR
a9ea591ade WinKD: Keep a cache of current thread context 2022-05-10 10:22:49 +08:00
GustavoLCR
3cabf34561 WinKD: Remove winkd_lock_tryenter()
* Use `winkd_lock_enter()` and make it possible to break it through `RzCons`
2022-05-10 10:22:49 +08:00
GustavoLCR
210f87573e WinKD: Use DBGKD_VERS_FLAG_PTR64 to identify 64-bit machines 2022-05-10 10:22:49 +08:00
GustavoLCR
4c95c19251 WinKD: Factor out some common code into a function 2022-05-10 10:22:49 +08:00
GustavoLCR
0296e87b26 WinKD: Save kernel module info from state change packet 2022-05-10 10:22:49 +08:00
GustavoLCR
b6a84d284c WinKD: Handle reset packet type 2022-05-10 10:22:49 +08:00
GustavoLCR
c7a6312af5 WinKD: Add verbose logging to winkd_wait_packet() 2022-05-10 10:22:49 +08:00
GustavoLCR
e9cffc0afa WinKD: Create profile dynamically if not found
* Download kernel module and PDB
* Load kernel PDB info
2022-05-10 10:22:49 +08:00
GustavoLCR
61235f02a0 WinKD: Fix pids/tids cache
* Fix double-free of name in debug modules list
2022-05-10 10:22:49 +08:00
GustavoLCR
10cfd66598 WinKD: Avoid unnecessary re-syncing 2022-05-10 10:22:49 +08:00
GustavoLCR
c2d36fa024 WinKD: Fix reading kernel module list 2022-05-10 10:22:49 +08:00
GustavoLCR
c2ab12b01f WinKD: Fix data race in kdnet backend 2022-05-10 10:22:49 +08:00
GustavoLCR
bb388edcd4 WinKD: Send acknowledge response for all packets 2022-05-10 10:22:49 +08:00
GustavoLCR
170ab3eb3b
Remove windows.h include from rz_types.h (#2410)
* Create `rz_windows.h`
* Move `RzThread` structure definitions to internal header
* Create and use `rz_th_get_user()` API to avoid exposing `RzThread` layout in external header
* Make `rz_th_self()` an IPI
* Use `_wmkdir()` in `rz_sys_mkdir()` on Windows
* Remove unused `winkd_break_read` function
* Remove `RzIORap` definition from `rz_io.h`
* Remove include of `Windows.h` from `rz_types.h`
* Use `rz_windows.h` when necessary
* Remove `RzCoreRtrHost` definition from `rz_core.h`
* Remove `rz_socket.h` include from `rz_core.h`
2022-03-16 13:54:41 +01:00
GustavoLCR
dd81b6629a
Implement getting a backtrace from a Windows Kernel Dump for x64 (#2387)
* PE: Add header to mappings
* PE: Add temp defs for unknown `UNWIND_CODE_OPS`
* Core Bind: Add `RzCoreBinApplyInfo` binding
* DMP/WinKD: Always add kernel modules to mod list
* Implement Windows x64 SEH backtracing
* Fix `ompb` not prioritizing maps
* Optimize `rz_io_map_priorize()`
* DMP: Implement backtrace for x64
2022-03-15 10:45:02 +01:00
GustavoLCR
0129c3fa31 DMP/WinKD: Fix UTF16 decoding module name on Linux 2022-03-03 21:52:41 +08:00
GustavoLCR
c510827056 DMP/WinKD: Always include current thread/process 2022-03-03 21:52:41 +08:00
GustavoLCR
b634893cad DMP/WinKD: Read running status of threads 2022-03-03 21:52:41 +08:00
GustavoLCR
68a9966bc8 DMP/WinKD: Fix incorrect extra thread being listed 2022-03-03 21:52:41 +08:00
GustavoLCR
79c2ea11f0 DMP/WinKD: Check KOBJECTS are thread/proc on read 2022-03-03 21:52:41 +08:00
GustavoLCR
d187251d1c DMP/WinKD: Fixes for selecting thread/process 0
* Use `ctx->ethread/eprocess` as the way to identify if there is currently a target selected
* Fixes listing kernel modules if current process cid is 0
* Fixes listing threads if current process cid is 0
2022-03-03 21:52:41 +08:00
GustavoLCR
84fbd53c7d WinKD/DMP: Use RzLog API 2022-03-03 21:52:41 +08:00
GustavoLCR
555c011165 WinKD/DMP: Reorder function parameters for consistency with RzIO 2022-03-03 21:52:41 +08:00
GustavoLCR
11c366583e DMP: Fix ETHREAD address on triage dump
* Gets `ETHREAD` address from `KPRCB`
2022-03-03 21:52:41 +08:00
GustavoLCR
7c6810e2ee DMP: Read context from KPCRB if target is on a cpu
* Get `KiProcessorBlock` address from PDB
* Read KPCRBs and check if selected thread is running in one of the
  processors
* Read context from it if so
2022-03-03 21:52:41 +08:00
GustavoLCR
246cf762ff DMP: Dynamically create profile if not found
* Adds `rz_type` dependency to `rz_debug`
2022-03-03 21:52:41 +08:00
GustavoLCR
ce97cb50df DMP: Fixes for Triage Dump
* Fix ETHREAD and EPROCESS mapping for Triage Dumps
* Fix VA mapping for Triage Dumps
* Save register context inside `DmpCtx`
* Fix attaching to thread
* Fix selecting process/thread 0
2022-03-03 21:52:41 +08:00