| Summary: | PCMPISTRM $0x72 and PCMPISTRI $0x12 validity bit propagation is imprecise | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | Patrick J. LoPresti <lopresti> |
| Component: | memcheck | Assignee: | Julian Seward <jseward> |
| Status: | REPORTED --- | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 3.12 SVN | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: |
Test case illustrating pcmpistrm $0x72 validity bit propagation failure
Test case illustrating pcmpistri $0x12 validity bit propagation failure |
||
|
Description
Patrick J. LoPresti
2016-11-02 18:51:42 UTC
Forgot to mention: I believe this example should run without warnings when "--partial-loads-ok=yes --expensive-definedness-checks=yes" are specified to memcheck. A similar problem happens with Intel's optimized atoi() routine. Actually this is so similar that I believe these can probably be fixed together, so I am just adding the second test case to this bug report as another attachment. The Intel atoi() code uses PCMPISTRI $0x12,... Once again the return value from the function is tainted as undefined, resulting in memcheck complaints every time the value is used. Created attachment 101986 [details]
Test case illustrating pcmpistri $0x12 validity bit propagation failure
I'd fix this, if I could think of a sane way to do so. Alas .. Just a thought... How about adding VEX opcodes corresponding to these string instructions? Although the behavior of these instructions is (ludicrously) complex, the data flow is pretty simple: Two vectors of input; one vector and a few condition codes of output; every byte past the first zero ignored. It seems to me that it should be pretty straightforward to do the memcheck instrumentation directly for most (all?) of the PCMPxSTRx variants. Intel has had a few instruction set iterations (AVX2/AVX512/BMI/etc.) and they have not added any more monstrosities like these, so I do not think this would be entering an endless rat hole. What do you think? |