lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081112065238.GB3081@in.ibm.com>
Date:	Wed, 12 Nov 2008 12:22:38 +0530
From:	Ananth N Mavinakayanahalli <ananth@...ibm.com>
To:	Masami Hiramatsu <mhiramat@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Jim Keniston <jkenisto@...ibm.com>,
	David Miller <davem@...emloft.net>,
	Rusty Russell <rusty@...tcorp.com.au>,
	LKML <linux-kernel@...r.kernel.org>,
	systemtap-ml <systemtap@...rces.redhat.com>
Subject: Re: [PATCH 5/7] kprobes: Remove called_from argument

On Tue, Nov 11, 2008 at 03:57:13PM -0500, Masami Hiramatsu wrote:
> Remove called_from argument from kprobes which had been used for preventing
> self-refering of kernel module. However, since we don't keep module's refcount
> after registering kprobe any more, there is no reason to check that.
> 
> This patch also simplifies registering/unregistering functions because we don't
> need to use __builtin_return_address(0) which was passed to called_from.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@...hat.com>
> ---
>  kernel/kprobes.c |   70 +++++++++++--------------------------------------------
>  1 file changed, 14 insertions(+), 56 deletions(-)
> 
> Index: 2.6.28-rc4/kernel/kprobes.c
> ===================================================================
> --- 2.6.28-rc4.orig/kernel/kprobes.c
> +++ 2.6.28-rc4/kernel/kprobes.c
> @@ -641,8 +641,7 @@ static kprobe_opcode_t __kprobes *kprobe
>  	return (kprobe_opcode_t *)(((char *)addr) + p->offset);
>  }
> 
> -static int __kprobes __register_kprobe(struct kprobe *p,
> -	unsigned long called_from)
> +int __kprobes register_kprobe(struct kprobe *p)
>  {
>  	int ret = 0;
>  	struct kprobe *old_p;
> @@ -673,13 +672,10 @@ static int __kprobes __register_kprobe(s
>  		 * We must hold a refcount of the probed module while updating
>  		 * its code to prohibit unexpected unloading.
>  		 */
> -		if (calling_mod != probed_mod) {
> -			if (unlikely(!try_module_get(probed_mod))) {
> -				preempt_enable();
> -				return -EINVAL;
> -			}
> -		} else
> -			probed_mod = NULL;
> +		if (unlikely(!try_module_get(probed_mod))) {
> +			preempt_enable();
> +			return -EINVAL;
> +		}

You also need the following to get this to compile, don't you?

Signed-off-by: Ananth N Mavinakayanahalli <ananth@...ibm.com>

Index: linux-2.6.28-rc4/kernel/kprobes.c
===================================================================
--- linux-2.6.28-rc4.orig/kernel/kprobes.c	2008-11-12 11:13:30.000000000 +0530
+++ linux-2.6.28-rc4/kernel/kprobes.c	2008-11-12 12:18:44.000000000 +0530
@@ -666,8 +666,6 @@
 	 */
 	probed_mod = __module_text_address((unsigned long) p->addr);
 	if (probed_mod) {
-		struct module *calling_mod;
-		calling_mod = __module_text_address(called_from);
 		/*
 		 * We must hold a refcount of the probed module while updating
 		 * its code to prohibit unexpected unloading.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ