rizinorg / cutter

Free and Open Source Reverse Engineering Platform powered by rizin
https://cutter.re
GNU General Public License v3.0
15.66k stars 1.14k forks source link

"-R, --root CHROOT_DIR" parameter in standard builds #2427

Open lars18th opened 4 years ago

lars18th commented 4 years ago

Hi,

I hope this time this suggestion will be right to post it here (https://github.com/radareorg/cutter/issues/2426#issuecomment-688169864).

As I'm trying to use Cutter in a Cross Compile environment for Debugging an Embedded x86 platform (that at this time is not supported, or is not documented), I have found a missing characteristic:

However, this parameter to set the ROOT directory is missing in the standalone version of Cutter (true in the Linux AppImage, and of course in the Windows version too).

So, please can you provide support for this cross-platform environment? Thank you!

karliss commented 4 years ago

No Docker version of Cutter doesn't have such option. You just copied a line from usermod help.

Try describing what you want again. As "please implement the feature that is in completely different tool and does something completely unrelated" isn't a useful description.

Also please stick to the issue template, this isn't your first issue and you keep ignoring it.

lars18th commented 4 years ago

Try describing what you want again. As "please implement the feature that is in completely different tool and does something completely unrelated" isn't a useful description.

Also please stick to the issue template, this isn't your first issue and you keep ignoring it.

Sorry! I'll try it...

Is your feature request related to a problem? Please describe.

I need to fix (patch) one x64 binary in a Linux embedded platform. So I can't run Cutter inside that platform (it doesn't have support for AppImage and I can't cross-compile Cutter for it as the kernel is old). So my idea is to run (debug) the binary in a regular Linux machine with a similar kernel loading the shared objects from the target platform. The problem here is that Cutter everytime loads the shared objects from the platform where it's running.

Describe the solution you'd like

What I request is to pass to Cutter the ROOT PATH of the target platform (for example /opt/target/, where the entire filesystem of the embedded device is mounted. This will work then as if you execute a chroot command before calling to the binary.

Describe alternatives you've considered

Inside the target platform I can execute the GDB debugger server. But the problem is that the disassembling doesn't work at time using the remote debugger when the binary uses shared objects. If this will be improved, then my request perhaps will not have sense.

Additional context

My initial requesting to improve the GDB remote debug is #2097 .

I hope you want to consider this use case. Thank you.

karliss commented 4 years ago

Have you verified that your scheme of using chroot works without Cutter?

. But the problem is that the disassembling doesn't work at time using the remote debugger when the binary uses shared objects. My initial requesting to improve the GDB remote debug is #2097 .

This doesn't seem to match. The issue you linked is about debug UI being slow not about disassembling not working. Are you sure you don't have something mixed up.

Assuming that answer for first question is positive read rarun2 documentation for advanced execution environment configuration. rarun2 profile for debuging can be set using dbg.profile option.

lars18th commented 4 years ago

Hi @karliss ,

Assuming that answer for first question is positive read rarun2 documentation for advanced execution environment configuration. rarun2 profile for debuging can be set using dbg.profile option.

Thank you for pointing to the rarun2 tool. It seems that it can be used for the objective I have. I'll try to configure the environment using the profile.rr2 and loading it as described in #2148 . Regards.

lars18th commented 4 years ago

Hi @karliss ,

Please, I need your help... At time I can run the target binary inside the chroot environment with this command: rarun2 target-bin.rr2 and it works. The configuration is like this:

program=/usr/bin/executable
arg1=--display
arg2=/dev/video
clearenv=true
chroot=/mnt/embedded/root

However; I don't know how to open in Cutter this config.rr. Any idea? Regards.

lars18th commented 4 years ago

Hi,

To be clear: I can execute r2 -d rarun2 target-bin.rr2 and start the radare2 debugging. But I don't know how to "attach" to it from Cutter. Please, any documentation?

Thank you!

lars18th commented 4 years ago

I feel I got it:

I'm rigth? If yes, then I suggest:

  1. Add the command-line paramter to Cutter --bdg.profile= to select it at start.
  2. When starting the debug, please add a button to select one configuration.
  3. Add to the documentation an explanation about how to debug a CHROOT binary: You need first to configure the environment and test it with rarun2 env.rr2. Then you can use this environment inside the debug.

Regards.