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]
Date:	Fri, 30 May 2014 11:47:44 +0900
From:	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
To:	"Suzuki K. Poulose" <suzuki@...ibm.com>
Cc:	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Paul Mackerras <paulus@...ba.org>,
	Tony Luck <tony.luck@...il.com>,
	Jeremy Fitzhardinge <jeremy@...p.org>,
	linux-ia64@...r.kernel.org, sparse@...isli.org,
	"H. Peter Anvin" <hpa@...or.com>, akataria@...are.com,
	linux-tip-commits@...r.kernel.org, anil.s.keshavamurthy@...el.com,
	Ingo Molnar <mingo@...nel.org>,
	Fenghua Yu <fenghua.yu@...el.com>,
	Arnd Bergmann <arnd@...db.de>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Chris Wright <chrisw@...s-sol.org>,
	yrl.pp-manager.tt@...achi.com,
	Thomas Gleixner <tglx@...utronix.de>,
	Tony Luck <tony.luck@...el.com>,
	Kevin Hao <haokexin@...il.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	rdunlap@...radead.org,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	dl9pf@....de, Andrew Morton <akpm@...ux-foundation.org>,
	linuxppc-dev@...ts.ozlabs.org,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [RFT PATCH -next v2] [BUGFIX] kprobes: Fix "Failed to find blacklist"
 error on ia64 and ppc64

(2014/05/30 4:13), Suzuki K. Poulose wrote:
>> @@ -2042,7 +2043,8 @@ static int __init populate_kprobe_blacklist(unsigned long *start,
>>  	unsigned long offset = 0, size = 0;
>>  
>>  	for (iter = start; iter < end; iter++) {
>> -		if (!kallsyms_lookup_size_offset(*iter, &size, &offset)) {
>> +		if (!kallsyms_lookup_size_offset(function_entry(*iter),
>> +						 &size, &offset)) {
> 
> On powerpc we will be able to resolve the *iter to func_descr and won't
> get the below error with/without this patch. So we have to actually
> verify the kprobe_blacklist contents to make sure everything is alright.
> 
>>  			pr_err("Failed to find blacklist %p\n", (void *)*iter);
>>  			continue;
>>  		}
>>
> 
> There is a bug here.
> You need to set the ent->start using the function_entry(*iter) and not
> *iter. Or else you just avoid the 'Warning' and still have an invalid
> black list. As shown below :
> 
>     2e:mon> ls kprobe_blacklist
>     kprobe_blacklist: c00000000104dad0
>     2e:mon> d c00000000104dad0 10
>     c00000000104dad0: c0000003aff800a0 c0000003aff809a0
>     2e:mon> d c0000003aff800a0 20 (struct kprobe_blacklist *)
>     c0000003aff800a0: c0000003aff800c0 c00000000104dad0
>     c0000003aff800b0: c0000000010ef138 c0000000010ef188
>                       start ^^         end ^^
>     2e:mon> la c0000000010ef138 (start)
>     c0000000010ef138: notify_die+0x0/0x10 <- still points to the
> function descriptor
>     2e:mon> la c0000000010ef188 (end)
>     c0000000010ef188: __blocking_notifier_call_chain+0x0/0x10
> 
> 
> Following patch fixes the issue, with the patch :
> 
> 1:mon> ls kprobe_blacklist
> kprobe_blacklist: c00000000104dad0
> 1:mon> d c00000000104dad0 10
> c00000000104dad0: c0000003ae1a00a0 c0000003ae1a09a0
> 1:mon> d c0000003ae1a00a0 20 (struct kprobe_blacklist *)
> c0000003ae1a00a0: c0000003ae1a00c0 c00000000104dad0
> c0000003ae1a00b0: c0000000000b14d0 c0000000000b1520
>                       start ^^         end ^^
> 1:mon> la c0000000000b14d0
> c0000000000b14d0: .notify_die+0x0/0x50
> 1:mon> la c0000000000b1520
> c0000000000b1520: .atomic_notifier_chain_register+0x0/0xa0
> 
> 1:mon> di c0000000000b14d0 10 (.notify_die)
> c0000000000b14d0  7c0802a6	mflr	r0
> c0000000000b14d4  7c691b78	mr	r9,r3
> 
> commit ed51674aca8e0496641f565421ab6691a873e80a
> Author: Suzuki K. Poulose <suzuki@...ibm.com>
> Date:   Fri May 30 00:23:01 2014 +0530
> 
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 3859c88..b81d626 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -2043,7 +2043,8 @@ static int __init
> populate_kprobe_blacklist(unsigned long *start,
>         unsigned long offset = 0, size = 0;
> 
>         for (iter = start; iter < end; iter++) {
> -               if (!kallsyms_lookup_size_offset(function_entry(*iter),
> +               unsigned long entry = function_entry(*iter);
> +               if (!kallsyms_lookup_size_offset(entry,
>                                                  &size, &offset)) {
>                         pr_err("Failed to find blacklist %p\n", (void
> *)*iter);
>                         continue;
> @@ -2052,8 +2053,8 @@ static int __init
> populate_kprobe_blacklist(unsigned long *start,
>                 ent = kmalloc(sizeof(*ent), GFP_KERNEL);
>                 if (!ent)
>                         return -ENOMEM;
> -               ent->start_addr = *iter;
> -               ent->end_addr = *iter + size;
> +               ent->start_addr = entry;
> +               ent->end_addr = entry + size;

Oops! right, I missed it :(
I'll update the patch including your fix and signed-off-by.

thank you!


-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@...achi.com


--
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