utrace core
Subsystems (6)
PATCH 7/7 utrace core
From: Roland McGrath <[email protected]>
This adds the utrace facility, a new modular interface in the kernel for implementing user thread tracing and debugging. This fits on top of the tracehook_* layer, so the new code is well-isolated.
The new interface is in <linux/utrace.h> and the DocBook utrace book describes it. It allows for multiple separate tracing engines to work in parallel without interfering with each other. Higher-level tracing facilities can be implemented as loadable kernel modules using this layer.
The new facility is made optional under CONFIG_UTRACE. It can only be enabled on machines that have all the prerequisites and select CONFIG_HAVE_ARCH_TRACEHOOK.
If CONFIG_UTRACE is set ptrace uses the utrace facilities, it can play nicely with other utrace-based things tracing the same threads.
---
Documentation/DocBook/Makefile | 2 Documentation/DocBook/utrace.tmpl | 590 +++++++++ fs/proc/array.c | 3 include/linux/sched.h | 5 include/linux/tracehook.h | 87 + include/linux/utrace.h | 692 ++++++++++ init/Kconfig | 9 kernel/Makefile | 1 kernel/fork.c | 3 kernel/utrace.c | 2443 ++++++++++++++++++++++++++++++++++++++ 10 files changed, 3833 insertions(+), 2 deletions(-)
Documentation/DocBook/Makefile renamed from Documentation/DocBook/Makefile~7_UTRACE +1 -1
@@ -14,7 +14,7 @@ DOCBOOKS := z8530book.xml mcabook.xml de genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \ mac80211.xml debugobjects.xml sh.xml regulator.xml \ alsa-driver-api.xml writing-an-alsa-driver.xml \ - tracepoint.xml media.xml + tracepoint.xml utrace.xml media.xml ### # The build process is as follows (targets):
Documentation/DocBook/utrace.tmpl new file +590 -0
590 lines not on this page · raw message
fs/proc/array.c renamed from fs/proc/array.c~7_UTRACE +3 -0
@@ -82,6 +82,7 @@#include <linux/pid_namespace.h> #include <linux/ptrace.h> #include <linux/tracehook.h> +#include <linux/utrace.h> #include <linux/swapops.h> #include <asm/pgtable.h>
@@ -189,6 +190,8 @@ static inline void task_state(struct seq cred->uid, cred->euid, cred->suid, cred->fsuid, cred->gid, cred->egid, cred->sgid, cred->fsgid); +task_utrace_proc_status (m, p); +task_lock (p);if (p->files) fdt =files_fdtable (p->files);
include/linux/sched.h renamed from include/linux/sched.h~7_UTRACE +5 -0
@@ -1396,6 +1396,11 @@ struct task_struct {#endif seccomp_t seccomp; +#ifdef CONFIG_UTRACE +struct utrace *utrace; +unsigned long utrace_flags; +#endif +/* Thread group tracking */ u32 parent_exec_id;u32 self_exec_id;
include/linux/tracehook.h renamed from include/linux/tracehook.h~7_UTRACE +86 -1
214 lines not on this page · raw message
include/linux/utrace.h new file +692 -0
692 lines not on this page · raw message
init/Kconfig renamed from init/Kconfig~7_UTRACE +9 -0
@@ -310,6 +310,15 @@ config AUDIT_TREE depends on AUDITSYSCALL select INOTIFY +config UTRACE + bool "Infrastructure for tracing and debugging user processes" + depends on EXPERIMENTAL + depends on HAVE_ARCH_TRACEHOOK + help + Enable the utrace process tracing interface. This is an internal + kernel interface exported to kernel modules, to track events in + user threads, extract and change user thread state. + menu "RCU Subsystem" choice
kernel/Makefile renamed from kernel/Makefile~7_UTRACE +1 -0
@@ -69,6 +69,7 @@ obj-$(CONFIG_IKCONFIG) += configs.o obj-$(CONFIG_RESOURCE_COUNTERS) += res_counter.o obj-$(CONFIG_STOP_MACHINE) += stop_machine.o obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o +obj-$(CONFIG_UTRACE) += utrace.o obj-$(CONFIG_UTRACE) += ptrace-utrace.o obj-$(CONFIG_AUDIT) += audit.o auditfilter.o audit_watch.o obj-$(CONFIG_AUDITSYSCALL) += auditsc.o
kernel/fork.c renamed from kernel/fork.c~7_UTRACE +3 -0
@@ -153,6 +153,7 @@ void free_task(struct task_struct *tsk)free_thread_info (tsk->stack);rt_mutex_debug_task_free (tsk);ftrace_graph_exit_task (tsk); +tracehook_free_task (tsk);free_task_struct (tsk); }EXPORT_SYMBOL (free_task);
@@ -1023,6 +1024,8 @@ static struct task_struct *copy_process(if (!p) goto fork_out; +tracehook_init_task (p); +ftrace_graph_init_task (p);rt_mutex_init_task (p);
kernel/utrace.c new file +2443 -0
1,433 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.