Commit graph

28810 commits

Author SHA1 Message Date
wargio
a9131cede7 Remove hidden static in rz_str_pad 2024-01-06 23:30:07 +08:00
wargio
00b1b937f1 Remove global in chmod.c 2024-01-06 23:30:07 +08:00
wargio
0b075c8388 Remove hidden static in print_addr 2024-01-06 23:30:07 +08:00
wargio
aa7e6d80ad Remove hidden static in run_basic_block_analysis 2024-01-06 23:30:07 +08:00
wargio
36804f10f5 Remove hidden static in rz_bin_pe_get_entrypoint 2024-01-06 23:30:07 +08:00
wargio
b17881aca7 Remove hidden static in rz_dyldcache_symbols_from_locsym 2024-01-06 23:30:07 +08:00
wargio
b98ba64908 Remove hidden static in rz_analysis_cc_max_arg 2024-01-06 23:30:07 +08:00
wargio
036606c8b6 Remove hidden static in __stepOut 2024-01-06 23:30:07 +08:00
wargio
9597f1f9d3 Move cmpval into RzAnalysis 2024-01-06 23:30:07 +08:00
wargio
c93624712a Remove read ahead globals.
backport from radare2 dd01b31f71ce7698a416f41556df488da5676dfe
2024-01-06 23:30:07 +08:00
wargio
31b104c866 Remove hidden static in rz_bin_object_patch_relocs 2024-01-06 23:30:07 +08:00
Peiwei Hu
886dfa5c17
Transition from list to pvector for symbols in RzBinPlugin (#4077) 2024-01-06 19:54:19 +08:00
Rot127
c1c35199a4
Return empty ESIL for new instructions which have immediates where previously regs were assumed. (#4075) 2024-01-06 00:27:57 +08:00
Giovanni
a060e3beb5
Add rz_th_queue_from_pvector to initialize a queue from a pvector (#4069)
* Add rz_th_queue_from_pvector to initialize a queue from a pvector
* Rename methods to create queue.
2024-01-05 21:40:25 +08:00
Rot127
77302c80b7
Fix #4070 (#4071) 2024-01-05 21:39:06 +08:00
Anton Kochkov
e55891d799
Mention tools in README (#4065)
Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
2024-01-05 12:29:35 +08:00
Anton Kochkov
3afd475f97
Remove static and global variables in SDB (#4068) 2024-01-05 00:27:57 +08:00
Peiwei Hu
b43fe31877
Transition of strings in RzBinPlugin (from RzList to RzPVector) (#4052) 2024-01-04 22:23:31 +08:00
Anton Kochkov
8e1afb991e
Remove static and global varibles in esil_trace.c (#4066) 2024-01-04 10:39:28 +08:00
Anton Kochkov
2b0de30f7f Remove static and global varibles in cmd_analysis.c 2024-01-04 01:14:57 +08:00
Anton Kochkov
c4ce1d511a Remove static and global varibles in disasm.c 2024-01-04 01:14:57 +08:00
Anton Kochkov
e34e6abb07
Remove outdated AArch64 RzAsm plugin from binutils (#4064) 2024-01-04 01:05:14 +08:00
Dhruv Maroo
97d336738c
Add a new helper to convert a long double to an 80-bit RzIL float (#4062)
* Add a new helper to convert a `long double` to an 80-bit RzIL float

    * New function: `rz_il_op_new_float_from_f80`
    * New opbuilder: `F80`

* Add test for `rz_il_op_new_float_from_f80`

    * Also add a float format check in `rz_il_sort_pure_eq`
    * Add a few `includes` so that some types are visible
2024-01-03 18:52:58 +05:30
Peiwei Hu
8fba56bdb7
Use internal API instead of command (#4053) 2024-01-03 19:16:06 +08:00
Khairul Azhar Kasmiran
63d3369538
Use -fno-strict-aliasing with Capstone next build (#4060) 2024-01-01 22:49:01 +08:00
Anton Kochkov
26aacfe66b
core/analysis: remove globals (#4057) 2024-01-01 17:11:40 +08:00
Anton Kochkov
0440ab4372
bin/elf: autodetect RL78 architecture (#4056) 2023-12-30 19:42:05 +08:00
Khairul Azhar Kasmiran
d9ca656907
Downgrade Capstone next build to -O1 on gcc release build (#4054) 2023-12-30 16:03:27 +08:00
Giovanni
ccbfe57b68
Allow to cancel and to print progress of the current diffing job (#4051) 2023-12-29 14:25:38 +08:00
Giovanni
b28f19443b
Avoid spamming warnings when loading PE files (#4050) 2023-12-29 08:45:12 +08:00
Peiwei Hu
987aee0883
Fix the memory leak in rz_core_print_disasm_instructions_with_buf (#4049) 2023-12-27 18:52:50 +08:00
byteninjaa0
8c275bfa8b
Make it clear the "details" of command are available (#3890) 2023-12-26 07:41:23 +08:00
Peiwei Hu
3b7f2730f2
Remove the deprecated API rz_core_handle_backwards_disasm (#4041)
* Remove the deprecated API rz_core_handle_backwards_disasm
* Also, mitigate the dependency on core->block
2023-12-26 06:45:07 +08:00
Peiwei Hu
286d9bd874
Transition of virtual_files in RzBinPlugin (from list to pvector) (#4042) 2023-12-22 01:06:18 +08:00
Rot127
7304284eb8
Set correct family type for system hints. (#4040)
Pointer authentication instructions like 'pacibsp' are encoded as alias for 'hint'.
Due to this they got assigned the 'nop' type and got neglected as valid function preamble.
2023-12-21 07:57:33 +08:00
Peiwei Hu
4f7e0e177f
Remove the dependency of core->block in pi/pI (#4023) 2023-12-20 19:46:44 +08:00
zengwei2000
ba4be10836
fix the Memory leak: ret (#4038)
When the opsize is greater than 2 and memory allocation is successful, it will cause a memory leak

Signed-off-by: zengwei zengwei1@uniontech.com
2023-12-20 11:33:35 +08:00
Rot127
9b227eb3c1
Make AArch64/ARM analysis and asm plugins Capstone v6 compatible. (#4011)
This commit refactors the AArch64 and partially the ARM
plugin to make it Capstone v6 compatible.
Due to the big API changes in Capstone v6 several changes
had to be made.

Because we need to be compatible to Capstone v4 and v5
many include guards are added as well.

Overview of changes done:

**ARM**

- Instruction alias were introduced. This leads to different
decoding and analysis paths taken for certain instructions.
Some alias have their IL code generated like the real
instruction now (no special handling needed anymore).
This change is responsible for many changes you'll encounter.

- The operand details of each instruction are now always the
one of the real instruction. Also for alias.
For example, if "MOV <Wd>, #<imm>" is an alias for `ORR <Wd>, WZR, #<imm>`,
the details by CS hold all three operands of "ORR".
Before, they held only the two of "MOV".

- Several bugs in variable and argument generation
were fixed. Especially the default variable width
for ARM Thumb was changed to 32bit instead of the 16bit.

**AArch64/ARM64**

The changes listed above for ARM, also apply to AArch64.

Additionally:

- Capstone v6 changed the name ARM64 now everywhere to AArch64.
To be compatible with Capstone v4/v5 AArch64 names must be wrapped
into macros which resolve the name, depending on the CS version used.

- Capstone v6 is now more consistent with
register real and alias names.
From now on we use the register alias by default.

**List squashed commit messages:**

[AArch64 CS v6 BEGIN] Change subproject config to use cs-auto-sync-aarch64 branch

Replace ARM64 with version sensitive macros.

Exclude alias if CS version >= 6

Update access to writeback member

Exclude instr alias from inclusion

Update memory operand printing to json.

Enable real instr. detail only for AArch64

Set correct arch name in meson.build for CS

Fix U/SBFM instructions and their alias.

Mark parameters with RZ_OUt/BORROW

Optimize register extension to skip some, if the width already matches.

Adapt width and lsb of U/SBFM alias instructions (ImmR and ImmS are from U/SBFM).

Fix tests correct semantic buy bad syntax

Pass alias MOV instructions to mov()

Handle CSET and CSETM alias

Fix lsl, lsr and asr by handling them as alias.

Fix mov alias.

Handle TST alias

Fix CNEG, CINV alias

Fix bfi and bfxil alias.

Fix sign extensions.

Fix compare instructions.

Fix NEG, NGC, NGCS, NEGS, MVN

Fix CINC

Fix multiply instructions.

Fix ROR

Run clang-format

Handle CMP for ESIL

Handle new position of memory disponents of post index operands.

Fix post-index operations.

Add missing writeback checks for Post and preindex

Handle UBFM and SBFM alias

Handl BFM alias

Handle CMP, CSET and CINC alias

Update meson file of for cs-aarch64 branch

Fix asm tests. Use reg alias now.

Fix condition confusion and incorrect operand usage.

Fix plf test.

Run clang-format

Use register alias in tests

Add support for fp and lr reg alias assembly.

Use reg alias in test

Rename cond tranlate functions r2 -> rz

Fix condition check which assume 0 == invalid.

Fix issues intruduced by rebase

Set CS commit to current next branch.

Rename ARM64 -> AArch64

Add missing source file to meson.build

Remove DisassemblerExtension.c file for CS v5

Update to newest capstone next branch

Bump up CS version

REVERT ME: Get Capstone v4/v5 via git clone until new tars are released.

Wrap setting of CS_DETAIL_REAL into CS version check

Add maybe-unitialized to Capstone C args.

Fix CS pre v6 build by adding guards.

Use reg alias now printed by default by CS.

Bump CS version to most recent next.

Fix build errors due to stircter alias handling in ARM.

Fix RzIL tests introduced by alias introduction to ARM.

Fix ESIL bugs introduced with ARM alias introduction.

- stackptr hasn't been set for POP and PUSH

Add support again for Thumb1 pop/push

Handle PUSHW and POPW alias

Update test case

Add more POP and PUSH alias and enrich detail for other versions of them.

Fix incorrect mem access width guesses for ARM thumb.

Set POP return info if it writes to PC

Fix tests about default var size and POP mem write direction.

Bump CS version to newest next.

Fix incorrect tests.

- TriCore: Functions were in ro section.
- Default arg width in ARM thumb is 32bit.

Revert check for a set stackptr.

stackptr is used in different ways:
1. Safes the offset from the stack frame base.
2. Is interpreted as somthing else for x86 and I cannot find out what, in a reasonably time.

Hence we cannot use it here consistently.

Remove check for non existing ARM_GRP_RET in CSv5

Fix incorrect stack offsets of variables.

'push <reg-list>' instructions for which the second register was the FP,
reset the stackptr variable to 0. This led to wrong bp offsets in the variable names.
In this case it was +0xc.

Bump CS version.

Add copy of meta-programming macros for capstone-sys build.

Update capstone-next.wrap

Use bracket-less met-programming macro to fix Windows build warnings.

Update wrap files for Capstone with branch names

Add new meta-programming macro

Add workaround for MSVC pre-processor bug.
2023-12-20 01:00:31 +08:00
Giovanni
8fba9b4189
Force usage of RzList methods instead of direct access of the fields (#4036) 2023-12-18 21:05:57 +08:00
billow
770084ca98
tricore: fix rfm, ldlcx, lducx stack op set (#4035)
* Fix TriCore's `rfm` stack op set
* Fix TriCore's `ldlcx` `lducx` set
2023-12-18 01:11:44 +08:00
Rot127
c0abdb87e8
Enable generation of inter-procedual control flow graph. (#4001) 2023-12-14 22:34:43 +08:00
Rot127
c7cd1a9110
Update graph title after node was updated. (#4030) 2023-12-13 10:41:06 +08:00
Anton Kochkov
41c925de9e
Add new API to calculate size of variable (#4028) 2023-12-11 23:21:09 +08:00
billow
d5d29fcb37
Load symbols in modules from PDB (#4025)
* PDB: add module info parsing
* Refactor PDB component
* Refactor PDB/tpi
* Fix read_pascal_string
* Fix memory leaks
* Add test `Modules from PDB`
2023-12-10 14:14:14 +08:00
billow
81b6a3850f
Fix rz_pvector_foreach (#4026) 2023-12-09 00:37:14 +08:00
billow
bfe19a784b
Create global variables from PDB (#4021) 2023-12-06 13:57:41 +08:00
Khairul Azhar Kasmiran
036a712f35
Remove work dir change of rz-bindgen plugin test (#4022) 2023-12-05 22:03:28 +08:00
Rot127
1ec21a8d32
Add several common bit operations to RzIL. (#3977) 2023-12-03 17:23:41 +01:00
Florian Märkl
6b9d56282c
Fix use-after-free of _args[0] in RzRunProfile (#4019)
Happens e.g. on `rz-run input= -- echo hello`, when echo is resolved
through PATH and _program is freed, but the pointer stays in _args[0].
2023-12-03 23:27:35 +08:00
Huzaifa Naseer
4edd1680c1
Modify pr command to not stop printing at null byte (#3987) 2023-12-03 19:49:17 +08:00