mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Werner Almesberger <wa@almesberger.net>
To: Richard J Moore <richardj_moore@uk.ibm.com>
Cc: Rob Landley <landley@trommello.org>,
	linux-kernel@vger.kernel.org,
	S Vamsikrishna <vamsi_krishna@in.ibm.com>
Subject: Re: 2.4 Ready list - Kernel Hooks
Date: Wed, 23 Oct 2002 16:50:09 -0300	[thread overview]
Message-ID: <20021023165009.I1421@almesberger.net> (raw)
In-Reply-To: <OF4A3346AB.B9CBFE3E-ON80256C5B.005B118D@portsmouth.uk.ibm.com>; from richardj_moore@uk.ibm.com on Wed, Oct 23, 2002 at 05:47:11PM +0100

Richard J Moore wrote:
>>EXPORT_SYMBOL_GPL.
> 
> We already do that.

Oops, missed that one, sorry ! I was looking at the interface
functions, but making the hooks themselves GPL-only is even
better.

> I don't envisage having an arbitrary set of hook points scattered
> throughout the kernel.

Let's hope you're right :-)

But wouldn't a small extension of kprobes get you pretty much
the same functionality/performance:

- at busy attachment points, add a "kprobe anchor", which
  translates to five NOPs [1,2], preceded by a global symbol
- when setting a kprobe, check if the five bytes starting
  at p->addr are NOPs [3]
- if yes, insert a call to kprobes_fastpath. if not, use
  the current double breakpoint mechanism
- kprobes_fastpath can just return to the caller, no code
  modification or single-stepping required

[1] Assuming i386.
[2] Or any sufficiently unlikely sequence of instructions that
    executes faster than NOPs.
[3] Or some other pattern - but a quick look at the kernel binary
    suggests that all strings of five or more NOPs are used for
    padding between function, so it would be safe to assume that
    any such sequence is a basic block.

The advantage over hooks would be that users of this mechanism
wouldn't have to choose between fast but intrusive (hooks) and
slow but flexible (probes).

Now, it's non-trivial to do a "return from caller" with
[kd]probes. I haven't looked at that part yet. Do you have the
infrastructure for this ?

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina         wa@almesberger.net /
/_http://www.almesberger.net/____________________________________________/

  reply	other threads:[~2002-10-23 19:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-23 16:47 Richard J Moore
2002-10-23 19:50 ` Werner Almesberger [this message]
2002-10-24  7:38   ` Vamsi Krishna S .
2002-10-24 17:22     ` Werner Almesberger
  -- strict thread matches above, loose matches on Subject: below --
2002-10-24 16:38 Richard J Moore
2002-10-24 17:02 ` Greg KH
2002-10-23  8:10 Richard J Moore
2002-10-23 17:09 ` Greg KH
2002-10-22 23:09 Richard J Moore
2002-10-22 23:54 ` Greg KH
2002-10-23 15:28 ` Werner Almesberger
2002-10-23 16:21   ` Karim Yaghmour
2002-10-21 12:24 Richard J Moore
2002-10-22 21:02 ` Werner Almesberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021023165009.I1421@almesberger.net \
    --to=wa@almesberger.net \
    --cc=landley@trommello.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richardj_moore@uk.ibm.com \
    --cc=vamsi_krishna@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome