Bug 444242 - s390x: Valgrind crashes on EXRL with negative offset
Summary: s390x: Valgrind crashes on EXRL with negative offset
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: 2021-10-22 17:49 UTC by Andreas Arnez
Modified: 2021-10-28 13:10 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Sign-extend "relative long" offset in EXRL (19.74 KB, patch)
2021-10-22 18:12 UTC, Andreas Arnez
Details
Fix with added test case (20.88 KB, patch)
2021-10-26 15:36 UTC, Andreas Arnez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Arnez 2021-10-22 17:49:57 UTC
Valgrind's implementation of the "execute relative long" (EXRL) instruction zero-extends the offset instead of sign-extending it.  This has been seen to cause a crash with SIGSEGV in s390_irgen_EXRL() when a negative offset occurred.
Comment 1 Andreas Arnez 2021-10-22 18:12:18 UTC
Created attachment 142769 [details]
Sign-extend "relative long" offset in  EXRL

This fixes the calculation of the "relative long" address in EXRL.  The calculation is moved to a helper function addr_rel_long(), which is then used other places as well, wherever applicable.  For consistency, the helper function addr_relative() is added as well.
Comment 2 Andreas Arnez 2021-10-26 15:36:26 UTC
Created attachment 142911 [details]
Fix with added test case

This version of the patch also adds an EXRL invocation with a negative offset to the "exrl.c" test case.  Without the fix, Valgrind crashes when trying to execute this.
Comment 3 Andreas Arnez 2021-10-28 13:10:27 UTC
Applied as commit b77dbefe72e4a5c7bcf1576a02c909010bd56991.