From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12857 invoked by alias); 30 Nov 2005 22:00:48 -0000 Received: (qmail 12851 invoked by uid 22791); 30 Nov 2005 22:00:48 -0000 X-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,DNS_FROM_RFC_POST X-Spam-Check-By: sourceware.org Received: from fmr18.intel.com (HELO orsfmr003.jf.intel.com) (134.134.136.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 30 Nov 2005 22:00:47 +0000 Received: from orsfmr100.jf.intel.com (orsfmr100.jf.intel.com [10.7.209.16]) by orsfmr003.jf.intel.com (8.12.10/8.12.10/d: major-outer.mc,v 1.1 2004/09/17 17:50:56 root Exp $) with ESMTP id jAUM0YXl017023; Wed, 30 Nov 2005 22:00:34 GMT Received: from orsmsxvs040.jf.intel.com (orsmsxvs040.jf.intel.com [192.168.65.206]) by orsfmr100.jf.intel.com (8.12.10/8.12.10/d: major-inner.mc,v 1.2 2004/09/17 18:05:01 root Exp $) with SMTP id jAULuNfI011922; Wed, 30 Nov 2005 22:00:31 GMT Received: from orsmsx331.amr.corp.intel.com ([192.168.65.56]) by orsmsxvs040.jf.intel.com (SAVSMTP 3.1.7.47) with SMTP id M2005113013165811336 ; Wed, 30 Nov 2005 13:17:01 -0800 Received: from orsmsx409.amr.corp.intel.com ([192.168.65.58]) by orsmsx331.amr.corp.intel.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 30 Nov 2005 13:16:56 -0800 X-MIMEOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: RE: module function probe Date: Wed, 30 Nov 2005 22:00:00 -0000 Message-ID: <44BDAFB888F59F408FAE3CC35AB47041027745C9@orsmsx409> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: module function probe Thread-Index: AcXxvPNyiekyyIyjT9GtH3/HG78VtAENE+bQ From: "Keshavamurthy, Anil S" To: "Frank Ch. Eigler" , "Mao, Bibo" Cc: X-OriginalArrivalTime: 30 Nov 2005 21:16:56.0221 (UTC) FILETIME=[6484CCD0:01C5F5F3] X-Scanned-By: MIMEDefang 2.52 on 10.7.209.16 X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2005-q4/txt/msg00304.txt.bz2 Please see my comments.=20 >-----Original Message----- >From: systemtap-owner@sourceware.org=20 >[mailto:systemtap-owner@sourceware.org] On Behalf Of Frank Ch. Eigler >Sent: Friday, November 25, 2005 4:37 AM >To: Mao, Bibo >Cc: systemtap@sources.redhat.com >Subject: Re: module function probe > >Hi - > >> I wrote one module named probed.ko after compiled, and the other >> is kprobe module named probing.ko which is to probe some function >> defined in probed.ko module.=20 >> [...] >> #insmod probed.ko >> #insmod probing.ko >> #rmmod probed.ko >> #rmmod probing.ko >> [...] > >To manage module reference counts in a way that prevents this problem, >systemtap keeps a file descriptor open on some file under >/sys/module//. By using plain insmod, you are giving up this >protection. I think we should implement this module reference count=20 logic built in the kernel kprobes code. Here is how it can be done. register_kprobe(...) {=20 ..... + if ((mod =3D module_text_address((unsigned long) p->addr))) + if (unlikely(!try_module_get(mod))) return -EINVAL; .... } Unregister_kprobe(...) { .... + module_put(module_text_address((unsigned long)p->addr)); ... } Opened a bugzilla http://sources.redhat.com/bugzilla/show_bug.cgi?id=3D1954 Cheers, Anil Keshavamurthy