Bug 308886 - Missing support for PTRACE_SET/GETREGSET
Summary: Missing support for PTRACE_SET/GETREGSET
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-23 16:46 UTC by Andreas Arnez
Modified: 2013-03-04 07:52 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proposed regset support patch (4.61 KB, patch)
2012-10-23 16:58 UTC, Andreas Arnez
Details
Test case for PTRACE_GETREGSET (1.17 KB, text/x-csrc)
2012-10-25 13:59 UTC, Andreas Arnez
Details
Updated test case without "random" output (1.37 KB, text/x-csrc)
2012-11-08 09:19 UTC, Andreas Arnez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Arnez 2012-10-23 16:46:56 UTC
memcheck doesn't recognize the fact that a ptrace call with PRACE_GETREGSET has written into the given target memory buffer. Thus valgrind reports false positives for gdb, e.g. when using gdb's inferior function calls.

Reproducible: Always
Comment 1 Andreas Arnez 2012-10-23 16:58:05 UTC
Created attachment 74759 [details]
Proposed regset support patch

Proposed patch against mainline svn (r13080). The patch only fixes s390x (verified).
Comment 2 Christian Borntraeger 2012-10-25 07:03:07 UTC
Looks sane. Just in case, do you have a simple testcase other than gdb?
Comment 3 Andreas Arnez 2012-10-25 13:59:40 UTC
Created attachment 74793 [details]
Test case for PTRACE_GETREGSET

Here you go.

Notes:
- The program should be platform-independent, although only tested on s390x.
- The constant PTRACE_GETREGSET is hard-coded, to be independent of any system header files.
- With the fix, memcheck shouldn't yield any complaints.
- Only 'get' (not 'set') is tested.
Comment 4 Andreas Arnez 2012-11-08 09:19:51 UTC
Created attachment 75094 [details]
Updated test case without "random" output
Comment 5 Christian Borntraeger 2012-11-08 20:11:51 UTC
thanks. added the testcase (+minor fix that initializes c)and the s390 specific code
Comment 6 Christian Borntraeger 2012-11-08 20:28:55 UTC
also added x86 (tested) amd64 (untested) and arm(untested) handlers to ptrace.
ppc and mips dont seem to have ptrace support.

Julian, I would consider this fixed but I cant change the state of bugzillas
Comment 7 Florian Krohm 2012-11-08 23:03:28 UTC
Tested it on amd64. Works.
Comment 8 Florian Krohm 2012-11-09 04:22:23 UTC
Reopening because the test fails on s390 z10-ec.

florian@l005036:~/valgrind-patched/memcheck/tests/linux> ./getregset 
ptrace getregset: Input/output error
florian@l005036:~/valgrind-patched/memcheck/tests/linux> ../../../vg-in-place ./getregset
==9584== Memcheck, a memory error detector
==9584== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==9584== Using Valgrind-3.9.0.SVN and LibVEX; rerun with -h for copyright info
==9584== Command: ./getregset
==9584== 
ptrace getregset: Input/output error

uname -a
Linux l005036.zseriespenguins.ihost.com 2.6.9-42.EL #1 SMP Wed Jul 12 23:21:43 EDT 2006 s390x s390x s390x GNU/Linux
Comment 9 Christian Borntraeger 2012-11-09 08:11:34 UTC
On 09/11/12 05:22, Florian Krohm wrote:
> https://bugs.kde.org/show_bug.cgi?id=308886
> 
> Florian Krohm <britzel@acm.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|RESOLVED                    |REOPENED
>          Resolution|FIXED                       |---
>      Ever confirmed|0                           |1
> 
> --- Comment #8 from Florian Krohm <britzel@acm.org> ---
> Reopening because the test fails on s390 z10-ec.

Grrr, the old RHEL4 is really a PITA....but in fact, its actually a very good
sanity check.

Fixed.
Comment 10 Florian Krohm 2012-11-09 13:05:48 UTC
All right then. Fixed for good. Thanks.
Comment 11 Julian Seward 2013-03-03 12:06:48 UTC
Guessing that this was fixed with r13112, r13115.
Comment 12 Mark Wielaard 2013-03-03 15:17:42 UTC
FYI. The set of revisions that I backported to the fedora package for this was: r13110 r13111 r13112 r13113 r13115
Comment 13 Christian Borntraeger 2013-03-04 07:52:01 UTC
yes fixed by the given revisions . (I dont have the access rights to set bugzilla state).