Bug 283709 - none/tests/faultstatus needs to account for page size
Summary: none/tests/faultstatus needs to account for page size
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.7 SVN
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-10 14:24 UTC by Maynard Johnson
Modified: 2011-10-21 02:38 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch to fix this bug (815 bytes, patch)
2011-10-10 14:24 UTC, Maynard Johnson
Details
A better patch to fix this bug (1.00 KB, patch)
2011-10-17 18:10 UTC, Maynard Johnson
Details

Note You need to log in before you can comment on or make changes to 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.