Commit graph

29089 commits

Author SHA1 Message Date
pelijah
8fec79ab61
Fix leaked HtPP keys (#4398) 2024-03-29 11:32:38 +08:00
Anton Kochkov
667da7ece8 subprojects/spp: remove dead code 2024-03-28 07:41:59 +08:00
Anton Kochkov
bfe5e3b806 subprojects/spp: update README and code 2024-03-28 07:41:59 +08:00
Anton Kochkov
e2d42d2004 subprojects/spp: remove acr and pod preprocessors 2024-03-28 07:41:59 +08:00
Anton Kochkov
89f37e3881 subprojects/spp: use meson configuration 2024-03-28 07:41:59 +08:00
Anton Kochkov
01f125fdc9 subprojects/spp: remove unused files 2024-03-28 07:41:59 +08:00
Khairul Azhar Kasmiran
cfac4b2ae1
strings_print json: For efficiency, escape strings only once (#4396) 2024-03-28 01:05:15 +08:00
Khairul Azhar Kasmiran
508bbae8a5
izj/izzj: Fix escaping of special chars (#4392) 2024-03-26 22:52:06 +08:00
pelijah
576d4b8a5e
Fix several memleaks in DWARF related code (#4391) 2024-03-26 22:11:08 +08:00
Giovanni
d6d54be717
go: remove invalidate any string with a colon (#4389) 2024-03-25 22:09:45 +08:00
Rot127
efd5f2532d
Add note to not use rz_time_now() for timestamps. (#4388) 2024-03-25 19:20:25 +08:00
Rot127
b4fe418375
Fix broken CI (#4376)
* Increase timeout for OpenBSD

* Reset all members of a packet.

* Replace calloc with Rizin macros

* Add returns after fatal logs

* Init time structs with 0.

* Use monotonic clock to set last access timestamps.

Because instruction packets get pushed out of the buffer based in their last access,
using the real-time clock leads to problems. On Windows the real time clock seems to
not always give ascending values with multiple calls
(real-time clock = best bet of machine of current day time, which can fluctuate).

Using the monotonic clock will always give strictly ascending timestamps.

Due to the use of the real-clock, the instruction packets got
sometimes pushed out of the buffer non-deterministically.
2024-03-25 19:15:56 +08:00
Rot127
1228d4dc58
Add all supported architectures to the labeler (#4381)
* Add labeling for all missing architectures
2024-03-25 19:07:42 +08:00
wargio
7906b0cd90 cleanup formatting on rz_vector.h 2024-03-25 18:36:02 +08:00
wargio
dd231554be remove useless if from rtti-itanium code
sss
2024-03-25 18:36:02 +08:00
wargio
c53b053b61 Remove useless semicolon 2024-03-25 18:36:02 +08:00
z3phyr
39278ab891
debug: Android doesn't have gs_base (#4384)
Co-authored-by: Giridhar Prasath R <giridh1337@gmail.com>
2024-03-25 07:45:50 +08:00
Anton Kochkov
957a2997b3
debug: i386 register profile lacks gs_base (#4382) 2024-03-24 12:18:13 +08:00
Anton Kochkov
fb5bc404b6
debug: i386 register profile lacks gs_base (#4380) 2024-03-23 12:58:25 +08:00
Khairul Azhar Kasmiran
c52750ccfe
$: Use rz_flag_get to check if flag exists (#4377) 2024-03-22 22:12:20 +08:00
z3phyr
ab593b3c7e
Make TLS detection only X86-specific (#4378) 2024-03-22 21:37:39 +08:00
Rot127
fb6efca4b5
[Hexagon] RzIL uplifiting (#3837)
Uplift Hexagon architecture to RzIL

The general structure is, that every (sub-)instruction has a getter for it's RzIL code.
Calling the getter will return the RzIL operation.
If RzIL for an instruction is requested, the plugin makes a decision. Because Hexagon only executes whole instruction packets. If the instruction is not the last instruction in a packet, it will simply return `EMPTY()`. If the RzIL for the last instruction in a packet is requested, it will get the RzIL operations for all instructions in the packet, shuffles them into the correct execution order (according to some rules) and returns the complete operation for the packet.

The RzIL code was entirely generated with the [rzil-compiler](https://github.com/Rot127/rzil-compiler/), using the semantic definition of the [QEMU Hexagon module](https://github.com/qemu/qemu/tree/master/target/hexagon).

Currently successful compile instructions (and tested):
```
[*] 1581/1733 standard instructions compiled.
[*] 431/643 HVX instructions compiled.
[*] In total: 2012/2376 instructions compiled.
```

It was tested with:
- (Semantic tests) `rz-tracetest` against the execution trace of the QEMU Hexagon test binaries.
- (Bug free and semi-semtantic test) Adding tests which simply execute the test binaries to ensure leak and segfault free execution. Also it is executed until a certain instruction is reached (end of `main` or `loc.pass` symbol), partially testing it executes correctly.

For the uplifting several changes and modernization had to be made:

- Enhance consistency of decoding
  - Allow to disassemble an instruction without copying the result. This is used if the given buffer of instruction bytes is larger than one instruction width. In this case, as many instructions as the buffer can hold are disassembled and buffered for later.
  - Generally enhance buffering of instructions.
  - Allow to mark a packet as valid before it is completely decoded (in case we know it must be valid, e.g. if it is a jump target of a valid packet).
- Fix (hopefully) all memory leaks of the Hexagon plugin.
- Changes to register getters, because RzIL needs finer control to translate alias or explicit register names to their real register.
  - Getter for register name is now done by table, so for future distinction between DSP version we can just select another table.
  - Translation functions from register alias or explicit name to their real register.
  - Each operand contains now it's variable ID (e.g. `d` for register `Rd`) as in the ISA (for mapping in the RzIL code).
- Ease debugging by tracking in more precision, if an instruction is added to a stale, active or new packet.
- Add registers `C20` - `C29` (not yet present in LLVM)
- Some renaming to make the code more readable.
2024-03-22 07:24:56 +00:00
z3phyr
de4a3c7419
Enhance dmht tcache command (#4355)
- Add tcache heap heuristics
- Fetch glibc version from libc
- Add unit testcases for glibc version

Co-authored-by: Giridhar Prasath R <giridh1337@gmail.com>
2024-03-22 11:00:58 +08:00
Rot127
e3c06ac3bb
Add free function for parse parameters. (#4374) 2024-03-22 08:59:15 +08:00
Khairul Azhar Kasmiran
5abf663cc9
$: Convert rz_alias_handler to rzshell handler form (#4370) 2024-03-18 22:27:09 +08:00
Giovanni
94099b860e
Add RzIL info to rz-asm -L and La (#4369) 2024-03-18 21:16:13 +08:00
Khairul Azhar Kasmiran
547732cd58
$: Refactor out code for $* and $** (#4368) 2024-03-17 21:23:13 +08:00
08A
e1a69d325f
Update copyright information of 08A (#4367) 2024-03-17 10:21:08 +08:00
pelijah
d43bb152df
buf_format(): parse format string only once (#4365) 2024-03-17 10:18:56 +08:00
Florian Märkl
14238ac591
Fix potentially invalid memcpy in xtensa (#4360)
Regression from bde374dad6:
When memcpy is a macro (e.g. on macOS <= 10.12), the commas are
interpreted as macro argument delimiters. Since length_table is never
mutated, we can revert the change and use it as a constant buffer.

Partially addresses #4352
2024-03-16 12:38:45 +01:00
pelijah
2195bbc472
Fix memleak in rz_bin_file_compute_hashes() (#4364) 2024-03-16 18:40:40 +08:00
Rockrid3r
6b20aeff86 added RZ_BORROW 2024-03-16 08:56:50 +00:00
Rockrid3r
b5a703fbc3 fix memory leaks in path_walker 2024-03-16 08:56:50 +00:00
Rockrid3r
72a15b6397 added docs to path_walker_*, RZ_NONNULL, RZ_OUT, rz_return_val_if_fail, etc. 2024-03-16 08:56:50 +00:00
Rockrid3r
f15f17b806 clang-format 2024-03-16 08:56:50 +00:00
Rockrid3r
6f1de19e04 Updated documentation for rz_type_parse_string_single. Removed remaining comments 2024-03-16 08:56:50 +00:00
Rockrid3r
12ddaa8a27 removed empty lines & comments 2024-03-16 08:56:50 +00:00
Rockrid3r
83d661a0b7 removed unnecessary debug output 2024-03-16 08:56:50 +00:00
Rockrid3r
0920d2641d using rz_str_ndup and rz_num_math 2024-03-16 08:56:50 +00:00
Rockrid3r
f64b2f3d26 removed unnecessary offset setup 2024-03-16 08:56:50 +00:00
Rockrid3r
8bfd35045d addressed some errors 2024-03-16 08:56:50 +00:00
Rockrid3r
ae0afa109c fix path_walker & add unit tests for offset_by_path 2024-03-16 08:56:50 +00:00
Rot127
c78eff25a3
Work around for https://github.com/google/sanitizers/issues/1716 (#4362)
The Thread Sanitizer of ASAN doesn't seem to support
randomized offsets from the VMA base address (`vm.mmap_rnd_bits`)
if they are larger than 28 bits.

This leads to ASAN compiled binaries to crash or endless loop
with a `AddressSanitizer:DEADLYSIGNAL` before main is reached.

Reference issues:
https://github.com/google/sanitizers/issues/1716
https://github.com/google/sanitizers/issues/1724
2024-03-16 13:45:51 +08:00
مصطفي محمود كمال الدين
672d0f78cf
Remove global variables, replacing it with a state structure (#4343) 2024-03-12 12:01:06 +08:00
Giovanni
dba5cc59a9
Add dcco: Continue until call (use step out) (#4354)
Co-authored-by: gogo <gogo246475@gmail.com>
2024-03-12 08:19:56 +08:00
Giovanni
ea66c5f370
Remove rz_analysis_get_fcns since dups rz_analysis_function_list (#4353) 2024-03-11 10:03:57 +08:00
Giovanni
461a2fed87
Remove rz_pvector_index_ptr (#4351)
Unlike rz_vector_index_ptr, which is very important, there do not seem
to be any valid usages of rz_pvector_index_ptr in rizin, cutter or
rz-ghidra that could not be replaced by rz_pvector_at.
In case there will be a use-case for it in the future, it can also be
done by rz_pvector_data(...) + i.
2024-03-10 18:40:26 +01:00
Giovanni
c17881ba2f
Initialize RzAnalysisOp properly. (#4350) 2024-03-10 18:26:10 +08:00
Giovanni
ef0ed21d9f
Convert basic block into RzPVector (#4349)
Co-authored-by: HN026 <plancksconstant01@gmail.com>
2024-03-10 15:59:15 +08:00
Giovanni
c7ddd77546
Remove rz_list_get_top/bottom & rz_list_get_head/tail_data (#4348) 2024-03-09 18:24:23 +08:00