Bug 283709

Summary: none/tests/faultstatus needs to account for page size
Product: [Developer tools] valgrind Reporter: Maynard Johnson <maynardj>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal CC: florian
Priority: NOR    
Version: 3.7 SVN   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch to fix this bug
A better patch to fix this bug

Description Maynard Johnson 2011-10-10 14:24:29 UTC
Created attachment 64389 [details]
Patch to fix this bug

I found that none/tests/faultstatus passes on a ppc64 system running SLES 10 SP3, but fails on a ppc64 system running SLES 11 SP1.  On SLES 10, the page size was 4K, so the FILESIZE and MAPSIZE macros were larger than page size.  This made test3() work as expected -- getting a SIGBUS when attempting to access the mapping at 'FILESIZE + 10'.  However, on SLES 11 SP1, the page size is 64K, so the FILESIZE and MAPSIZE macros were *smaller* than the page size.  Thus, accesses to the mapping at 'FILESIZE + 10' were still within the page of memory that was assigned and zeroed out for that mapping and do NOT result in SIGBUS.  Refer to the man page for mmap:

"A file is mapped in multiples of the page size.  For a file that is not a multiple of the page size, the remaining memory is zeroed when mapped, and writes to that region are not written out to the file."
Comment 1 Maynard Johnson 2011-10-17 18:10:15 UTC
Created attachment 64643 [details]
A better patch to fix this bug

This version of the patch makes changes to the code so as not to alter line numbers that are referenced in *.stderr.exp files from other users of the faultstatus test (e.g., gdbserver_tests/mcsigpass).
Comment 2 Florian Krohm 2011-10-21 02:38:22 UTC
(In reply to comment #1)
> Created an attachment (id=64643) [details]
> A better patch to fix this bug
> 

Thanks for the patch. Applied as r12183.