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

qemu/tcg: fix UC_HOOK_MEM_READ on aarch64. #2028

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

glennsec
Copy link

Directly jump into the slow path when there is any hookmem enabled. This fixes #1908.

@glennsec glennsec mentioned this pull request Oct 11, 2024
Directly jump into the slow path when there is any hookmem enabled. This
fixes unicorn-engine#1908.

Signed-off-by: Glenn Baker <[email protected]>
Directly jump into the slow path when there is any hookmem enabled.

Signed-off-by: Glenn Baker <[email protected]>
@glennsec
Copy link
Author

Hi, code updated to cover ppc64 as well.

@PhilippTakacs
Copy link
Contributor

I think you missed at least UC_HOOK_MEM_READ_AFTER.

Also it would be nice to use HOOK_EXISTS_BOUNDED. This way the fast way is taken when no hook exists at the used address. But I don't know if this is possible at this place (you need the emulated physical address).

Use has_hookmem() helper to determine wether "slow-path" TLB read is
needed. Add this helper to x86 architecture as well so that to check for
all hookmem.

Signed-off-by: Glenn Baker <[email protected]>
It's the same implementation for all architectures, so factor out
has_hookmem() into tcg_uc_has_hookmem().

Signed-off-by: Glenn Baker <[email protected]>
@glennsec
Copy link
Author

I think you missed at least UC_HOOK_MEM_READ_AFTER.

Also it would be nice to use HOOK_EXISTS_BOUNDED. This way the fast way is taken when no hook exists at the used address. But I don't know if this is possible at this place (you need the emulated physical address).

Added check for UC_HOOK_MEM_READ_AFTER, including for i386. Factored out the code along the way. I am not sure either I can use HOOK_EXISTS_BOUNDED() as TCGContext.pc_start is set to the end of the BB at the point we call it for codegen.

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

Successfully merging this pull request may close these issues.

2 participants