Commit graph

32 commits

Author SHA1 Message Date
wargio
0eef58115b Rewritten (partially) rz_run_parseline 2022-08-22 13:50:39 +02:00
Giovanni
a988941bf2
Refactor thread code and add RzThreadQueue (#2683)
* Kill the thread only if is alive.
* Remove rz_th_lock_guard.
* Use rz_sys_usleep since pthread_yield/sched_yield are not portable.
* Kill threads only on error.
* Avoid killing already-dead threads.
* RzThreadFunction now returns void* and added test_thread_queue.
* Removed pthread_exit
2022-06-19 21:07:13 +08:00
Florian Märkl
79bf04dcf4 Fix test_run on ppc Mac OS X
These things guarded by !__POWERPC__ work perfectly fine on Mac OS X
10.5 with PowerPC, so we can only assume they were supposed to guard
only older Mac OS X versions, but abusing __POWERPC__ for this is wrong.
Error printing for posix_spawnp has also been fixed, as it does not set
errno and instead returns an errno-like value.
2022-03-29 01:50:29 +08: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
Dhruv Maroo
34d345d884 Format according to clang-format-13 2021-11-25 15:44:28 +08:00
Khairul Azhar Kasmiran
637c192145
bin.str.enc: Rename latin1 to the more generic 8bit (#1847)
* Rename `rz_str_escape_latin1()` to `rz_str_escape_8bit()`
* test_serialize_analysis.c: Change string from "latin1" to "8bit"
* `bin.str.enc`: Rename `latin1` to the more generic `8bit`
2021-10-18 12:07:52 +08:00
Anton Kochkov
022c606372 Rename RzStrEncOptions to RzStrEscOptions 2021-10-16 11:33:48 +08:00
Anton Kochkov
39613b5c16
Port C (metainformation) commands to the rzshell (#1752)
* Do not escape strings during the search
* Port `C` (metainformation) commands to the rzshell
* Improve string autodetection
* Remove `Cr` and RZ_META_TYPE_RUN
* Escape `\x1b` as `\e` character in strings
* Move string encoding options to `RzStrEncOptions` struct
* Add `esc_double_quotes` option to `RzStrEncOptions`
* Do not filter out unprintable characters for uppercase check
* Use `esc_double_quotes` when printing the string between '"' in disasm
* Use signed chars on all platforms/architectures

Co-authored-by: Riccardo Schirone <sirmy15@gmail.com>
2021-10-15 16:48:18 +08:00
Riccardo Schirone
461d73c298
Add pid/pidfile on man/rz-run and make pid option a boolean (#1741) 2021-09-23 20:35:19 +02:00
Anton Kochkov
7e276b3f09 Check pty.h functions presense in Meson 2021-08-23 18:45:22 +08:00
David CARLIER
07faec08ef
socket try to disable per process first on freebsd. (#1491)
using new api/flag available when aslr was made available on this platform.
2021-08-20 16:42:06 +02:00
pancake
c378134a80 System LIBRARY_PATH must be honored (not replaced) on HaikuOS
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2021-08-18 09:16:23 +02:00
David CARLIER
0f978dd836
HaikuOS nice() socket function detection. (#1408) 2021-08-09 13:08:23 +08:00
Anton Kochkov
2ef19a2bcb
First step to fix #1261 - remove unused libc function checkers (#1327) 2021-07-29 08:38:52 +02:00
Riccardo Schirone
db04bed503
Fix autocompletion of rz- commands in rizin shell and rename wrong rz_ (#944) 2021-03-31 16:10:54 +02:00
pancake
a22ceb2de8 Add rz_file_binsh() and avoid hardcoding /bin/sh for Termux ##android (#18409)
Inspired by https://github.com/termux/termux-packages/blob/master/packages/radare2/libr-util-sandbox.c.patch
2021-03-16 16:57:32 +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
Alexis Ehret
a470c8df93 Fix uninitialized argument value librz/socket/run.c 2021-02-21 19:55:18 +01:00
Anton Kochkov
a0be4e2e64 Run clang-format 2021-01-21 22:05:44 +08:00
Florian Märkl
40a29cba29
Remove Pseudo-Sandbox (#239) 2020-12-21 21:31:32 +01:00
Riccardo Schirone
286f930b93 Use O_CLOEXEC when creating pipes so they are closed on exec
By default, pipes file descriptors are not closed on exec. This means
they are inherited by the child process. However, this may be a problem
in particular in multi-threading programs (e.g. rz-test), because EOF is
not sent to a pipe until the last pipe file descriptor is closed.

This commit makes sure that by default pipes are created with O_CLOEXEC,
so they are closed whenever an exec syscall is executed. Usually pipe
file descriptors are duplicated to be stdin/stdout/stderr of the
children process and those dupped file descriptors won't be closed on
exec.

In case pipe2 is not available (e.g. MacOS), we do a pipe + fcntl, which
is in theory racy (see man open(2)). For this reason pipe, exec, system,
etc. are wrapped in rz_sys and they use a global mutex to make sure a
pipe is either created and set as O_CLOEXEC or not created at all before
an exec operation is done.

On very old systems, O_CLOEXEC may not be available at all. In those
cases, which should be rare, we just keep a list of file descriptors
created with rz_sys_pipe that we need to close before executing another
process.

Interaction with external libs may be tricky. We expect external libs to
create files/pipes that need to be closed on exec with the right flags
and we expect rizin code to manually close pipes file descriptors as
appropriate if the exec syscall is executed by an external library
(non-rizin code).

Make sure execl is found by acr/make
2020-12-15 10:18:50 +01:00
Anton Kochkov
7ee14fb853 More renames 2020-11-12 12:27:04 +08:00
Anton Kochkov
afc45bec46 Rename r2 to rizin 2020-11-06 12:21:54 +08:00
Florian Märkl
6572b63794
Use Standard SPDX Header Comments (#51) 2020-10-27 09:04:11 +01:00
David CARLIER
000798a610 Setting ASLR support for DragonFlyBSD ##util (#17810)
Enable calls for rarun2
2020-10-23 19:02:25 +08:00
Riccardo Schirone
c1865f7e93 Use -Werror when building in CI (#17781) 2020-10-15 12:27:09 +08:00
Riccardo Schirone
7ceebc725e Mass renaming r2 to rz/rizin 2020-10-13 12:43:34 +02:00
Riccardo Schirone
b8bf83b856 Rename RStrBuf to RzStrBuf 2020-10-13 12:43:34 +02: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
338e6fe172 Other renames in man and small places
Remove rz link, just keep rizin

Remove r2 link from acr

Fix http test on macos
2020-10-01 17:53:29 +02:00
Riccardo Schirone
721609a17b
Rename to rizin (#2) 2020-10-01 16:13:03 +02:00
Renamed from libr/socket/run.c (Browse further)