Commit graph

48 commits

Author SHA1 Message Date
Maijin
d28ddde0e7
doc(syscall): improve README and add example (#5135) (#5619)
Co-authored-by: Maijin <maijin21@gmail.com>
2025-12-15 14:02:55 +08:00
Ayush Goyal
a9fc5d3ca6
Fix: asn and asr command #3885 (#5477) 2025-11-04 23:38:16 +08:00
Ahmed Kamal
93d914bd81
Remove Global/Static variables in path.c to make it thread safe (#5148) 2025-06-13 21:34:33 +08:00
Giovanni
db1e4993a0
Replace strdup with rz_str_dup (#4634) 2024-09-15 19:12:07 +08:00
pelijah
706a6bf6c2
sdb: remove unused cas and expire features (#4487) 2024-05-12 18:27:54 +08:00
pelijah
f818ca4296
Refactor sdb_foreach and related APIs (#4471)
* Refactor sdb_foreach and related APIs
* Strengthen bounds check in sdb_dump_next()
* Switch to RzPVector
* Use length info in filter_noreturn()
* Fix cmp function
* Remove unused sdb_like() API
* Pass SdbKv to SdbForeachCallback
* Add sdbkv_dup_value() helper
2024-05-07 07:57:52 +08:00
pelijah
f2d8e0db3d
Add HtSP, HtSS, HtSU, SetS (#4415)
- All `ht_*_new0()` are removed
- `freefn` field of HT options was renamed to `finiKV`
- `finiKV_user` fields was added to HT options
- Added `ht_*_new_opt_size` API
- `HtSP` and `HtUP` are created with `ValueFree` callback  that allows to reduce extra LOC and prevent bugs
- `SetP` replaced with `SetS` (based on `HtSP`)
- `rz_th_ht_*_new0()` and `rz_th_ht_*_new_opt()` are replaced with `rz_th_ht_*_new(HtXX *)`
2024-04-16 20:27:48 +08:00
Anton Kochkov
e7d3c258fb
Remove some more of sdb_fmt() calls (#4140) 2024-01-30 22:36:39 +08:00
Tomáš Golembiovský
c18266311f
librz: fix move_mount syscall number (#3997)
The move_mount syscall number on x86_64 that was introduced in patch
a564f13856 (PR #3854) was wrong.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2023-11-23 18:56:29 +08:00
Tomáš Golembiovský
a564f13856
librz: syscalls in Linux 6.5.3 (#3854)
Update Linux syscalls list to those of Linux 6.5.3 for x86 and aarch64.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2023-10-13 13:47:28 +08:00
Riccardo Schirone
3b903caa96
librz: add some initial documentation (#3782) 2023-10-13 13:46:19 +08:00
Marcin Sobczyk
7a3da1691c Remove duplicate entries from 'linux-arm-64.sdb.txt'
This is a cherry pick of [1]. The removed mappings overwrite previous
entries and cannot be found in [2].

[1] c67c47ed73
[2] https://github.com/torvalds/linux/blob/master/include/uapi/asm-generic/unistd.h

Signed-off-by: Marcin Sobczyk <msobczyk@redhat.com>
2023-08-25 12:04:32 +08:00
Florian Märkl
bc9daaabbd Re-add ios syscall files
Initially removed in 4fd9cd7cc1, but may
still be used when loading xnu kernelcaches.
2023-06-30 18:04:31 +02:00
Florian Märkl
4fd9cd7cc1
Extend Mach-O platform recognition (#3599)
Some identical code from both mach-o 32 and 64 has been moved to
mach0_common.c to avoid duplicate compilation.
rz_mach0_platform_to_string() now recognizes all known platforms and the
information is shown as the subsys in the i command.
The "os" value was previously unreliably and ios sometimes showed as
"ios" and sometimes as "darwin" depending on the binary. Now the os is
"darwin" for all platforms. ios-* syscall files have thus been removed
as only darwin-* ones will be used.
2023-06-23 13:28:41 +00: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
Florian Märkl
4e5857cacf
Meson refactor: collect modules in dict and centralize config (#2945)
Duplicated code for pkg-config and cmake configuration is avoided by
letting every rizin module register itself in a global dictionary
called "modules" which is then iterated in one place to perform any
shared logic, inspired by how qemu handles multiple targets in its meson
build system.

This is an almost pure refactor, so the resulting .pc/.cmake files
should be identical with the following exceptions:
- rz_reg.pc does not have plugindir anymore as rz_reg has no plugins.
- Some other modules have their dependencies in .pc files altered to be
  consistent with cmake.
2022-08-20 19:59:27 +02:00
Riccardo Schirone
8939fdbd7d
Use add_global_arguments instead of passing cflags/ldflags all around (#2812)
See also 66a0e22293/docs/TESTING_WITH_SANITIZERS.md (clang)
2022-07-17 21:33:51 +08:00
GustavoLCR
125b89ab2f Syscall: Fix loading sysreg in rz_syscall_setup
* Remove unnecessary call to `rz_sysreg_set_arch` from the `asm.arch`
  callback
2022-06-19 17:29:42 +08:00
Riccardo Schirone
ce6ac3e467 meson: use major/minor only in the lib soversion 2022-05-10 21:04:43 +02:00
Giovanni
bfec86a12e
Add option to install sigdb systemwise and custom user location for additional signatures (#2328) 2022-02-28 14:32:38 +01:00
Paul I
5b11e88736
Fix several memleaks (#2143) 2021-12-27 18:19:34 +01:00
Riccardo Schirone
6f40dfe493
Move remaining things from shlr/ to meson subprojects (#2126)
* Move binrz meson directives to binrz/ dir

* Move rizin-shell-parser to a subproject

* Move bochs to a meson subproject

* Move rzqnx to meson subproject

* Move winkd to a meson subproject

* Move rzar to a meson subproject

* Move rzw32dbg_wrap to a meson subproject

* Move ptrace-wrap to a meson subproject

* Move rzgdb to a meson subproject

* Rename w32dbg_wrap to rzw32dbg_wrap

* Update CODEOWNERS

* Remove old references to shlr

* Move shlr/heap stuff in core and remove shlr/arm

* Move spp to a meson subproject

* Remove last references to shlr

* Remove use_webui option

* Move include files directives to librz/include/meson.build

* Move librz meson directives into librz/meson.build

* Handle d/ directories inside the specific module meson.build

* Move plugins listing to specific module meson.build

* Move rzheap to its own subproject

* Fix js linter and licenses

* Use meson.override_dependency for all rz_ modules
2021-12-22 09:20:39 +08:00
Riccardo Schirone
47e1cb8335
Provide CMake config files for CMake projects (#2057)
* Remove wrong librz.pc.in file
* Add plugindir variable to .pc files to allow easy plugin configuration
* Add CMake config files to find Rizin in CMake projects
* Add CI jobs to check cmake files
* Provide workaround for mesonbuild/meson#9702
* Use .lib suffix and no prefix on MSVC to make CMake files work
* Disable cmake files on static libraries build
2021-12-17 09:16:25 +00:00
Riccardo Schirone
64469f2811
Changes in how paths are handled (#1997)
* Remove `RIZIN_EXTRAS` because useless

Extras plugin should be treated as any other regular plugin, they should
not have their own directory. I believe we did not have anyway any
plugin using that directory.

* Do not use `<version>` in `/usr/share`

Users can only install one version of Rizin at a time anyway, thus
splitting the `/usr/share/rizin` directories does not really bring
multi-version install possible. At the same time, we stick to what's
common for other tools, which do not use version in `/usr/share`

* Move plugin directory to `/usr/lib64/rizin/plugins`
* Remove `RZ_HOME_BIN` env var because not useful anymore
* Introduce `rz_util/rz_path` to provide rizin paths
* Use `rz_path_system_sdb_types` whenever it makes sense
* Use some others `rz_path_*` functions instead of custom ones
* Use `rz_path` APIs for themes, fortunes and signatures
* Remove `rz_sys_prefix`
* Reduce the number of defines needed to handle home and system paths
* Reduce the number of `rz_path` functions
* Make the lib debug depending on log level and `RZ_LOG_DEBUG`
* Refactor a bit how directory of plugins are loaded
* Keep supporting old plugins directory for at least 0.4.0
2021-11-30 13:36:38 +08:00
Khairul Azhar Kasmiran
906ece4211
Add asan build for clang (#1910) 2021-11-17 21:02:02 +08:00
Anton Kochkov
91ef6da7ad
Various memleak fixes (#1893)
* Fix CID 361180
* Fix CID 359879
* Fix CID 358574
* Fix CID 358570
* Fix CID 358569
* Fix CID 358559
* Fix CID 354016
* Fix CID 352581
* Fix CID 352498
* Fix CID 352484
* Fix CID 352451
* Fix CID 348953
* Fix CID 348937
* Fix CID 348935
* Fix CID 344518
* Fix CID 316930

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2021-10-27 16:32:45 +08:00
Aswin C
dafa52b48b
RzArch: Fix clang-ci and Coverity warnings (#1302) 2021-07-13 10:15:11 +02:00
Giovanni
4e3bbf1d9d
Fix compiler warnings gnu/arc*.c syscall.c print.c debug_gdb.c (#1227)
* Fixed memory leak in rz_syscall

* Fixed warning of null format on sprintf

* Fixed warning of null fmt on printf

* fixed array subscript 5 is above array bounds of ‘char[5]’
2021-06-20 21:49:08 +08:00
Aswin C
873ac64247
Refactor rz_arch_profile_add_flag_every_io to not let it depend on RzCore (#1215)
* Refactor `rz_arch_profile_add_flag_every_io` to not let it depend on `RzCore`
* Remove the definition of `RzCore` from  `rz.arch.h`
* Fix Coverity scan errors
* Resource leak (overwriting) in L169 of `cpu_name`
	- Fixed by defining it inside the loop
* Check for `NULL` for `cpu_name`
* Check for `NULL` for asmcpu in cconfig
* Fix overwriting by freeing `path` before assigning again
* Cast `RzFlag` while parsing the hashtables
* Move the `arch`'s check for `NULL` to the beginning of the function
* Rename the APIs which load the SDBs for RzSysregsDB and RzArchTarget
* Use `RZ_SYS_DIR` for creating the path in `rz_arch_profiles_init`
2021-06-16 10:22:46 +02:00
Aswin C
c7ae12e654
Introduce RzArchProfile and add support for CPU profiles (#1193)
* Introduce `RzArchProfile` and add the CPU profiles
* Create `rz_arch.h` and `arch_profile.c`
* Add the CPU Profile's SDB files
* Add the `meson.build` for compiling SDB files
* Add the hashtables and the flagspaces
* Add a test and compare the `type` in `rz_sysreg_get`
* Update the list of AVR CPUs in `asm_avr`
* Run clang-format and include rz_arch.h in rz_analysis.h
* Fix the install directory of the compiled SDB files
* Introduce `RzArchTarget` which houses `RzArchProfile`
* Support for loading a new profile when `asm.cpu` is changed
* Change the variables names to lowercase and add tests
* Add a test for loading a new CPU profile when CPU is changed
* Add Doxygen documentation, run `clang-format` and correct the requested changes
* Remove unnecessary zero-initializations and other improvements
* Reversed a condition while creating the path in `rz_arch_profiles_init`
* Fixed four tests: three regarding printing the flagspaces and one from printing flags after analysis in AVR
* Free the required pointers and check for `NULL`
* Free the pointers that was allocated previously, before returning `NULL`
* Free the pointer in `rz_sysregs_db_new`
* Support for adding a fallback profile for unsupported CPUs
2021-06-11 20:29:12 +08:00
Aswin C
92b5783fa1
Deprecate RzSyscallPort and move the existing sysregs to SDB (#1160) 2021-06-02 02:01:51 +08:00
Khairul Azhar Kasmiran
d658843a0c
Update syscall sdb namespace on asm.arch/bits/os change (#867) 2021-03-21 10:10:01 +08:00
Anton Kochkov
a690e8f18d
Add missing copyright information (#862) 2021-03-19 15:57:07 +08:00
Riccardo Schirone
53bf5c497f SPDX Copyright text for all files based on history
- Add LICENSES directory
- Download additional licenses used
- Add .reuse directory
- Add doc about SPDX/reuse

Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2021-03-05 19:39:15 +08:00
Riccardo Schirone
53b4537160 Introduce portable build option to use relative paths
`portable` makes rizin use paths relative to the executable binary path,
so that all resource files (e.g. SDB files) can be retrieved without
having an hard-coded prefix in the binary. By doing so, rizin
installation directory can be moved from location to location and still
work. This is useful when having a static rizin that you want to execute
on another system.

It makes sure that all PATHs defined in rz_userconf.h are just relative
to the prefix and that, in the code, the prefix is prepended to all
these paths.
2021-02-25 19:41:38 +08:00
Khairul Azhar Kasmiran
e5a2f129f5
syscall.c: Redo openDatabase and rename it to load_sdb (#532)
* syscall.c: Redo openDatabase and rename it to load_sdb
* Add fix for FreeBSD
2021-02-07 12:44:22 +08:00
Riccardo Schirone
2c54547ec0 Clean dependencies between modules and put them in order 2021-01-28 11:57:28 +01:00
Riccardo Schirone
cee8d470c2 Remove Makefiles and many related scripts 2021-01-28 11:57:28 +01:00
Anton Kochkov
a0be4e2e64 Run clang-format 2021-01-21 22:05:44 +08:00
Khairul Azhar Kasmiran
ea73a9c2fa
Clear syscall and sysregs sdbs if their files are not found (#379)
* Clear syscall and sysregs sdbs if their files are not found
* "Fix" cmd_k tests

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2021-01-18 17:09:47 +08:00
Riccardo Schirone
7912502149
Fix compilation when python is run through meson runpython (#111)
Multiline scripts had issues on my windows system while building
from `cmd`. I removed some "pre_sdb" scripts used to read symlinks
because there are only two and it's probably easier to just avoid
symlinks for better portability.

Also moved a bunch of inlined script to separate files in sys/.
2020-12-01 09:17:24 +01:00
Anton Kochkov
539f60a1a8
Rename radare to rizin (#68)
* Rename radare to rizin

- Rename REvent to RzEvent
- Rename RBreakpoint to RzBreakpoint
- Rename RRune to RzRune

* Remove unnecessary files
2020-11-04 18:56:27 +08:00
Florian Märkl
6572b63794
Use Standard SPDX Header Comments (#51) 2020-10-27 09:04:11 +01:00
Anton Kochkov
1ef15faaee Rename R2DEPS to RZ_DEPS 2020-10-23 15:19:22 +08:00
Riccardo Schirone
7ceebc725e Mass renaming r2 to rz/rizin 2020-10-13 12:43:34 +02:00
officialcjunior
725c92f1fc Remove example.syscall-file ##build 2020-10-10 11:59:53 +08:00
Riccardo Schirone
502e91aff7
Rename R_ and R2_ to RZ_ (#8)
* Rename R2_ -> RZ_
* Rename R_ -> RZ_
* Rename R2R_ -> RZ_TEST_
* Rename R2R defines and types to RZ_TEST/RzTest
* Keep R_ for REIL registers
2020-10-02 16:09:13 +02:00
Riccardo Schirone
721609a17b
Rename to rizin (#2) 2020-10-01 16:13:03 +02:00