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

izzz reports wrong addresses #1514

Closed
ret2libc opened this issue Aug 24, 2021 · 4 comments
Closed

izzz reports wrong addresses #1514

ret2libc opened this issue Aug 24, 2021 · 4 comments
Assignees
Labels
bug Something isn't working RzBin test-required
Milestone

Comments

@ret2libc
Copy link
Member

Work environment

Questions Answers
OS/arch/bits (mandatory) Fedora 33
File format of the file you reverse (mandatory) Macho
Architecture/bits of the file (mandatory) 64
rizin -v full output, not truncated (mandatory) 3b0d11e,

Expected behavior

093 0x00002f3c 0x100002f3c  47  48 () ascii ,http://www.apple.com/appleca/codesigning.crl0\r

Actual behavior

093 0x00002f3c 0x00002f3c  47  48 () ascii ,http://www.apple.com/appleca/codesigning.crl0\r

Steps to reproduce the behavior

$ ./build-dev/binrz/rizin/rizin ./test/bins/mach0/fatmach0-3true
> [0x100000ef8]> izzz~http~codesigning

Additional info

The address currently reported is wrong because there's nothing at that address, see:

[0x100000ef8]> pd 1 @ 0x2f3c
            0x00002f3c      add   byte [rax], al
[0x100000ef8]> px 30 @ 0x2f3c
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x00002f3c  0000 0000 0000 0000 0000 0000 0000 0000  ................
0x00002f4c  0000 0000 0000 0000 0000 0000 0000       ..............
[0x100000ef8]> 
@ret2libc ret2libc added this to the 0.3.0 milestone Aug 24, 2021
@ret2libc ret2libc added bug Something isn't working RzBin labels Aug 24, 2021
@ret2libc
Copy link
Member Author

After looking at the code that searches for strings... I'm not sure we can fix it in short time. The whole "string search" code is a quite convoluted that would likely require a big refactoring + unit tests to properly fix the problem and be sure things would still work.

@XVilka
Copy link
Member

XVilka commented Aug 31, 2021

Agree. It will also benefit from this work: #1535

@XVilka
Copy link
Member

XVilka commented Oct 12, 2021

I know the reason - it's actually quite trivial. The string search is ran using the physical address of the buf, for example in #1752 I did this code to search in the current address space:

ut64 paddr = rz_io_v2p(core->io, addr);
int count = rz_scan_strings(bf->buf, str_list, &scan_opt, paddr, paddr + limit, encoding);
if (count <= 0) {
	rz_list_free(str_list);
	free(*name);
	return false;
}

Thus, to show the right addresses, you have to convert them, probably worth to print both vaddr and paddr in the iz output, with rz_io_p2v() calls.

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. Considering a lot has probably changed since its creation, we kindly ask you to check again if the issue you reported is still relevant in the current version of rizin. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working RzBin test-required
Projects
None yet
Development

No branches or pull requests

2 participants