From acc090b03adf05efdef455500b2d5c876b01e3d6 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 7 Apr 2015 20:43:55 +0000 Subject: [PATCH] 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 --- coregrind/m_aspacemgr/aspacemgr-linux.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index 48bd2b3341..d32a048326 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -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 -- 2.47.3