radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
20.48k stars 2.99k forks source link

Latest r2 resets asm.bits after "o" command #3971

Closed lizardo closed 11 months ago

lizardo commented 8 years ago

Steps to reproduce:

$ r2 -v
radare2 0.10.0-git 10124 @ linux-little-x86-64 git.0.9.9-2015-g31ee717
commit: 31ee717f819a6c8964a8cbeef931dba5ccc6ef4e build: 2016-01-18
$ r2 --
[0x00000000]> e asm.arch = arm; e asm.bits = 16
[0x00000000]> e asm.arch; e asm.bits
arm
16
[0x00000000]> o build/main.bin
7
[0x00000000]> e asm.arch; e asm.bits
arm
64
[0x00000000]>

Not a big issue as I can reset it back, but I don't expect the "o" command to affect any configuration...

lizardo commented 8 years ago

Using "on" (disabling r_bin) solves the issue, but I did not expect "o" to have any effect in this case as the binary in question is a plain memory dump (not e.g. an ELF), so no way can r_bin discover anything about it. Well, maybe it detected as some random format by accident.

lizardo commented 8 years ago

By the way, replace main.bin with e.g. "o /etc/passwd" to have the same effect (asm.bits changed to 64).

radare commented 8 years ago

opening a file implies changing the bits acording to the info provided by rbin.

in this case. the bin shuoldnt report any specific bitsize because its an unknown filetype, so it shouldnt change.

On 18 Jan 2016, at 14:32, lizardo notifications@github.com wrote:

By the way, replace main.bin with e.g. "o /etc/passwd" to have the same effect (asm.bits changed to 64).

— Reply to this email directly or view it on GitHub https://github.com/radare/radare2/issues/3971#issuecomment-172527800.

condret commented 8 years ago

oh, this thing again

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. Considering a lot has changed since its creation, we kindly ask you to check again if the issue you reported is still relevant in the current version of radare2. If it is, update this issue with a comment, otherwise it will be automatically closed if no further activity occurs. Thank you for your contributions.

lizardo commented 4 years ago

Problem persists even on latest version:

$ r2 -v
radare2 4.3.1 0 @ linux-x86-64 git.4.3.1
commit: HEAD build: 2020-03-06__15:05:41
$ r2 --
 -- Press 'c' in visual mode to toggle the cursor mode
[0x00000000]> e asm.arch = arm; e asm.bits = 16
[0x00000000]> e asm.arch; e asm.bits
arm
16
[0x00000000]> o /etc/passwd
[0x00000000]> e asm.arch; e asm.bits
arm
64
[0x00000000]>
lizardo commented 11 months ago

As of 5.8.8, it has been fixed:

$ r2 -v
radare2 5.8.8 1 @ linux-x86-64
birth: git.5.8.8 2023-06-08__14:00:41
commit: ea7f0356519884715cf1d5fba16042bac72b2df5
options: gpl -O1 cs:5 cl:0 make
$ r2 --
 -- License server overloaded (ETOOMUCHCASH)
[0x00000000]> e asm.arch; e asm.bits
x86
64
[0x00000000]> e asm.arch = arm; e asm.bits = 16
[0x00000000]> e asm.arch; e asm.bits
arm
16
[0x00000000]> o /etc/passwd
[0x00000000]> e asm.arch; e asm.bits
arm
16
[0x00000000]>