Skip to content

Commit

Permalink
Add proccontrol/src/linux.C
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Apr 3, 2024
1 parent 89e4c51 commit 8fc103f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
22 changes: 22 additions & 0 deletions docs/proccontrol/developer/linux.h.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ linux.h
.. cpp:function:: virtual bool plat_create_int()
.. cpp:function:: virtual bool plat_attach(bool allStopped, bool &)
.. cpp:function:: virtual bool plat_attachThreadsSync()

Attach any new threads and synchronize, until there are no new threads.

.. cpp:function:: virtual bool plat_attachWillTriggerStop()
.. cpp:function:: virtual bool plat_forked()
.. cpp:function:: virtual bool plat_execed()
Expand Down Expand Up @@ -205,5 +208,24 @@ linux.h
.. cpp:function:: void getEventTypesHandled(std::vector<EventType> &etypes)


.. cpp:function:: static void warn_user_ptrace_restrictions()

Ubuntu 10.10 and other hardened systems do not allow arbitrary ptrace_attaching; instead
you may only attach to a child process (https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening)
We can detect this and warn the user; however, it takes root to disable it.


.. cpp:struct:: linux_x86_user_desc

Copied from ``/usr/include/asm/ldt.h``, as it was not available on all machines.

.. cpp:member:: unsigned int entry_number
.. cpp:member:: unsigned long base_addr
.. cpp:member:: unsigned int limit
.. cpp:member:: unsigned int seg_32bit:1
.. cpp:member:: unsigned int contents:2
.. cpp:member:: unsigned int read_exec_only:1
.. cpp:member:: unsigned int limit_in_pages:1
.. cpp:member:: unsigned int seg_not_present:1
.. cpp:member:: unsigned int useable:1

8 changes: 0 additions & 8 deletions proccontrol/src/linux.C
Original file line number Diff line number Diff line change
Expand Up @@ -953,11 +953,6 @@ bool linux_process::plat_getOSRunningStates(std::map<Dyninst::LWP, bool> &runnin
return true;
}

// Ubuntu 10.10 and other hardened systems do not allow arbitrary ptrace_attaching; instead
// you may only attach to a child process (https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening)
//
// We can detect this and warn the user; however, it takes root to disable it.

#include <fstream>

static void warn_user_ptrace_restrictions() {
Expand Down Expand Up @@ -1024,7 +1019,6 @@ bool linux_process::plat_attach(bool, bool &)
return true;
}

// Attach any new threads and synchronize, until there are no new threads
bool linux_process::plat_attachThreadsSync()
{
while (true) {
Expand Down Expand Up @@ -1213,7 +1207,6 @@ Dyninst::Architecture linux_ppc_process::getTargetArch()
return arch;
}

//steve: added
linux_arm_process::linux_arm_process(Dyninst::PID p, std::string e, std::vector<std::string> a,
std::vector<std::string> envp, std::map<int,int> f) :
int_process(p, e, a, envp, f),
Expand Down Expand Up @@ -2952,7 +2945,6 @@ bool linux_thread::thrdb_getThreadArea(int val, Dyninst::Address &addr)
return true;
}

//Copied from /usr/include/asm/ldt.h, as it was not available on all machines
struct linux_x86_user_desc {
unsigned int entry_number;
unsigned long base_addr;
Expand Down

0 comments on commit 8fc103f

Please sign in to comment.