From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1140 invoked by alias); 25 Jul 2007 14:13:02 -0000 Received: (qmail 1129 invoked by uid 22791); 25 Jul 2007 14:13:01 -0000 X-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME,DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: sourceware.org Received: from e5.ny.us.ibm.com (HELO e5.ny.us.ibm.com) (32.97.182.145) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 25 Jul 2007 14:12:55 +0000 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id l6PECoRN022792 for ; Wed, 25 Jul 2007 10:12:50 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v8.4) with ESMTP id l6PECmoR554034 for ; Wed, 25 Jul 2007 10:12:50 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l6PEClSv023696 for ; Wed, 25 Jul 2007 10:12:48 -0400 Received: from newton.in.ibm.com ([9.124.95.3]) by d01av02.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l6PECjVt023447; Wed, 25 Jul 2007 10:12:46 -0400 Received: by newton.in.ibm.com (Postfix, from userid 500) id 7FE38CE3; Wed, 25 Jul 2007 19:41:17 +0530 (IST) Date: Wed, 25 Jul 2007 15:22:00 -0000 From: "S. P. Prasanna" To: Srinivasa Ds Cc: linux-kernel@vger.kernel.org, Andrew Morton , ananth@in.ibm.com, anil.s.keshavamurthy@intel.com, jkenisto@us.ibm.com, systemtap@sources.redhat.com, suzuki@in.ibm.com Subject: Re: [RFC] [PATCH] To vunmap correct address in text_poke()(kprobes) Message-ID: <20070725141117.GA7254@in.ibm.com> Reply-To: prasanna@in.ibm.com References: <200707251221.49827.srinivasa@in.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200707251221.49827.srinivasa@in.ibm.com> User-Agent: Mutt/1.4.1i X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00180.txt.bz2 On Wed, Jul 25, 2007 at 12:21:49PM +0530, Srinivasa Ds wrote: > > When I was testing kprobes on x86_64 and I come across the below error message > on latest 2.6.23-rc1 kernel. > ========================================== > Trying to vfree() bad address (ffffc20002233199) > WARNING: at mm/vmalloc.c:330 __vunmap() > > Call Trace: > [] sys_gettimeofday+0x0/0x62 > [] text_poke+0x119/0x124 > [] arch_arm_kprobe+0x1c/0x21 > [] __register_kprobe+0x28a/0x2ed > [] :gettimeofday:kprobe_init+0x39/0x65 > [] sys_init_module+0x1626/0x1788 > [] dput+0x3f/0xfa > [] audit_syscall_entry+0x141/0x174 > [] tracesys+0xdc/0xe1 > > ====================================================== > > This indicates that vunmap() is not receving the page-aligned address in > text_poke(). So the below attached patch will address this issue. Please let > me know your comments. > > Signed-off-by: Srinivasa DS > Signed-off-by: Suzuki K P > > > Index: linux-2.6.23-rc1/arch/i386/kernel/alternative.c > =================================================================== > --- linux-2.6.23-rc1.orig/arch/i386/kernel/alternative.c 2007-07-23 > 02:11:00.000000000 +0530 > +++ linux-2.6.23-rc1/arch/i386/kernel/alternative.c 2007-07-25 > 11:45:53.000000000 +0530 > @@ -447,5 +447,5 @@ void __kprobes text_poke(void *oaddr, un > if (cpu_has_clflush) > asm("clflush (%0) " :: "r" (oaddr) : "memory"); > if (addr != oaddr) > - vunmap(addr); > + vunmap(addr-(((unsigned long)oaddr) % PAGE_SIZE)); It is appropriate to use PAGE_MASK rather than doing all this, as shown below. vunmap((u8 *)((unsigned long)addr & PAGE_MASK)); Thanks Prasanna -- Prasanna S.P. Linux Technology Center India Software Labs, IBM Bangalore Email: prasanna@in.ibm.com Ph: 91-80-41776329