Commit graph

28266 commits

Author SHA1 Message Date
Anton Kochkov
fd64b7ee25 Convert pr commands to the rzshell 2023-02-02 08:21:09 +08:00
Anton Kochkov
0ffa5e3233 Update tree-sitter to 0.20.7 2023-01-31 19:06:55 +08:00
Giovanni
53776b129b
Small refactoring of rtr_http.c code (#3329)
* Remove unused http.maxport
* Rename http.dietime to http.stop.after
* Extract rtr_http code to simplify it
* Enforce utf8 charset in headers for browsers.
2023-01-31 10:02:54 +08:00
Anton Kochkov
5082c1f0e8 Convert p= commands to rzshell 2023-01-31 08:27:30 +08:00
Anton Kochkov
969ce2e570 Add an example of vertical histogram in comment 2023-01-31 08:27:30 +08:00
Gyanendra Banjare
8bdbd28741
Fix #3280 - Restores color on returning from Rh. (#3306) 2023-01-30 21:38:36 +08:00
Giovanni
c3f9d4c1d3
Fix #2859 - Use minstring in all bin plugins (#3328)
* Do not hardcode min string size for bins using `rz_bin_file_strings()`
* Fix rz-bin to set properly `bin.[min|max]str`
* Add and fix tests
2023-01-30 18:38:08 +08:00
Giovanni
21333133d9
Fix bx after add lr, pc, 0 in arm32 (#3326)
Co-authored-by: pancake <pancake@nopcode.org>
2023-01-28 15:10:14 +08:00
Florian Märkl
b740cba35d Fix alignment issues in sha2
Reading ut32 from the data array directly crashes on sparc when the
array is not 4-byte aligned. This fixes both the regular and the
unrolled variant of the code, even though we do not use the unrolled
one.
Relevant tests are in test/db/cmd/hash.
2023-01-26 20:39:24 +01:00
Florian Märkl
62c0a6b880 Raise timeout for 6502 rzil test
On some platforms, the rizin startup itself takes multiple seconds,
which can make these tests timeout even if they would otherwise work.
2023-01-26 20:39:24 +01:00
Riccardo Schirone
d6c586bc3b
core: replace 'it' with 'iT' (#3320)
`it` is the table mode of the `i` command, thus leave it available and
use `iT` instead.
2023-01-26 16:01:06 +08:00
Florian Märkl
77a334a2af
Refactor srec reading to not use sscanf (#3321)
Parsing with sscanf turned out to cause an extreme slowdown. As only hex
values are being read, this can be done with RzUtil-provided
functionality. Relevant test cases exist in test/db/io/srec.
2023-01-25 16:42:46 +01:00
rizan21
f5668b2359 Changes in .clang-format
* requires clasue will now format in a single line
2023-01-25 22:02:26 +08:00
rizan21
cc18d675e6 Use clang-format 15 instead of 14 2023-01-25 22:02:26 +08:00
Riccardo Schirone
a0b7b48b53
core: implement simple 'help' command (#3319)
'help' command provide very basic guidelines on how to use Rizin.
2023-01-24 11:24:47 +08:00
Riccardo Schirone
e933003b5b
librz: do not duplicate plugins (#3313)
* librz: do not duplicate plugins

Plugins structures are statically defined at the file scope and not
dynamically allocated. Plugins should not allocate them either as
RzLibPlugin keeps a reference to them anyway.
2023-01-23 12:51:09 +00:00
Anton Kochkov
c362b28254
Fix integer shift UB in ARM ESIL uplifting (#3317)
Fixes the following UBSAN error:
arm_esil64.c:947:26: runtime error: left shift of 65535 by 48 places
cannot be represented in type 'long long int'
2023-01-23 18:25:26 +08:00
Anton Kochkov
38a909738c
Convert pC commands to rzshell (#3213) 2023-01-23 17:54:52 +08:00
Anton Kochkov
a3885e8f99
Remove legacy unit tests (#3088) 2023-01-23 17:46:21 +08:00
Florian Märkl
ead601655c
Make bp usage check not depend on opex string (#3315)
In all instructions in all existing tests, the result of can_affect_bp()
is equal to what the opex check would determine, so we can avoid the
overhead of opex here.
2023-01-22 19:05:20 +01:00
Rizan
bbc5457b7a
Use compiler intrinsics for rz_swap_* functions (#3300)
* Using `__builtin_swap*()` whenever available instead of `rz_swap*()`
* Moved `test_endian()` from test_utils.c to test_endian.h
* Added test cases
2023-01-22 21:30:21 +08:00
Florian Märkl
9703de3099
Set up srht builds to trigger through hottub (#3312)
hottub_trigger is a key added in our hottub fork.
2023-01-21 19:25:33 +01:00
Florian Märkl
b1277a7dc8 Reduce requested op info in go analysis
BASIC supplies all needed info in these cases and is slightly less
expensive than DISASM.
2023-01-21 18:26:11 +01:00
Florian Märkl
b6c9b6ad01 Skip filling IL in x86 if not requested
If not requested, building the IL is an unnecessary overhead.
2023-01-21 18:26:11 +01:00
Florian Märkl
3f4570cd7a
Fix string flag sizes after aar (Fix #3305) (#3307)
Regression from 7af1353166, but most
likely already broken before and only made visible by it: String flags
set from bin had their size set to how many bytes the string takes, but
were overwritten to a size of 1 after running aar.
2023-01-21 15:28:05 +01:00
Giovanni
7af1353166
Use proper methods to detect strings in analysis loop. (#3284) 2023-01-20 12:02:10 +08:00
Giovanni
a13a724550
Fix #3128 - Add overflow checks on dyldcache bin values. (#3303) 2023-01-20 12:01:34 +08:00
Giovanni
907e0981c5
Fix English in docs files and updated/removed some tips (#3299) 2023-01-17 19:49:38 +01:00
Florian Märkl
8f1fdc91d6
Limit op cache in type matching (#3297)
Reduces the peak memory usage of the corkami virtgap.exe test from
1.177GB to 241.9MB (measured with massif).
2023-01-17 15:54:37 +08:00
Riccardo Schirone
30f4d77088
ci: add CI for rz-bindgen (#3285) 2023-01-17 07:02:15 +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
Florian Märkl
7c6579a614 Fix asm.bits-dependent open tests
Passing arch and bits as args instead of commands ensures they take
effect earlier. This fixes these tests on platforms where the default
asm.bits is 32.
2023-01-15 19:01:18 +01:00
Florian Märkl
0acc7f11a1 Set dbg->bits in debug_dmp
This fixes the last tests in db/formats/dmp on OpenBSD/sparc64.
2023-01-15 19:01:18 +01:00
Florian Märkl
e40d9a6cf3 Fix dmp reg profile depending on host bitness
dbg->bits was checked in reg/windows_arm64.h, but when returning the reg
profile from the dmp plugin, this (deprecated) variable held the host
value when 64 was expected.
So it is better to move this check to the respective points where the
profile file is included.
2023-01-15 19:01:18 +01:00
Florian Märkl
953a81afc0
Make afs respect the cc (Fix #3291) (#3292)
Applying a function signature with afs to a function was using a
combination of the existing args and wrong stack addresses to apply the
args to function variables. This generally resulted in incorrect
locations. Instead, we now use the info from the cc.
2023-01-15 13:40:14 +01:00
Peter B
ca3c77e981
Set refptr for Xtensa l32r opcode for better disassembly output (#3289) 2023-01-15 09:32:37 +08:00
Giovanni
4a9740d11d
Fix pxj output (#3290) 2023-01-14 14:14:34 +08:00
Riccardo Schirone
48ece26787 librz: remove non existing functions 2023-01-12 08:55:58 +01:00
Giovanni
3edb12c2d2
Temporary fix for the meta strings (#3283)
* Temporary fix for the meta strings
* Fix unit test
* Added test for Csl with raw binary
2023-01-11 12:31:49 +08:00
Florian Märkl
70c1a3e109
Fix some tests for platforms without native debugger (#3278) 2023-01-09 17:57:39 +01:00
Florian Märkl
01a82490d7 Raise timeout for some aez tests
On some platforms, the rizin startup itself takes multiple seconds,
which can make these tests timeout even if they would otherwise work.
2023-01-09 10:26:30 +08:00
Florian Märkl
1b4385e224
Make xnu reg profile depend on cpu type instead of RzDebug.bits (#3270)
RzDebug.bits often has nonsensical contents set from all kinds of
places. Specifically, when debugging fat binaries on arm64, it had a
value not matching the debuggee when the reg profile was loaded,
resulting in the arm32 profile being used.
The right way to determine the profile is to do it after attach, when
the cpu type of the debuggee is known.
2023-01-07 17:43:41 +01:00
Florian Märkl
de5aa96af9 Patch Mach-O chained ptrs into sparse overlay RzBuffer
Patching the chained ptrs on the fly during every read as before turned
out to be a major bottleneck on larger binaries. So now we patch
everything once into a sparse overlay buffer, like it is already done in
ELF and classic Mach-O relocs.
2023-01-07 11:04:22 +08:00
Florian Märkl
29adadc2b8 Speed up ppc64 IL tests by not loading hashes 2023-01-07 10:18:57 +08:00
Florian Märkl
d4932d3d2c Avoid syncing regs in between multiple IL steps
When stepping multiple times in the analysis RzIL vm, it is not
necessary to sync the regs from and to RzReg between every instruction,
but only at the beginning and at the end.
The conditions for stepping until an addr and fixed-count stepping are
handled as callbacks inside rz_analysis_il_vm_step_while(), so the sync
logic does not have to be exposed to the caller.
2023-01-07 10:18:57 +08:00
Florian Märkl
d6bd4a57b0
Remove temporary type string conversion in DWARF integration (#3266)
Due to the DWARF parsing having been implemented before proper RzTypes,
it was still generating C-like strings that we then parsed into RzType.
This is fragile and was identified to be a major performance bottleneck
on OpenBSD/sparc64. Instead, we now generate RzTypes directly where
possible.
There are still cases left where strings have to be generated
from those types to be stored in an SDB. This should be changed in the
future too.

rz_type_pointer_of_type() is now also always creating a pointer type of
the given type. Before, it would have failed when the pointee was an
identifier that did not exist in the database. But this may be a valid
case e.g. while still building the database from DWARF and such
sanitization goes beyond what one would expect from
rz_type_pointer_of_type().
2023-01-05 19:14:59 +01:00
Riccardo Schirone
572c26ea6a core/cmd: fix 'sleep' command to consider whole arg 2023-01-05 17:55:18 +01:00
Giovanni
d1ad5b5051
Added missing help for Vb modes in V? (#3265) 2023-01-04 20:56:13 +08:00
Florian Märkl
fa15d2fbab Fix type bitsizes for struct/union member loops
Even if the case is nonsensical in practice, we can't rule out the
possibility that a struct or union may contain itself as a member
(optionally through multiple recursion steps). This must be caught when
calculating the size of the type in order to not recurse infinitely.
Structs containing pointers to itself are not meant by this, as that is
perfectly valid and the size is determined without recursion.
However typedefs and arrays must be taken into account.
2023-01-04 09:39:10 +08:00
Florian Märkl
5a229ca6a7 Fix rz_type_db_get_bitsize() without specifier and add tests 2023-01-04 09:39:10 +08:00