Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1366574 - dyninst: Installs breakpoints even in read-only mode
Summary: dyninst: Installs breakpoints even in read-only mode
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: dyninst
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Stan Cox
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-12 11:20 UTC by Florian Weimer
Modified: 2017-08-08 16:30 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-08 16:30:06 UTC


Attachments (Terms of Use)
trace-only.cpp (deleted)
2016-08-12 11:56 UTC, Florian Weimer
no flags Details


Links
System ID Priority Status Summary Last Updated
Github dyninst dyninst issues 181 None None None 2016-09-20 19:50:57 UTC

Description Florian Weimer 2016-08-12 11:20:44 UTC
Description of problem:

Dyninst, even when using read-only interfaces, installs a breakpoint in the target process, on the _dl_debug_state function.

If the tracer crashes or exits abnormally, the breakpoint will persist, and the traced program may hit and crash as a result.  This means that it is impossible to write non-invasive tools using Dyninst at present.

Version-Release number of selected component (if applicable):

dyninst-9.1.0-5.fc24.x86_64

How reproducible:

Always.

Steps to Reproduce:
1. Compile the attached file and link it against Dyninst.
2. Run: strace -f -eptrace ./trace-only $$
3. Observe the use of PTRACE_POKETEXT

Actual results:

[pid 28892] ptrace(PTRACE_POKETEXT, 28832, 0x7fb297d2de80, 0x2e6666666666c3cc) = 0

Expected results:

No use of PTRACE_POKETEXT

Comment 1 Florian Weimer 2016-08-12 11:56:59 UTC
Created attachment 1190350 [details]
trace-only.cpp

Comment 2 Josh Stone 2016-08-12 18:58:37 UTC
You can turn off library tracking by default:

  #include <dyninst/PlatFeatures.h>
  ...
  {
    Dyninst::ProcControlAPI::LibraryTracking::setDefaultTrackLibraries(false);
  }

Then for a given Process, you can refresh manually with:

    proc->getLibraryTracking()->refreshLibraries();

Does that suffice for you?

AFAICS the various "tracking" APIs are not discussed at all in proccontrol.pdf though, so that's probably worth raising upstream.

Comment 3 Florian Weimer 2016-08-15 14:46:20 UTC
A global variable?  Not really nice, but it works for me.

Comment 4 Florian Weimer 2016-09-05 10:05:25 UTC
Sorry, it seems that

  Dyninst::ProcControlAPI::LibraryTracking::setDefaultTrackLibraries(false);

at the start of the program is not fully effective.  I still see

30217 ptrace(PTRACE_PEEKTEXT, 28519, 0x7fb3508500a0, [0x2e6666666666c3f3]) = 0
30217 ptrace(PTRACE_POKETEXT, 28519, 0x7fb3508500a0, 0x2e6666666666c3cc) = 0

with it.  This is not related to library tracking, but something else.  GDB shows this as the location of the crash:

Dump of assembler code for function __nptl_create_event:
   0x00007fb3508500a0 <+0>:	int3   
=> 0x00007fb3508500a1 <+1>:	retq   

Looking at the Dyninst sources, this does not appear to be optional.

(The Dyninst manual could also be a bit more explicit and describe how to deallocate a Process object so that the traced process does not crash later on.)

Comment 5 Josh Stone 2016-09-20 19:50:58 UTC
Those new breakpoints are coming from thread_db_process::initThreadDB() for TD_CREATE and TD_DESTROY events.

I filed an upstream bug about wanting a true read-only mode.
https://github.com/dyninst/dyninst/issues/181

Comment 6 Josh Stone 2016-10-04 22:35:02 UTC
As just pointed out in upstream 181, there actually is a control for threads too:

  Dyninst::ProcControlAPI::ThreadTracking::setDefaultTrackThreads(false);

And manual refresh is similarly:

  proc->getThreadTracking()->refreshThreads();

I'm not sure how we both overlooked that.  It seems to work for me -- I now see no calls to ptrace(PTRACE_POKETEXT,...) nor to process_vm_writev(...).

Comment 7 Fedora Admin XMLRPC Client 2017-05-15 19:58:41 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 8 Fedora End Of Life 2017-07-25 22:24:12 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 9 Fedora End Of Life 2017-08-08 16:30:06 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.