[KCrash] Establish socket to allow change of ptracer

Authored by croick on Jan 25 2019, 8:56 AM.

Description

[KCrash] Establish socket to allow change of ptracer

Summary:

  • On Linux recent kernels only allow attaching a debugger to a process, if
    • the right to attach to processes is enabled system-wide
    • the debugger is an ancestor of the debuggee
    • or the debuggee sets a tracer process by a call to prctl(PR_SET_PTRACER, debugger_pid, 0, 0, 0);
  • also see bug 245529
  • If DrKonqi suggests debugging the crashed application with an external debugger, this right should be transferred to the debugger by the debuggee.
  • The patch opens a socket connection which allows DrKonqi to request a transfer of this right to the debugger.

Test Plan:

  • try to attach gdb or KDevelop to the process by using the debug button: operation will not be permitted
  • apply corresponding patches to KCrash and DrKonqi D11235
  • the process can now be debugged
  • after detaching the debugger again, a backtrace can be created using the DrKonqi dialog as usual

Reviewers: Frameworks, ossi

Reviewed By: ossi

Subscribers: dfaure, lepagevalleeemmanuel, kde-frameworks-devel, sitter

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D11236

Details