Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759129AbZDCFTZ (ORCPT ); Fri, 3 Apr 2009 01:19:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752309AbZDCFTO (ORCPT ); Fri, 3 Apr 2009 01:19:14 -0400 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 Date: Fri, 3 Apr 2009 10:48:54 +0530 From: Ananth N Mavinakayanahalli To: Masami Hiramatsu Cc: Ingo Molnar , Jim Keniston , LKML , systemtap-ml , kvm@vger.kernel.org, Andi Kleen , Andrew Morton , Arnaldo Carvalho de Melo , Steven Rostedt , Frederic Weisbecker Subject: Re: [PATCH -tip 4/6 V4] x86: kprobes checks safeness of insertion address. Message-ID: <20090403051854.GA4846@in.ibm.com> Reply-To: ananth@in.ibm.com References: <49D4F4E9.2030809@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49D4F4E9.2030809@redhat.com> User-Agent: Mutt/1.5.16 (2007-06-09) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1035 Lines: 31 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 -- 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/