radare2 icon indicating copy to clipboard operation
radare2 copied to clipboard

Latest r2 resets asm.bits after "o" command

Open lizardo opened this issue 9 years ago • 6 comments

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 avatar Jan 18 '16 13:01 lizardo

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 avatar Jan 18 '16 13:01 lizardo

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

lizardo avatar Jan 18 '16 13:01 lizardo

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 [email protected] 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.

radare avatar Jan 19 '16 11:01 radare

oh, this thing again

condret avatar Jan 25 '16 01:01 condret

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.

stale[bot] avatar Jun 16 '20 07:06 stale[bot]

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 avatar Jun 19 '20 19:06 lizardo

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]> 

lizardo avatar Nov 02 '23 14:11 lizardo