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

fix VPMASKMOV and VMASKMOVP #2342

Merged
merged 6 commits into from
Feb 12, 2025
Merged

fix VPMASKMOV and VMASKMOVP #2342

merged 6 commits into from
Feb 12, 2025

Conversation

ye-yeshun
Copy link
Contributor

Just like 0x8c, I've made changes to the relevant code to avoid accessing out-of-bounds memory when a portion of the mask is 0.
I added the test case but commented it out, I don't think I should tamper with ref30.txt and the binary file test30.

Copy link
Owner

@ptitSeb ptitSeb left a comment

Choose a reason for hiding this comment

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

You need to check if ed is x3 after the geted(...) so you don't need to restore "ed" to it's initial value. The SUB(ed, ed, 24) and SUB(ed, ed, 8) can also be removed after that.

@ptitSeb
Copy link
Owner

ptitSeb commented Feb 11, 2025

Side question: did you encounter program/games that needs this?

Log: VMASKMOVPS读取内存时, 如果某些mask位是0则不进行读写避免访问越界

Signed-off-by: YeshunYe <yeyeshun@uniontech.com>
Change-Id: I197fc356edcac202b5a329c50c334d0166532e93
Log: VMASKMOVPD读取内存时, 如果某些mask位是0则不进行读写避免访问越界

Signed-off-by: YeshunYe <yeyeshun@uniontech.com>
Change-Id: Ie11d93971aa92b141540a37bfdae0b3b060e3aea
Log: VMASKMOVPS写入内存时, 如果某些mask位是0则不进行读写避免访问越界

Signed-off-by: YeshunYe <yeyeshun@uniontech.com>
Change-Id: Ide5cb36dc03fc56480fdd45e7d96daed8557d849
Log: VMASKMOVPD写入内存时, 如果某些mask位是0则不进行读写避免访问越界

Signed-off-by: YeshunYe <yeyeshun@uniontech.com>
Change-Id: I037de8568e9d2d29597fdf08f991d54e3cb2f6d9
Log: VPMASKMOVD/Q写入内存时, 如果某些mask位是0则不进行读写避免访问越界

Signed-off-by: YeshunYe <yeyeshun@uniontech.com>
Change-Id: I0dc98a29ed933d953e137e777bc296149d94b10b
Log:

Signed-off-by: YeshunYe <yeyeshun@uniontech.com>
@ye-yeshun
Copy link
Contributor Author

Side question: did you encounter program/games that needs this?

Sure. Opening the email page of WXWork software and switching emails several times will cause an exception.
After debugging and analysing, I found that it was the MASKMOV instruction accessing an unallocated memory page at a memory page boundary.

@ye-yeshun
Copy link
Contributor Author

You need to check if ed is x3 after the geted(...) so you don't need to restore "ed" to it's initial value. The SUB(ed, ed, 24) and SUB(ed, ed, 8) can also be removed after that.

Due to the number of changes, I used a forced push, please re-review

Copy link
Owner

@ptitSeb ptitSeb left a comment

Choose a reason for hiding this comment

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

Looks better now. Some VEORQ can be moved inside the "else" prt of the if(MODREG) but I'll do that later, it's a minor change.

@ptitSeb ptitSeb merged commit b8cc859 into ptitSeb:main Feb 12, 2025
27 checks passed
@ptitSeb
Copy link
Owner

ptitSeb commented Feb 12, 2025

It seems this PR has broken "The Talos Principle 2" (an UE5+ game). I'll debug tomorrow.

@ye-yeshun
Copy link
Contributor Author

It seems this PR has broken "The Talos Principle 2" (an UE5+ game). I'll debug tomorrow.

OK, thank you. If you get anything after debugging, please comment here.

@ptitSeb
Copy link
Owner

ptitSeb commented Feb 13, 2025

It seems this PR has broken "The Talos Principle 2" (an UE5+ game). I'll debug tomorrow.

OK, thank you. If you get anything after debugging, please comment here.

Yes, the issue was that "ed" was not check for being "x3". It's fixed.

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