From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ananth N Mavinakayanahalli Subject: Re: [PATCH -tip 4/6 V4] x86: kprobes checks safeness of insertion address. Date: Fri, 3 Apr 2009 10:48:54 +0530 Message-ID: <20090403051854.GA4846@in.ibm.com> References: <49D4F4E9.2030809@redhat.com> Reply-To: ananth@in.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Ingo Molnar , Jim Keniston , LKML , systemtap-ml , kvm@vger.kernel.org, Andi Kleen , Andrew Morton , Arnaldo Carvalho de Melo , Steven Rostedt , Frederic Weisbecker To: Masami Hiramatsu Return-path: Received: from e31.co.us.ibm.com ([32.97.110.149]:35236 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751964AbZDCFTO (ORCPT ); Fri, 3 Apr 2009 01:19:14 -0400 Content-Disposition: inline In-Reply-To: <49D4F4E9.2030809@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Apr 02, 2009 at 01:24:57PM -0400, Masami Hiramatsu wrote: > +/* Recover original instruction */ > +static int recover_probed_instruction(kprobe_opcode_t *buf, unsigned long addr) > +{ > + struct kprobe *kp; > + kp = get_kprobe((void *)addr); > + if (!kp) > + return -EINVAL; > + > + /* Don't use p->ainsn.insn; which will be modified by fix_riprel */ > + memcpy(buf, kp->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); > + buf[0] = kp->opcode; > + return 0; > +} > + > +/* Dummy buffers for lookup_symbol_attrs */ > +static char __dummy_buf[KSYM_NAME_LEN]; > + > +/* Check whether the address can be probed */ > +static int __kprobes can_probe(unsigned long paddr) A better description would've been "Check if paddr is at an instruction boundary". Otherwise looks good. Ananth