Bug 253206 - Some fixes for the faultstatus testcase
Summary: Some fixes for the faultstatus testcase
Alias: None
Product: valgrind
Classification: Unclassified
Component: general (show other bugs)
Version: 3.6 SVN
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Julian Seward
Depends on:
Blocks: 243404
  Show dependency treegraph
Reported: 2010-10-04 10:35 UTC by Christian Borntraeger
Modified: 2011-03-15 09:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:

patch that changes two things in faultstatus (918 bytes, patch)
2010-10-04 10:35 UTC, Christian Borntraeger
new verson (986 bytes, patch)
2010-10-18 14:35 UTC, Christian Borntraeger

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Borntraeger 2010-10-04 10:35:40 UTC
Created attachment 52212 [details]
patch that changes two things in faultstatus

Version:           3.6 SVN
OS:                Linux

The faultstatus testcase fails on s390, even without valgrind.
Two things I would like to change in the testcase:
1. The testcase opens the file without O_RDWR, resulting in the truncate below to (unnoticeably) fail:
open("faultstatus.tmp", O_RDONLY|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3
unlink("faultstatus.tmp")               = 0
ftruncate(3, 16384)                     = -1 EINVAL (Invalid argument)
 The access now triggers two faults: 1. beyond defined memory (SIGBUS), write on read-only-mapping (SIGSEGV), whatever comes first. On x86 this causes SIGBUS, but on s390 this causes SIGSEGV.
This patch uses O_RDWR to make the truncate succeed.
2. On s390 a page fault only gives us the page address, but not the address within a page. 0x1234 becomes 0x1000. There might be other architectures with the same problem.

Reproducible: Always

Question: Should that patch go in via the s390x patch or shall we add this fix directly (at least the failing trucate should be fixed)
Comment 1 Christian Borntraeger 2010-10-18 14:35:33 UTC
Created attachment 52650 [details]
new verson

The problem fault address vs. reported fault address also happens for test3.
Due to a kernel bug on s390 (si_code=128 instead of 2) this was not visible.
The kernel bug will be fixed in the next merge window
but we need the generalise the modifications of the fault address. Here is an improved patch.
Comment 2 Julian Seward 2011-03-15 09:13:50 UTC
Committed, r11644.