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] [day] [month] [year] [list]
Date:	Mon, 7 Sep 2009 08:59:57 +0100
From:	Nick Craig-Wood <nick@...ig-wood.com>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	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 Mon, Sep 07, 2009 at 03:14:22PM +0900, KAMEZAWA Hiroyuki wrote:
> On Mon, 7 Sep 2009 09:38:56 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> > > 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
> 
> Fixed warnings. (I confirmed this patch works well on x86-64.)
> ==
> To access vmalloc area which may have memory holes, copy_from_user is
> useful. By this, 
>  # cat /proc/kcore > /dev/null
> will not panic.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
> ---
>  fs/proc/kcore.c |    8 +++++++-
>  1 file changed, 7 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,13 @@ 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, then use
> +				 * ex_table. checking return value just for
> +				 * avoid warnings.
> +				 */
> +				vmsize = __copy_from_user_inatomic(
> +					elf_buf + (vmstart - start),
>  					(char *)vmstart, vmsize);
>  			}
>  			read_unlock(&vmlist_lock);

I gave this patch a thrashing and it works fine for me too (Xen domU x86)

It would be great if we could have this quick fix for 2.6.31.

Perhaps it should also go out to 2.6.30-stable also?

I can confirm that this patch applies to 2.6.30.5 and fixes the problem there too.

-- 
Nick Craig-Wood <nick@...ig-wood.com> -- http://www.craig-wood.com/nick
--
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