aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/events/uprobes.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2012-11-24 12:51:34 -0500
committerOleg Nesterov <oleg@redhat.com>2013-02-08 11:47:08 -0500
commitd4d3ccc6d1eb74bd315d49a3829c5ad6c48d21b0 (patch)
treee8ccc45b9b9f8c72aaea150bf93d4d56cf9dc8d4 /kernel/events/uprobes.c
parentbb929284be40cbbdb347690742557d708fd504a9 (diff)
uprobes: Kill uprobe->copy_mutex
Now that ->register_rwsem is safe under ->mmap_sem we can kill ->copy_mutex and abuse down_write(&uprobe->consumer_rwsem). This makes prepare_uprobe() even more ugly, but we should kill it anyway. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/events/uprobes.c')
-rw-r--r--kernel/events/uprobes.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 7ec2eb278634..40ced98b2bc8 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -91,7 +91,6 @@ struct uprobe {
91 atomic_t ref; 91 atomic_t ref;
92 struct rw_semaphore register_rwsem; 92 struct rw_semaphore register_rwsem;
93 struct rw_semaphore consumer_rwsem; 93 struct rw_semaphore consumer_rwsem;
94 struct mutex copy_mutex; /* TODO: kill me and UPROBE_COPY_INSN */
95 struct list_head pending_list; 94 struct list_head pending_list;
96 struct uprobe_consumer *consumers; 95 struct uprobe_consumer *consumers;
97 struct inode *inode; /* Also hold a ref to inode */ 96 struct inode *inode; /* Also hold a ref to inode */
@@ -450,7 +449,6 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset)
450 uprobe->offset = offset; 449 uprobe->offset = offset;
451 init_rwsem(&uprobe->register_rwsem); 450 init_rwsem(&uprobe->register_rwsem);
452 init_rwsem(&uprobe->consumer_rwsem); 451 init_rwsem(&uprobe->consumer_rwsem);
453 mutex_init(&uprobe->copy_mutex);
454 /* For now assume that the instruction need not be single-stepped */ 452 /* For now assume that the instruction need not be single-stepped */
455 __set_bit(UPROBE_SKIP_SSTEP, &uprobe->flags); 453 __set_bit(UPROBE_SKIP_SSTEP, &uprobe->flags);
456 454
@@ -578,7 +576,8 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
578 if (test_bit(UPROBE_COPY_INSN, &uprobe->flags)) 576 if (test_bit(UPROBE_COPY_INSN, &uprobe->flags))
579 return ret; 577 return ret;
580 578
581 mutex_lock(&uprobe->copy_mutex); 579 /* TODO: move this into _register, until then we abuse this sem. */
580 down_write(&uprobe->consumer_rwsem);
582 if (test_bit(UPROBE_COPY_INSN, &uprobe->flags)) 581 if (test_bit(UPROBE_COPY_INSN, &uprobe->flags))
583 goto out; 582 goto out;
584 583
@@ -602,7 +601,7 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
602 set_bit(UPROBE_COPY_INSN, &uprobe->flags); 601 set_bit(UPROBE_COPY_INSN, &uprobe->flags);
603 602
604 out: 603 out:
605 mutex_unlock(&uprobe->copy_mutex); 604 up_write(&uprobe->consumer_rwsem);
606 605
607 return ret; 606 return ret;
608} 607}