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

x86: Fix overlap issue with INCSS/RDSSP #6520

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sleigh-InSPECtor
Copy link
Contributor

INCSSQ/RDSSPQ (64-bit variants) are incorrectly decoded as INCSSPD/RDSSPD (32-bit variants).

The 32-bit variants include the constraint (opsize=0 | opsize=1 | opsize=2 | opsize=3) which essentially doesn't constraint the constructor at all (since opsize is a 2-bit field and this covers all combinations). However, this does appear to affect constructor ordering, since it means the 64-bit variants are not strictly more constrained than the 32-bit one and the 32-bit variants appear first in the sleigh source code so are matched first.

The 64-bit variant should be used when REX.W is present which implies opsize=2 (or opsize=3 if a 0x66 prefix is present), so these need to be removed from the allowed opsize values for the 32-bit variant.

By removing all of the opsize constraints, the 64-bit variants are now strictly more constrained than the 32-bit variant causing the decoder to match them if a REX.W prefix is present before checking 32-bit variant. This also matches the way the constraints are written for WRSSD.

e.g.

f3480faee8: "INCSSPQ RAX"

  • x86:LE:64:default (Existing): "INCSSPD EAX"
  • x86:LE:64:default (This patch): "INCSSPQ RAX"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Processor/x86 Status: Triage Information is being gathered
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants