Skip to content

Commit 23e51b9

Browse files
author
florian
committed
Certain kernels on s390 provide extra read permissions on executable
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent 0da4caf commit 23e51b9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

coregrind/m_aspacemgr/aspacemgr-linux.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot,
770770
const HChar* filename )
771771
{
772772
Int iLo, iHi, i;
773-
Bool sloppyXcheck;
773+
Bool sloppyXcheck, sloppyRcheck;
774774

775775
/* If a problem has already been detected, don't continue comparing
776776
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,
814814
sloppyXcheck = False;
815815
# endif
816816

817+
/* Some kernels on s390 provide 'r' permission even when it was not
818+
explicitly requested. It seems that 'x' permission implies 'r'. */
819+
# if defined(VGA_s390x)
820+
sloppyRcheck = True;
821+
# else
822+
sloppyRcheck = False;
823+
# endif
824+
817825
/* NSegments iLo .. iHi inclusive should agree with the presented
818826
data. */
819827
for (i = iLo; i <= iHi; i++) {
@@ -868,6 +876,11 @@ static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot,
868876
seg_prot |= VKI_PROT_EXEC;
869877
}
870878

879+
if (sloppyRcheck && (prot & (VKI_PROT_EXEC | VKI_PROT_READ)) ==
880+
(VKI_PROT_EXEC | VKI_PROT_READ)) {
881+
seg_prot |= VKI_PROT_READ;
882+
}
883+
871884
same = same
872885
&& seg_prot == prot
873886
&& (cmp_devino

0 commit comments

Comments
 (0)