Bug 6983 - support kmmio hooks
Summary: support kmmio hooks
Status: RESOLVED WONTFIX
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Elliott Baron
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-24 21:59 UTC by Frank Ch. Eigler
Modified: 2013-05-24 21:30 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2008-10-24 21:59:28 UTC
Recent kernels support a kprobe-like API for trapping MMIO operations.
See include/linux/mmiotrace.h, [un]register_kmmio_probe().
Possible syntax:

    probe kernel.mmio(0xaddr).length(0xsize)  { $addr }

There is also a *tracing* widget backend nearby for ftrace,
but it does not appear relevant to systemtap.


commit 8b7d89d02ef3c6a7c73d6596f28cea7632850af4
Author: Pekka Paalanen <pq@iki.fi>
Date:   Mon May 12 21:20:56 2008 +0200

    x86: mmiotrace - trace memory mapped IO
    
    Mmiotrace is a tool for trapping memory mapped IO (MMIO) accesses within
    the kernel. It is used for debugging and especially for reverse
    engineering evil binary drivers.
    
    Mmiotrace works by wrapping the ioremap family of kernel functions and
    marking the returned pages as not present. Access to the IO memory
    triggers a page fault, which will be handled by mmiotrace's custom page
    fault handler. This will single-step the faulted instruction with the
    MMIO page marked as present. Access logs are directed to user space via
    relay and debug_fs.
    
    This page fault approach is necessary, because binary drivers have
    readl/writel etc. calls inlined and therefore extremely difficult to
    trap with with e.g. kprobes.
Comment 1 Frank Ch. Eigler 2009-05-27 20:23:40 UTC
RFC code posted at http://sourceware.org/ml/systemtap/2009-q2/msg00598.html
Comment 2 Frank Ch. Eigler 2009-06-02 16:10:44 UTC
Since the proposed translator code looks all right, 
and the kernel-side kmmiotrace clients are way more
complicated, and since we can't seem to trigger any
events yet, let's sleep on this feature awhile and
try again in a few months.
Comment 3 Frank Ch. Eigler 2013-05-24 21:30:24 UTC
not really needed; the kernel.data() probes can to some extent substitute