Bug 502324 - s390x: Memcheck false positives with TMxx and TM/TMY
Summary: s390x: Memcheck false positives with TMxx and TM/TMY
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Andreas Arnez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-02 15:41 UTC by Andreas Arnez
Modified: 2025-04-02 17:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Arnez 2025-04-02 15:41:18 UTC
It has been observed that memcheck reports false positives on s390x when a partially undefined value is tested with one of the TMLL, TMLH, TMHL, or TMHH instructions. These instructions test an operand against a given mask. Zero mask bits indicate that the corresponding bits in the operand shall be "don't care". But memcheck complains anyway if one of these bits is undefined and the resulting condition code is used outside the current block.

One example how this may happen is like this:

  tmll %r5,0x0080   # condition code is generated
  mvc ...           # new block, since mvc results in a loop
  jne  1f           # condition code is used

Let's assume that only the lowest byte of %r5 was initialized. This would be perfectly fine for the result of tmll, but memcheck would still complain.

Essentially the same issue exists with TM and TMY.
Comment 1 Andreas Arnez 2025-04-02 17:59:50 UTC
These commits should fix the issue:
a95ba0d6e549764d5a68536efc6eb1545b537c09 - Fixes TMxx
29f8a0ad4ed17d9cdf4a5d6661a51d25db6fc472 - Fixes TM/TMY
8d5cd244c7a81931ee17c3a7d46691774847222b - Adds a test case