mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Luca Falavigna <dktrkranz@gmail.com>
Cc: prasanna@in.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Kprobes: Verify probepoint in register_jprobe()
Date: Wed, 29 Jun 2005 11:31:39 -0700	[thread overview]
Message-ID: <20050629113139.533aea7d.akpm@osdl.org> (raw)
In-Reply-To: <42C2BD26.7090209@gmail.com>

Luca Falavigna <dktrkranz@gmail.com> wrote:
>
> This patch, built against version 2.6.12, checks if probepoint address is a
> function entry point using an offset value, obtained from kallsyms_lookup().
> If offset is zero, we register jprobe, otherwise we return -EINVAL.
> 

a) kallsyms holds symbols other than just function names.

b) This won't work with CONFIG_KALLSYMS=n

> 
> --- ./kernel/kprobes.c.orig	2005-06-29 00:17:43.000000000 +0000
> +++ ./kernel/kprobes.c	2005-06-29 11:08:02.000000000 +0000
> @@ -33,6 +33,7 @@
>  #include <linux/hash.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
> +#include <linux/kallsyms.h>
>  #include <asm/cacheflush.h>
>  #include <asm/errno.h>
>  #include <asm/kdebug.h>
> @@ -245,7 +246,15 @@ static struct notifier_block kprobe_exce
> 
>  int register_jprobe(struct jprobe *jp)
>  {
> -	/* Todo: Verify probepoint is a function entry point */
> +	unsigned long size, offset;
> +	char *modname, namebuf[KSYM_NAME_LEN+1];
> +	
> +	kallsyms_lookup((unsigned long)jp->kp.addr, &size,
> +			&offset, &modname, namebuf);
> +	
> +	if(unlikely(offset))
> +		return -EINVAL;
> +	
>  	jp->kp.pre_handler = setjmp_pre_handler;
>  	jp->kp.break_handler = longjmp_break_handler;
> 


  reply	other threads:[~2005-06-29 18:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-29 15:24 Luca Falavigna
2005-06-29 18:31 ` Andrew Morton [this message]
2005-06-30 14:13 ` Paulo Marques

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=20050629113139.533aea7d.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dktrkranz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanna@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

all inboxes | Powered by JetHome®