Commit Graph
29338 Commits
Author SHA1 Message Date
Anton Kochkov ad4e1cd34e librz/arch/alpha: build only for Capstone > 5 (#4735) 2024-11-24 23:46:19 +08:00
Anton Kochkov a8da505c5f DEC Alpha disassembly and analysis plugins (#4059) 2024-11-24 21:17:29 +08:00
wargio db6c5b39c0 Removed call to command m which does not exist 2024-11-24 17:42:17 +08:00
wargio 1a3a845200 Refactor of pebble parser 2024-11-24 17:42:17 +08:00
Rot127 be24ca8879 librz/core/cmd: convert pj to RzShell (#4726)
Move the `pj `command to RzShell. It also does some clean ups:

 -  Remove `pj.`, because it was an alias for pj @ 0
 -  Remove `pj..`, because the JSON path function always returned NULL (never a valid value), and did not document what it does in the first place.
 -  Print message for user if no valid data was found at address.
 -  Change description of command to be more clear it only prints formatted JSON strings.
 -  Remove unused size/len argument.
 - Add a new test for `pj`.
 - Add some general documentation how to implement or find a command.
2024-11-24 10:20:06 +08:00
Khairul Azhar Kasmiran 3556a7ea04 Remove -Wno-deprecated-non-prototype from macos build (#4728) 2024-11-22 21:28:16 +08:00
Roee Toledano 2e5473ba4e Fix NE relocation naming (#4725)
* Fix NE relocation naming
* Name NE relocations by combining `src` and `flag`
* Fix old test + add additional tests
* use CONCAT_RELOC_STR instead of CONCAT to avoid issues.
2024-11-22 21:27:36 +08:00
Roee Toledano db60b71c52 Fix memory leaks in PE format (#4727)
* Fix freeing of relocation array when no relocations are present

* Reimplement canary checking for PE for speed + getting rid of memory leak when calling imports()
2024-11-22 10:25:02 +08:00
Roee Toledano 82b119d253 Implement PE base relocations
1. Everything is based off of Microsoft's PE format documentation [found here](https://learn.microsoft.com/en-us/windows/win32/debug/pe-format)
2. Up until now, imports were used for relocations in the PE & MDMP format,
   which is wrong. PE uses base relocations.
3. PE relocations do not have symbols associated with them, and thus
   have no name. In order to still have flags in relocs flagspace, dummy
   symbols were allocated with generic names composed of the relocation's
   virtual address space.

* Remove old code of setting import entries to PE relocations
* Parse PE base relocations
* Implement converting from the specific RzBinPeRelocEnt type to the
  general RzBinReloc type
* Implement corrent type naming of PE relocations
* Add missing `PE_IMAGE_FILE_MACHINE` types
* Add PE base relocation types
* Fix PE format 'has_canary' function
* Remove 'RzBinPEObj.endian' and use 'RzBinPEObj.big_endian' instead
* Removed a.exe and b.exe tests, as they don't contain base relocations
  and swapped them with correct tests
* Corrected old PE relocation tests
* Add new PE base relocation tests
2024-11-21 08:53:52 +08:00
Roee Toledano 59cb50d2af Remove MDMP relocations
MDMP doesn't have any relocations (base or COFF), only contains imports of the dumped executable.
Up until now, imports were used which is wrong.

* Remove MDMP relocations
* Remove MDMP relocations tests
2024-11-21 08:53:52 +08:00
Giovanni 266fe6b3c7 Split rz_core_get_boundaries_prot and rewrite the code. (#4724) 2024-11-19 12:51:26 +08:00
Khairul Azhar Kasmiran 03fccba3a9 test: tighten regex in "maps as flags"(#4723) 2024-11-17 22:44:46 +08:00
Roee Toledano 7b85dd55ac librz/bin: MZ format migrate to new relocation naming (#4722)
* MZ format migrate to using new relocation naming
* Add MZ relocation test
2024-11-17 22:43:55 +08:00
Khairul Azhar Kasmiran 381ff80b59 ci: Remove -Wno-cpp (#4721) 2024-11-17 13:59:38 +08:00
Rot127 6ec0249e78 Fix disasm if first instruction is at a map boundary. (#4718) 2024-11-17 13:49:17 +08:00
Khairul Azhar Kasmiran 9ef17a4484 socket_http_get_recursive: Free err (#4720) 2024-11-16 08:49:33 +08:00
Khairul Azhar Kasmiran 0b24a9f1fc socket_http.c: Show curl error on failure (#4719) 2024-11-16 06:26:34 +08:00
Rot127 8eec797a3b doc: correct doxygen for rz_bv_copy() (#4715) 2024-11-14 11:41:26 +08:00
Azamat H. Hackimov d2bd9406a2 Use blocksize to determine size for rz_cmd_disassembly_n_bytes_handler() (#4714) 2024-11-12 11:49:21 +08:00
Rot127 cbcae307f9 fix: plugin configs are indexed by plugin name only. (#4710) 2024-11-12 10:38:16 +08:00
amibranchandamibranch 70654e80f6 build: Fix meson-build global_arguments (#4698)
* Added a CI-task to check if rizin could be used as subproject
* Fixed some new global-arguments in meson-build

Co-authored-by: amibranch <[email protected]>
2024-11-11 19:07:34 +08:00
billow bb10d60d79 librz/arch: enable xtensa plugin only for capstone next (#4708) 2024-11-11 15:23:35 +08:00
billow c3c494d961 librz/arch: migrate Xtensa to Capstone (#4654)
* Add xtensa arch capstone plugin
* Remove xtensa-gnu
* fix: `asm.cpu` is not set correctly, when there is no “,” in asm plugin -> cpus
* fix core_disassembly when n_bytes==0
* fix xtensa_analyze_op_esil
* fix xtensa esil pc mod
* fix xtensa esil l32r
* fix xtensa esil call0
* fix xtensa esil extui
* fix xtensa esil store
* fix xtensa stack inc and ret
* keep `asm.cpu` when valid in cb_asmarch
* fix cb_asmarch
* fix max op size
* xtensa: add cpu select
* xtensa: mark PUSH POP
* xtensa: set src dst
* xtensa: set dir
* xtensa: fix stackframe
2024-11-11 00:38:54 +08:00
Khairul Azhar Kasmiran 48b21fb3c5 Test rizinorg/rz-pipe#58 that discards startup banners (#4706) 2024-11-09 20:48:42 +08:00
Giovanni e78a7be614 Remove dead code (#4705) 2024-11-08 18:46:13 +08:00
Giovanni 83980f04c6 Use st64 instead of int for rz_config_set_i_cb (#4704) 2024-11-08 16:05:51 +08:00
Siddharth Mishra 73ce3bf1dd librz/analysis: add force function rename API (#4703)
* Force Function Rename

New function to forcefully rename a function. Multiple retries will be
performed by adding a numeric suffix to function name until the number
of retries max's out

* Improve Force Rename & Add Tests

* Add RZ_NONNULL to Function Declarations

* Add RZ_BORROW To Force Rename

* Apply Suggested Edits & Improve Tests

The whole point of force rename is that simple rename op might fail, so
I added a test to make sure it actually fails when we need it to...
hence the need for existence of force rename

* Free Variables & More Checks Added To Tests

* Check Full Name Of Renamed Function

Instead of just checking whether the starting of function matches with
expected name, check the complete name to be exactly same.

* Change Documentation Style
2024-11-08 09:01:25 +08:00
Roee Toledano 64a4bb491a librz/bin/coff: fix relocations naming (#4701)
* Update COFF relocations
* Break down `relocs_foreach` to sub functions for readability
* Migrate to using `RzBinReloc.print_name` for reloc name printing
* Update COFF relocation tests
2024-11-06 00:35:33 +08:00
Roee Toledano 8b90795e32 librz/bin: use relocation types name defined by each format. (#4695)
* Change ELF relocation type names to the naming used by SysV ABI
* Modified `bin_reloc_type_name` to return correct naming if possible,
  otherwise return the old ADD/SET naming.
* Add `print_name` field to `RzBinReloc`
* Fix ELF relocations tests
2024-11-04 13:20:08 +08:00
Anton Kochkov f1e555901f ci: use muon-bootstrap name for bootstrap (#4700) 2024-11-04 13:17:03 +08:00
billow c6a3512866 librz/arch/tricore: bump capstone and fix RzIL generation (#4696)
* bump capstone next f6f967961b913cf4fc1c6233f6cf42194a0938ca
* fix: tricore il and test
* Fix code scanning alert no. 1874: Multiplication result converted to larger type
2024-11-03 19:47:12 +08:00
Khairul Azhar Kasmiran 9f421d962a Add -1 to man rizin (#4694) 2024-10-30 21:22:27 +08:00
Giovanni a6044fd258 Print the max number of lines as default in pd (#4692) 2024-10-30 11:06:58 +08:00
amibranchandamibranch 8e6b764fb5 build: Improved meson-build to use rizin as subproject (#4684)
* Setting GNU99/C99 standard for subprojects
* Remove use of `add_global_arguments`
* Added extern "C" linkage specification to some public headers of rizin
* Changed the meson_git_wrapper.py-script to explicitly specify the output-path
* Made the RIZIN_BUILD_PATH conditional in the integration-test meson-build

Co-authored-by: amibranch <[email protected]>
2024-10-29 23:59:42 +08:00
Rot127 86d8953912 librz/arch: use proper capstone enum names. (#4691)
* Use pre-v5 enum names which are now supported by compatibility macros.
* Bump CS version to newest next
* Remove Capstone v6 job until v6 patch release is out.
* Check for support of enum compare/conversion warnings.
2024-10-29 17:11:34 +08:00
Rot127 30953d3bf6 refactor: Use HtSP for storing plugins. (#4687)
* Refactor: Use HtSP for storing plugins.

This saves iterations when searching for a plugin of a given name.
It also allows to save plugin configurations and data in hash table,
all addressed by their name. Hence, usage is more streamlined.

* Fix: iterators iterate over pointers of pointers.

* Soften the NULL check.

If arch is passed on from another struct, NULL is an allowed invalid value.

* Fix some leaks

* Fix NULL checks and incorrect inits

* Fix more leaks

* Add warning if plugin with same name was added before and is overwritten.

* Document rz_str_cmp

* Add function to create new list from iterator.

* Sort plugins alphabetically when listed.

* Fix parameter attributes, NULL checks, leaks and single rename.
2024-10-26 16:31:13 +08:00
Khairul Azhar Kasmiran 7d63546451 mac ci: Make PATH invariant to installed Python version (#4689) 2024-10-26 00:05:51 +08:00
Rot127 f82993a30d librz/arch: capstone v6 update (without MIPS) (#4662)
* Bumps Capstone version to newest Capstone next (beyond first v6-Alpha1).
* Fixes leaks
* Fixes build and change to AArch64 and SystemZ compatibility headers.
* Marks M68k test as broken (see commit message).
* Fix AArch64 and SystemZ tests
* Handle op.size == 0 for x86 IL ops
2024-10-25 00:07:07 +08:00
Anton Kochkov 2fafb3dbe5 ci: add Python 3.13 for macOS builders (#4688) 2024-10-25 00:05:04 +08:00
Khairul Azhar Kasmiran 2e831b278f mac ci: Drop pkg-config install step (#4685) 2024-10-23 23:29:39 +08:00
Khairul Azhar Kasmiran f641480afa ci: Reinstate macos-meson-clang-tests build on macos-13 (#4682)
* Revert "Upgrade build-osx-pkg build to macos-14 (#4677)"
* Revert "ci: Remove macos-12 build (#4676)"
* Upgrade macos builds to macos-13
* Add fetch-depth: 2 to build-osx-pkg build
* Add -Wno-deprecated-non-prototype flag to `macos-meson-clang-tests` build
2024-10-23 17:32:51 +08:00
Khairul Azhar Kasmiran 1a8b3c632e Upgrade build-osx-pkg build to macos-14 (#4677)
* Upgrade build-osx-pkg build to macos-14
* Update test-osx-pkg build to macos-14
2024-10-19 18:01:54 +08:00
Khairul Azhar Kasmiran f2a6d2a56c ci: Remove macos-12 build (#4676) 2024-10-17 21:32:36 +08:00
Rot127 9e2de0dd50 RzAsm/RzAnalysis pointer sharing changes before RzArch and Hexagon fixes (#4667)
* Attempt of passing pointers from RzAsm to RzAnalysis and wise versa.
* Refactor Hexagon module to make use of hacky pointer sharing.
* Refactor plugin specific configutations.
Because static values are no longer allowed, it has to be sure
that the 'user' pointer for the config value setter is always the plugin data.
So the plugin can change its internal state, according to the configuration value.
This was not possible before.
Also it adds a seperated hash map for plugin values. So they are logically more separated.

* Fix the whole pre-decoding logic for Hexagon.
Also resolves the problems with not knowing what is a valid instruction and which one not.
Leads to way more stability in decoding.

* Formatting and docs.
* Save utf8 flag to state to save memcpy.
* Fix inconsistency in function declaration.
* Fix token tests and fix hexagon plugin to handle none IO buffers.
* Fix test. Empty buffer before printing same instruction again.
* Assign state to rz_reverse struct so it can be passed o hex_get_il_op() in analysis_hexagon.c
* Rename and document alignment fields better.
* Add test for out of order packet decoding.
* Add ownership information
* Import relative headers.
2024-10-17 15:30:40 +08:00
Khairul Azhar Kasmiran 4fd556c2a3 Add /rz-pipe to test .gitignore (#4673) 2024-10-17 08:03:53 +08:00
Giovanni e8aa5100a7 struct timezone is obsolete/deprecated (#4672)
https://man7.org/linux/man-pages/man2/gettimeofday.2.html
2024-10-16 17:13:17 +08:00
z3phyr b80cdd32e2 Expose APIs for rz-solver (#4648)
* Remove usage of rz_core_cmd_strf
* Expose APIs for rz-solver
* Fix mismatched fn annotation
* Add compound OP for rz-solver
* Add new APIs for compound OPs
* Add new testcases for compound op
* Fix testcases for rop constraint
2024-10-16 16:23:10 +08:00
Giovanni 6cd52783cc Fix missing declaration of struct timezone. (#4671)
Fixes: ‘struct timezone’ declared inside parameter list will not be
        visible outside of this definition or declaration
2024-10-16 14:53:53 +08:00
Khairul Azhar Kasmiran 1463c1e8b0 Refactor ASAN LD_PRELOAD setup into script (#4670) 2024-10-15 22:49:50 +08:00
billow 2a42a6f8c5 fix: dwarf line op loading (#4669) 2024-10-14 23:44:56 +08:00