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

pyPANDA rr_get_guest_instr_count() can overflow with large instruction counts #1219

Closed
wpence opened this issue Sep 19, 2022 · 3 comments
Closed
Assignees
Labels

Comments

@wpence
Copy link
Contributor

wpence commented Sep 19, 2022

In panda.py the rr_get_guest_instr_count() can return negative integer numbers when the system has a large instruction count. It turns out the C API used with cffi to build pyPANDA only returns an int which appears to be causing this problem, but the actual instruction count is stored as a uint64_t.

If the header file:
https://github.com/panda-re/panda/blob/dev/panda/include/panda/panda_api.h#L34

and corresponding source file:
https://github.com/panda-re/panda/blob/dev/panda/src/panda_api.c#L132

are updated to return a uint64_t (how the instruction count is stored in C) and the pyPANDA python package is rebuilt, this appears to solve the problem on the Python side.

@lacraig2
Copy link
Member

lacraig2 commented Oct 4, 2022

That looks like a problem. Thanks for the bug report.

@wpence
Copy link
Contributor Author

wpence commented Nov 1, 2022

Created PR #1242 to fix this issue. Verified with a very large ARM replay file that the instruction count no longer overflows when using the Python API.

lacraig2 pushed a commit that referenced this issue Nov 11, 2022
* Fix overflowing instruction count in pyPANDA

Updated rr_get_guest_instr_count_external() in panda_api to return uint64_t to fix an overflow issue in pyPANDA.

* Fix instruction count overflow in pyPANDA

Updated rr_get_guest_instr_count_external() in panda_api to return uint64_t to fix an overflow issue in pyPANDA.
@lacraig2
Copy link
Member

PR #1242 fixes issue. Merged.

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