Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect behavior in Xtensa disassembly backward direction #22896

Closed
yaghmr opened this issue May 3, 2024 · 6 comments
Closed

Incorrect behavior in Xtensa disassembly backward direction #22896

yaghmr opened this issue May 3, 2024 · 6 comments

Comments

@yaghmr
Copy link

yaghmr commented May 3, 2024

Environment

Fri 3 May 2024, 18:42:37, CEST
radare2 5.9.0 0 @ linux-x86-64
birth: git.5.9.0 2024-04-28__16:01:19
commit: unknown
options: gpl release -O1 cs:5 cl:2 meson
Linux x86_64

Description

When attempting to disassemble N instructions backwards in Xtensa architecture, there's an issue where the behavior deviates from the expected. For example, passing -5 results in disassembling 2 instructions before and 2 after, rather than the expected 5 before

Test

[0x400814ec]> i
fd       3
file     app.elf
size     0xeff124
humansz  15.0M
mode     r-x
format   elf
iorw     false
block    0x100
type     EXEC (Executable file)
arch     xtensa
baddr    0x3f400000
binsz    15717475
bintype  elf
bits     32
canary   false
injprot  true
class    ELF32
compiler GCC: (crosstool-NG esp-13.2.0_20230928) 13.2.0 GCC: (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5) 5.2.0
flags    0x300
crypto   false
endian   little
havecode true
laddr    0x0
lang     c++
linenum  true
lsyms    true
machine  Tensilica Xtensa Architecture
nx       false
os       linux
pic      false
relocs   true
relro    no
rpath    NONE
sanitize false
static   true
stripped false
subsys   linux
va       true
[0x400814ec]> s 0x4008150a
[0x4008150a]> pd -5
│           0x40081505      e9fb           s32i.n a14, a11, 60
│           0x40081507      e00800         callx8 a8
│           0x4008150a      a1d5fb         l32r a10, loc._bss_start   
│           0x4008150d      0c0b           movi.n a11, 0
│           0x4008150f      c1d3fb         l32r a12, loc._bss_end   
@trufae
Copy link
Collaborator

trufae commented May 3, 2024

cant repro, no matter if the bin is analized or not

Screenshot 2024-05-03 at 19 02 10 Screenshot 2024-05-03 at 19 02 27

please provide your app.elf

@yaghmr
Copy link
Author

yaghmr commented May 4, 2024

Here it is: app.elf.tar.gz

@radare
Copy link
Collaborator

radare commented May 7, 2024

same, cant reproduce. but im using r2 from git

@yaghmr
Copy link
Author

yaghmr commented May 8, 2024

As mentioned, I am using radare2 5.9.0. Now I will try the Git version and let you know.

@yaghmr
Copy link
Author

yaghmr commented May 8, 2024

I confirm that the issue has been resolved in r2 from Git. What about version 5.9.1?

@trufae
Copy link
Collaborator

trufae commented May 8, 2024

I plan to release 5.9.2 this week. Just finishing some last minute issues these days :) the uneven patch version numbers are only in git. Releases are even/pair numbers. Closing the ticket as i only keep track of issues affecting git.

Thanks to confirm!

feel free to report any other issue you find in xtensa, as well as adding more tests for this arch! Thank you!

@trufae trufae closed this as completed May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants