Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752150Ab0GTE23 (ORCPT ); Tue, 20 Jul 2010 00:28:29 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:44707 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751593Ab0GTE22 (ORCPT ); Tue, 20 Jul 2010 00:28:28 -0400 Date: Tue, 20 Jul 2010 00:28:14 -0400 From: Christoph Hellwig To: Srikar Dronamraju Cc: Peter Zijlstra , Ingo Molnar , Steven Rostedt , Randy Dunlap , Arnaldo Carvalho de Melo , Linus Torvalds , Christoph Hellwig , Masami Hiramatsu , Ananth N Mavinakayanahalli , Oleg Nesterov , Mark Wielaard , Mathieu Desnoyers , LKML , Naren A Devaiah , Jim Keniston , Frederic Weisbecker , "Frank Ch. Eigler" , Andrew Morton , "Paul E. McKenney" Subject: Re: [PATCHv9 2.6.35-rc4-tip 2/13] uprobes: Breakpoint insertion/removal in user space applications. Message-ID: <20100720042814.GA13624@infradead.org> References: <20100712103214.27491.15142.sendpatchset@localhost6.localdomain6> <20100712103235.27491.293.sendpatchset@localhost6.localdomain6> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100712103235.27491.293.sendpatchset@localhost6.localdomain6> User-Agent: Mutt/1.5.20 (2009-08-17) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2437 Lines: 63 > +struct user_bkpt_arch_info { > + void (*set_ip)(struct pt_regs *regs, unsigned long vaddr); > + int (*validate_address)(struct task_struct *tsk, unsigned long vaddr); > + int (*read_opcode)(struct task_struct *tsk, unsigned long vaddr, > + user_bkpt_opcode_t *opcode); > + int (*set_bkpt)(struct task_struct *tsk, > + struct user_bkpt *user_bkpt); > + int (*set_orig_insn)(struct task_struct *tsk, > + struct user_bkpt *user_bkpt, bool check); > + bool (*is_bkpt_insn)(struct user_bkpt *user_bkpt); > + int (*analyze_insn)(struct task_struct *tsk, > + struct user_bkpt *user_bkpt); > + int (*pre_xol)(struct task_struct *tsk, > + struct user_bkpt *user_bkpt, > + struct user_bkpt_task_arch_info *tskinfo, > + struct pt_regs *regs); > + int (*post_xol)(struct task_struct *tsk, > + struct user_bkpt *user_bkpt, > + struct user_bkpt_task_arch_info *tskinfo, > + struct pt_regs *regs); > +}; Just wondering why these are function pointers. Do we exepect an architecture to provide different versions of these for say 32 vs 64-bit binaries? If not just making these arch provided helpers might be a lot simpler. Especially in the current version where only very few of these are overriden by the architecture at all. > +unsigned long uprobes_read_vm(struct task_struct *tsk, void __user *vaddr, > + void *kbuf, unsigned long nbytes) > +{ > + if (tsk == current) { > + unsigned long nleft = copy_from_user(kbuf, vaddr, nbytes); > + return nbytes - nleft; > + } else > + return access_process_vm(tsk, (unsigned long) vaddr, kbuf, > + nbytes, 0); > +} > + > +unsigned long uprobes_write_data(struct task_struct *tsk, > + void __user *vaddr, const void *kbuf, > + unsigned long nbytes) > +{ > + unsigned long nleft; > + > + if (tsk == current) { > + nleft = copy_to_user(vaddr, kbuf, nbytes); > + return nbytes - nleft; > + } else > + return access_process_vm(tsk, (unsigned long) vaddr, > + (void *) kbuf, nbytes, 1); > +} Any reason for the naming mismatch between _read_vm and _write_data? Also I wonder if the optimization for tsk == current should be folded directly into access_process_vm instead of adding these wrappers. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/