]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Certain kernels on s390 provide extra read permissions on executable
authorFlorian Krohm <florian@eich-krohm.de>
Tue, 7 Apr 2015 20:43:55 +0000 (20:43 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Tue, 7 Apr 2015 20:43:55 +0000 (20:43 +0000)
segments. See discussion here: https://bugs.kde.org/show_bug.cgi?id=345824#c4
Making sure that rx and x compare equal.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15075

coregrind/m_aspacemgr/aspacemgr-linux.c

index 48bd2b3341d7ae78d9e320bb80c964f9f2f150c4..d32a048326ddc6be4f9e2a3f885229a457b1f068 100644 (file)
@@ -770,7 +770,7 @@ static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot,
                                           const HChar* filename )
 {
    Int  iLo, iHi, i;
-   Bool sloppyXcheck;
+   Bool sloppyXcheck, sloppyRcheck;
 
    /* If a problem has already been detected, don't continue comparing
       segments, so as to avoid flooding the output with error
@@ -814,6 +814,14 @@ static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot,
    sloppyXcheck = False;
 #  endif
 
+   /* Some kernels on s390 provide 'r' permission even when it was not
+      explicitly requested. It seems that 'x' permission implies 'r'. */
+#  if defined(VGA_s390x)
+   sloppyRcheck = True;
+#  else
+   sloppyRcheck = False;
+#  endif
+
    /* NSegments iLo .. iHi inclusive should agree with the presented
       data. */
    for (i = iLo; i <= iHi; i++) {
@@ -868,6 +876,11 @@ static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot,
          seg_prot |= VKI_PROT_EXEC;
       }
 
+      if (sloppyRcheck && (prot & (VKI_PROT_EXEC | VKI_PROT_READ)) ==
+          (VKI_PROT_EXEC | VKI_PROT_READ)) {
+         seg_prot |= VKI_PROT_READ;
+      }
+
       same = same
              && seg_prot == prot
              && (cmp_devino