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

Issue in detail feature for ARM post-incrementing ldrb/strb instructions #2283

Open
chiffreKing opened this issue Feb 28, 2024 · 2 comments
Open
Labels
Milestone

Comments

@chiffreKing
Copy link

chiffreKing commented Feb 28, 2024

There are different instructions where the access details of memory operands is incorrect interpreted:

cstool -d thumb 11f8013b
 0  11 f8 01 3b  ldrb   r3, [r1], #1
        ID: 84 (ldrb)
        op_count: 3
                operands[0].type: REG = r3
                operands[0].access: WRITE
                operands[1].type: MEM
                        operands[1].mem.base: REG = r1
                operands[2].type: IMM = 0x1
        Write-back: True
        Registers read: r1
        Registers modified: r3 r1
        Groups: thumb2


cstool -d thumb 00f8013b
 0  00 f8 01 3b  strb   r3, [r0], #1
        ID: 241 (strb)
        op_count: 3
                operands[0].type: REG = r3
                operands[0].access: READ
                operands[1].type: MEM
                        operands[1].mem.base: REG = r0
                operands[2].type: IMM = 0x1
        Write-back: True
        Registers read: r3 r0
        Registers modified: r0
        Groups: thumb2

As you can see in both cases the access type for both memory operations is missing.
Using capstone v5.0.1

@Rot127
Copy link
Collaborator

Rot127 commented Mar 5, 2024

They work in the next branch:

$ ./cstool -d thumb 11f8013b
 0  11 f8 01 3b  ldrb	r3, [r1], #1
	ID: 23 (ldrb)
	op_count: 2
		operands[0].type: REG = r3
		operands[0].access: WRITE
		operands[1].type: MEM
			operands[1].mem.base: REG = r1
			operands[1].mem.scale: 0
			operands[1].mem.disp: 0x1
		operands[1].access: READ
	Write-back: True
	Post index: True
	Registers read: r1
	Registers modified: r1 r3
	Groups: IsThumb2 

$ ./cstool -d thumb 11f8013b
 0  11 f8 01 3b  ldrb	r3, [r1], #1
	ID: 23 (ldrb)
	op_count: 2
		operands[0].type: REG = r3
		operands[0].access: WRITE
		operands[1].type: MEM
			operands[1].mem.base: REG = r1
			operands[1].mem.scale: 0
			operands[1].mem.disp: 0x1
		operands[1].access: READ
	Write-back: True
	Post index: True
	Registers read: r1
	Registers modified: r1 r3
	Groups: IsThumb2 

I would advice you to use it. It contains way more precise disassembly and also supports the newly added processor extensions.

@Rot127 Rot127 added this to the v5.0.2 milestone Mar 19, 2024
@Rot127 Rot127 added bug ARM Arch labels Mar 19, 2024
@Rot127
Copy link
Collaborator

Rot127 commented Apr 24, 2024

@chiffreKing Can you provide me with a list of instructions which have the incorrect access flags?
I would fix them manually and they can be part of the v5.0.2 release. If you don't have a list, I would only fix the two you mention.
Because investigating which instructions are all broken in v5 takes way too long. And we have the better next branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants