Bug 253206

Summary: Some fixes for the faultstatus testcase
Product: [Developer tools] valgrind Reporter: Christian Borntraeger <borntraeger>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 3.6 SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Bug Depends on:    
Bug Blocks: 243404    
Attachments: patch that changes two things in faultstatus
new verson

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
(http://git390.marist.edu/cgi-bin/gitweb.cgi?p=linux-2.6.git;a=commit;h=1ca39725f9f241493fc2735152f00dc64a6b2c16)
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.