Bug 470132

Summary: s390x: Assertion failure on VGM instruction
Product: [Developer tools] valgrind Reporter: Andreas Arnez <arnez>
Component: vexAssignee: Andreas Arnez <arnez>
Status: RESOLVED FIXED    
Severity: normal CC: mark
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Suggested fix for VGM
Enhance test coverage for VGM

Description Andreas Arnez 2023-05-22 15:57:17 UTC
A valid VGM instruction can cause Valgrind to exit with an assertion failure like this:

    vex: priv/guest_s390_toIR.c:16378 (s390_irgen_VGM): Assertion `from <= to' failed.

This assertion is incorrect. Instead, the reversed case `from > to' is valid and should result in a wrap-around mask.
Comment 1 Andreas Arnez 2023-05-22 18:20:50 UTC
Created attachment 159189 [details]
Suggested fix for VGM
Comment 2 Andreas Arnez 2023-05-22 18:26:17 UTC
Created attachment 159191 [details]
Enhance test coverage for VGM
Comment 3 Mark Wielaard 2023-06-17 16:52:24 UTC
The elfutils testsuite triggered this bug:
https://inbox.sourceware.org/elfutils-devel/8e1dcc74187c46bc9fbad988b4f67ade0deaf872.camel@klomp.org/T/#m59e580471297164d345d4954e66490c3627958ff

After applying this patch, the testsuite passed again.
Comment 4 Mark Wielaard 2023-06-28 14:40:34 UTC
I also backported this to the fedora valgrind package.
https://bodhi.fedoraproject.org/updates/FEDORA-2023-f4019f53e1
Comment 5 Mark Wielaard 2023-07-03 08:53:20 UTC
Note that the lfedora1 machine (now at Fedora 38) is showing this issue too now:
https://sourceforge.net/p/valgrind/mailman/message/37865251/
Comment 6 Andreas Arnez 2023-07-06 17:10:36 UTC
The fix seems important, and it looks like the patches are doing their job, so I pushed them.