From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7892 invoked by alias); 11 Nov 2008 20:57:35 -0000 Received: (qmail 7854 invoked by uid 22791); 11 Nov 2008 20:57:35 -0000 X-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_20,J_CHICKENPOX_53,KAM_MX,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Nov 2008 20:56:45 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id mABKuPvp008996 for ; Tue, 11 Nov 2008 15:56:38 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mABKuPn9014563 for ; Tue, 11 Nov 2008 15:56:25 -0500 Received: from [10.16.3.219] (dhcp-100-3-219.bos.redhat.com [10.16.3.219]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id mABKuNZZ005032; Tue, 11 Nov 2008 15:56:24 -0500 Message-ID: <4919F159.6090706@redhat.com> Date: Tue, 11 Nov 2008 20:57:00 -0000 From: Masami Hiramatsu User-Agent: Thunderbird 2.0.0.16 (X11/20080723) MIME-Version: 1.0 To: Andrew Morton CC: Ananth N Mavinakayanahalli , Jim Keniston , David Miller , Rusty Russell , LKML , systemtap-ml Subject: [PATCH 0/7] kprobes: Support probing __init and __exit functions in modules X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 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: 2008-q4/txt/msg00319.txt.bz2 Hi, This series of patches allows kprobes to probe module's __init and __exit functions. This means, you can probe driver initialization and terminating. Currently, kprobes can't probe __init function because these functions are freed after module initialization. And it also can't probe module __exit functions because kprobe increments reference count of target module and user can't unload it. this means __exit functions never be called unless removing probes from the module. To solve both cases, this series of patches introduces GONE flag and sets it when the target code is freed(for this purpose, kprobes hooks MODULE_STATE_* events). This also removes refcount incrementing for allowing user to unload target module. Users can check which probes are GONE by debugfs interface. For taking timing of freeing module's .init text, these also include a patch which adds module's notifier of MODULE_STATE_LIVE event. This series of patches can be applied after applying below patches on 2.6.28-rc4. http://lkml.org/lkml/2008/11/6/236 http://lkml.org/lkml/2008/11/5/346 Thank you, Documentation/kprobes.txt | 5 arch/arm/kernel/kprobes.c | 2 arch/ia64/kernel/kprobes.c | 8 - arch/powerpc/kernel/kprobes.c | 7 - arch/s390/kernel/kprobes.c | 7 - arch/x86/kernel/kprobes.c | 7 - include/linux/kprobes.h | 15 +- include/linux/module.h | 12 + kernel/kprobes.c | 260 ++++++++++++++++++++++++++---------------- kernel/module.c | 27 +--- 10 files changed, 220 insertions(+), 130 deletions(-) -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America) Inc. Software Solutions Division e-mail: mhiramat@redhat.com