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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090907093856.5c453d3f.kamezawa.hiroyu@jp.fujitsu.com>
Date:	Mon, 7 Sep 2009 09:38:56 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Nick Craig-Wood <nick@...ig-wood.com>,
	Pekka Enberg <penberg@...helsinki.fi>,
	linux-kernel@...r.kernel.org,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: Reading /proc/kcore causes a BUG()

On Fri, 4 Sep 2009 10:31:56 -0700
Andrew Morton <akpm@...ux-foundation.org> wrote:

> On Fri, 4 Sep 2009 18:16:45 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> 
> > On Fri, 4 Sep 2009 10:00:39 +0100
> > Nick Craig-Wood <nick@...ig-wood.com> wrote:
> > 
> > > On Fri, Sep 04, 2009 at 09:06:42AM +0900, KAMEZAWA Hiroyuki wrote:
> > > > On Thu, 3 Sep 2009 15:14:55 +0300
> > > > Pekka Enberg <penberg@...helsinki.fi> wrote:
> > > > > On Thu, Sep 3, 2009 at 2:34 PM, Nick Craig-Wood<nick@...ig-wood.com> wrote:
> > > > > > Is a fix for this going to make 2.6.31?
> > > > > >
> > > > > > To replicate
> > > > > >
> > > > > > __cat /proc/kcore >/dev/null
> > > > > >
> > > > > > See also
> > > > > >
> > > > > > __http://bugzilla.kernel.org/show_bug.cgi?id=13850
> > > [snip]
> > > > > > I tried this on the latest git checkout (as of 2009-09-03 11:00 GMT)
> > > > > > under Xen as a domU. __The bugzilla report states it happens on non xen
> > > > > > machines also.
> 
> Is this a regression?  I've lost track..
> 
regression. (this comes from new per-cpu area implemantation, which uses
vmalloc area with memory holes.)


> > > > > > I know reading /proc/kcore isn't such a good idea, but badly written
> > > > > > backup scripts are triggering this on our customer's servers :-(
> > > > > 
> > > > > AFAICT the bug was fixed but I can't seem to find the patches in
> > > > > Linus' git either. Lets CC Andrew and Hiroyuki-san.
> > > > 
> > > > Ah, it's now tested under mmotm. please wait.
> > > 
> > > I tried mmotm but I couldn't get it to boot under Xen :-(
> > > 
> > > If you send me a patch against latest git I'm willing to test it (I
> > > tried to extract the relevant patch from mmotm but failed dismally)
> > > 
> > > Thanks
> > > 
> > 
> > If you already downloaded mmotm, use these patches.
> > 
> > vmalloc-unmap-vmalloc-area-after-hiding-it.patch
> > kcore-fix-vread-vwrite-to-be-aware-of-holes.patch
> > kcore-fix-vread-vwrite-to-be-aware-of-holes-update.patch
> > kcore-proc-kcore-should-use-vread.patch
> > 
> > All I tested was x86-32/x86-64. then more tests are welcomed.
> 
> That's a lot of stuff for 2.6.31.  Is there some simple quickfix we can do?
> 
I don't like this patch. But here, my 1st version which wasn't sent out.
-Kame
==
/proc/kcore may access in memory holes in vmalloc area. skip it
by using copy_from_user().

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
---
 fs/proc/kcore.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.31-rc8/fs/proc/kcore.c
===================================================================
--- linux-2.6.31-rc8.orig/fs/proc/kcore.c
+++ linux-2.6.31-rc8/fs/proc/kcore.c
@@ -361,7 +361,9 @@ read_kcore(struct file *file, char __use
 				/* don't dump ioremap'd stuff! (TA) */
 				if (m->flags & VM_IOREMAP)
 					continue;
-				memcpy(elf_buf + (vmstart - start),
+				/* we may access memory holes */
+				__copy_from_user_inatomic(
+					elf_buf + (vmstart - start),
 					(char *)vmstart, vmsize);
 			}
 			read_unlock(&vmlist_lock);






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