summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>2013-03-28 11:40:16 +0400
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>2013-03-28 12:47:31 +0400
commite40586aab17b20dd097678107fb15313d122e918 (patch)
tree4313938b1721e58ff7242c1c8095bb94a8150e43
parentc81377136240ec005c34a6724e55fee32ee4f629 (diff)
downloadswap-modules-e40586aab17b20dd097678107fb15313d122e918.tar.gz
swap-modules-e40586aab17b20dd097678107fb15313d122e918.tar.bz2
swap-modules-e40586aab17b20dd097678107fb15313d122e918.zip
[REFACTOR] rename and move arch_disarm_uprobe()
rename: arch_disarm_uprobe() --> disarm_uprobe() move: from src/modules/kprobe/arch/dbi_kprobes.c to src/modules/uprobe/swap_uprobes.c
-rw-r--r--driver/Makefile.am4
-rw-r--r--driver/sspt/sspt.h3
-rw-r--r--kprobe/arch/dbi_kprobes.c8
-rw-r--r--kprobe/arch/dbi_kprobes.h1
-rw-r--r--kprobe/dbi_kprobes.c6
-rw-r--r--uprobe/arch/asm-arm/swap_uprobes.c4
-rw-r--r--uprobe/swap_uprobes.c12
-rw-r--r--uprobe/swap_uprobes.h2
8 files changed, 20 insertions, 20 deletions
diff --git a/driver/Makefile.am b/driver/Makefile.am
index eead5418..730fdde9 100644
--- a/driver/Makefile.am
+++ b/driver/Makefile.am
@@ -33,7 +33,9 @@ driver_module_dir = $(realpath $(srcdir))
module_name = swap_driver
cross_compiler = $(subst gcc,,$(CC))
-inlude_opt = -I$(realpath $(top_srcdir)/src/modules/ksyms) -I$(realpath $(top_srcdir)/src/common) -I$(realpath $(top_srcdir)/src/profile) -I$(realpath $(top_srcdir)/src/modules/kprobe)
+inlude_opt = -I$(realpath $(top_srcdir)/src/modules/ksyms) -I$(realpath $(top_srcdir)/src/common) \
+ -I$(realpath $(top_srcdir)/src/profile) -I$(realpath $(top_srcdir)/src/modules/kprobe) \
+ -I$(realpath $(top_srcdir)/src/modules/uprobe)
extra_cflags = "$(inlude_opt) -DEC_ARCH_$(ARCH) -D__DEBUG $(memchecker) $(debug_opt) $(android_opt) $(slp_opt) $(android_app_opt) $(board_opt)"
#bin_SCRIPTS = patchko.sh insmod.sh
diff --git a/driver/sspt/sspt.h b/driver/sspt/sspt.h
index cdf0eaae..ef49cf8b 100644
--- a/driver/sspt/sspt.h
+++ b/driver/sspt/sspt.h
@@ -31,6 +31,7 @@
#include "sspt_procs.h"
#include "sspt_debug.h"
#include "../us_proc_inst.h"
+#include <swap_uprobes.h>
#include "../storage.h"
@@ -114,7 +115,7 @@ static inline int unregister_usprobe_my(struct task_struct *task, struct us_ip *
err = unregister_usprobe(task, ip, 1, 1);
break;
case US_DISARM:
- arch_disarm_uprobe(&ip->jprobe.kp, task);
+ disarm_uprobe(&ip->jprobe.kp, task);
break;
default:
panic("incorrect value flag=%d", flag);
diff --git a/kprobe/arch/dbi_kprobes.c b/kprobe/arch/dbi_kprobes.c
index fedd956f..f00f0f3a 100644
--- a/kprobe/arch/dbi_kprobes.c
+++ b/kprobe/arch/dbi_kprobes.c
@@ -82,14 +82,6 @@ void arch_remove_uprobe(struct kprobe *p, struct task_struct *task)
}
EXPORT_SYMBOL_GPL(arch_remove_uprobe);
-void arch_disarm_uprobe (struct kprobe *p, struct task_struct *tsk)
-{
- if (!write_proc_vm_atomic (tsk, (unsigned long) p->addr, &p->opcode, sizeof (p->opcode))) {
- panic ("failed to write memory: tgid=%u, addr=%p!\n", tsk->tgid, p->addr);
- }
-}
-EXPORT_SYMBOL_GPL(arch_disarm_uprobe);
-
int arch_init_module_dependencies(void)
{
int ret;
diff --git a/kprobe/arch/dbi_kprobes.h b/kprobe/arch/dbi_kprobes.h
index 9c660930..6fc4636f 100644
--- a/kprobe/arch/dbi_kprobes.h
+++ b/kprobe/arch/dbi_kprobes.h
@@ -71,7 +71,6 @@ extern int arch_prepare_kprobe (struct kprobe *p);
extern int arch_prepare_kretprobe (struct kretprobe *p);
extern void arch_arm_kprobe (struct kprobe *p);
extern void arch_disarm_kprobe (struct kprobe *p);
-extern void arch_disarm_uprobe (struct kprobe *p, struct task_struct *tsk);
extern int arch_init_kprobes (void);
extern void dbi_arch_exit_kprobes (void);
extern int patch_suspended_task(struct kretprobe *rp, struct task_struct *tsk);
diff --git a/kprobe/dbi_kprobes.c b/kprobe/dbi_kprobes.c
index c805548e..02438992 100644
--- a/kprobe/dbi_kprobes.c
+++ b/kprobe/dbi_kprobes.c
@@ -549,11 +549,7 @@ valid_p:
(p->list.next == &old_p->list) && (p->list.prev == &old_p->list)))
{
/* Only probe on the hash list */
- DBPRINTF ("dbi_unregister_kprobe disarm pid=%d", pid);
- if (pid)
- arch_disarm_uprobe (p, task);//vma, page, kaddr);
- else
- arch_disarm_kprobe (p);
+ arch_disarm_kprobe(p);
hlist_del_rcu (&old_p->hlist);
cleanup_p = 1;
}
diff --git a/uprobe/arch/asm-arm/swap_uprobes.c b/uprobe/arch/asm-arm/swap_uprobes.c
index 689b6837..9cf028d2 100644
--- a/uprobe/arch/asm-arm/swap_uprobes.c
+++ b/uprobe/arch/asm-arm/swap_uprobes.c
@@ -718,7 +718,7 @@ static int check_validity_insn(struct kprobe *p, struct pt_regs *regs, struct ta
printk("Error in %s at %d: we are in thumb mode (!) and check instruction was fail \
(%0lX instruction at %p address)!\n", __FILE__, __LINE__, p->opcode, p->addr);
// Test case when we do our actions on already running application
- arch_disarm_uprobe(p, task);
+ disarm_uprobe(p, task);
return -1;
}
} else {
@@ -731,7 +731,7 @@ static int check_validity_insn(struct kprobe *p, struct pt_regs *regs, struct ta
printk("Error in %s at %d: we are in arm mode (!) and check instruction was fail \
(%0lX instruction at %p address)!\n", __FILE__, __LINE__, p->opcode, p->addr);
// Test case when we do our actions on already running application
- arch_disarm_uprobe(p, task);
+ disarm_uprobe(p, task);
return -1;
}
}
diff --git a/uprobe/swap_uprobes.c b/uprobe/swap_uprobes.c
index e773deb6..71558237 100644
--- a/uprobe/swap_uprobes.c
+++ b/uprobe/swap_uprobes.c
@@ -239,6 +239,14 @@ static void arm_uprobe(struct kprobe *p, struct task_struct *task)
}
}
+void disarm_uprobe(struct kprobe *p, struct task_struct *task)
+{
+ if (!write_proc_vm_atomic (task, (unsigned long) p->addr, &p->opcode, sizeof (p->opcode))) {
+ panic("disarm_uprobe: failed to write memory: tgid=%u, addr=%p!\n", task->tgid, p->addr);
+ }
+}
+EXPORT_SYMBOL_GPL(disarm_uprobe);
+
static void init_uprobes_insn_slots(void)
{
int i;
@@ -441,7 +449,7 @@ valid_p:
if ((old_p == p) || ((old_p->pre_handler == aggr_pre_uhandler) &&
(p->list.next == &old_p->list) && (p->list.prev == &old_p->list))) {
/* Only probe on the hash list */
- arch_disarm_uprobe(p, task);
+ disarm_uprobe(p, task);
hlist_del_rcu(&old_p->hlist);
cleanup_p = 1;
} else {
@@ -725,7 +733,7 @@ void dbi_unregister_uretprobe(struct task_struct *task, struct kretprobe *rp, in
} else {
DBPRINTF ("initiating deferred retprobe deletion addr %p", rp->kp.addr);
printk ("initiating deferred retprobe deletion addr %p\n", rp->kp.addr);
- arch_disarm_uprobe(&rp->kp, task);
+ disarm_uprobe(&rp->kp, task);
rp2->disarm = 1;
}
/*
diff --git a/uprobe/swap_uprobes.h b/uprobe/swap_uprobes.h
index 8de84fb7..99f5bf82 100644
--- a/uprobe/swap_uprobes.h
+++ b/uprobe/swap_uprobes.h
@@ -43,4 +43,6 @@ void dbi_unregister_all_uprobes(struct task_struct *task, int atomic);
void dbi_uprobe_return(void);
struct kprobe *get_uprobe(kprobe_opcode_t *addr, pid_t tgid);
+void disarm_uprobe(struct kprobe *p, struct task_struct *task);
+
#endif /* _DBI_UPROBES_H */