DynamoRIO / dynamorio

Dynamic Instrumentation Tool Platform
Other
2.65k stars 560 forks source link

VZEROUPPER zeroes ymm registers too and so is incorrect in instr_zeroes_ymmh() #6217

Open derekbruening opened 1 year ago

derekbruening commented 1 year ago

VZEROALL and VZEROUPPER do not have any operands in DR"s IR today (maybe because of #1382 where general AVX v* opcodes zeroing top bits was decided to not become a first-class IR concept?). Thus they are special-cased in instr_zeroes_ymmh() and instr_zeroes_zmmh(). Yet VZEROUPPER is not considered in instr_zeroes_ymmh() where it returns false. This seems incorrect. All the docs say it zeroes ymmh; old docs stop there (https://www.laruence.com/x86/VZEROUPPER.html, https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/mm256-zeroupper.html) but the latest manual and other docs include zmmh (https://www.felixcloutier.com/x86/vzeroupper, official manual). So you could maybe understand it being the reverse in our original code, but how it is now doesn't make sense.

derekbruening commented 1 year ago

We can include this in the same issue I suppose: should VZEROALL and VZEROUPPER have explicit operands?

khuey commented 1 year ago

I don't have a strong opinion but I'd note that e.g. XSAVE also doesn't have explicit operands.