aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/uprobes.h
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-11-08 12:52:21 -0500
committerOleg Nesterov <oleg@redhat.com>2013-11-20 10:30:57 -0500
commit3247343118daa73f2b94b7fa565425d1d9f9ac84 (patch)
treedb1b65941295431fbbb5cc8d822c0ebe0e0b6757 /include/linux/uprobes.h
parentcaea6cf52139116e43e615d87fcbf9823e197fdf (diff)
uprobes: Add uprobe_task->dup_xol_work/dup_xol_addr
uprobe_task->vaddr is a bit strange. The generic code uses it only to pass the additional argument to arch_uprobe_pre_xol(), and since it is always equal to instruction_pointer() this looks even more strange. And both utask->vaddr and and utask->autask have the same scope, they only have the meaning when the task executes the probed insn out-of-line, so it is safe to reuse both in UTASK_RUNNING state. This all means that logically ->vaddr belongs to arch_uprobe_task and we should probably move it there, arch_uprobe_pre_xol() can record instruction_pointer() itself. OTOH, it is also used by uprobe_copy_process() and dup_xol_work() for another purpose, this doesn't look clean and doesn't allow to move this member into arch_uprobe_task. This patch adds the union with 2 anonymous structs into uprobe_task. The first struct is autask + vaddr, this way we "almost" move vaddr into autask. The second struct has 2 new members for uprobe_copy_process() paths: ->dup_xol_addr which can be used instead ->vaddr, and ->dup_xol_work which can be used to avoid kmalloc() and simplify the code. Note that this union will likely have another member(s), we need something like "private_data_for_handlers" so that the tracing handlers could use it to communicate with call_fetch() methods. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/uprobes.h')
-rw-r--r--include/linux/uprobes.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 319eae70fe84..2225542624de 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -26,6 +26,7 @@
26 26
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/rbtree.h> 28#include <linux/rbtree.h>
29#include <linux/types.h>
29 30
30struct vm_area_struct; 31struct vm_area_struct;
31struct mm_struct; 32struct mm_struct;
@@ -72,14 +73,24 @@ enum uprobe_task_state {
72 */ 73 */
73struct uprobe_task { 74struct uprobe_task {
74 enum uprobe_task_state state; 75 enum uprobe_task_state state;
75 struct arch_uprobe_task autask;
76 76
77 struct return_instance *return_instances; 77 union {
78 unsigned int depth; 78 struct {
79 struct uprobe *active_uprobe; 79 struct arch_uprobe_task autask;
80 unsigned long vaddr;
81 };
82
83 struct {
84 struct callback_head dup_xol_work;
85 unsigned long dup_xol_addr;
86 };
87 };
80 88
89 struct uprobe *active_uprobe;
81 unsigned long xol_vaddr; 90 unsigned long xol_vaddr;
82 unsigned long vaddr; 91
92 struct return_instance *return_instances;
93 unsigned int depth;
83}; 94};
84 95
85/* 96/*