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

Don't clobber EIP after non INT/SYSCALL exception #875

Merged
merged 1 commit into from
Aug 29, 2017

Conversation

rhelmot
Copy link
Contributor

@rhelmot rhelmot commented Aug 24, 2017

Fixes #872

@@ -939,6 +939,7 @@ void helper_syscall(CPUX86State *env, int next_eip_addend)
CPUState *cs = CPU(x86_env_get_cpu(env));

cs->exception_index = EXCP_SYSCALL;
env->exception_is_int = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i need to look at the code closer, but this worries me, as "exception_is_int" is also used elsewhere, so you set this here may trigger some unwanted behaviour.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be safe (and future-proof), is it better to create a new field in env for this?

@rhelmot
Copy link
Contributor Author

rhelmot commented Aug 28, 2017

I looked at this a little more carefully and it seems that function I added that line to was guarded by #ifdef CONFIG_USER_ONLY, so it wouldn't have done anything. In the corresponding system mode function, changes have already been added for unicorn that hack around this issue by setting env->eip directly, which makes sense since this is meant to be the "fast-syscall" instruction and handled inline.

I pushed the change removing that line, this can be merged now.

@aquynh aquynh merged commit 363cbac into unicorn-engine:master Aug 29, 2017
@aquynh
Copy link
Member

aquynh commented Aug 29, 2017

merged, thanks!

felberj added a commit to felberj/unicorn that referenced this pull request Aug 30, 2017
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