mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Craig-Wood <nick@craig-wood.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: Reading /proc/kcore causes a BUG()
Date: Mon, 7 Sep 2009 08:59:57 +0100	[thread overview]
Message-ID: <20090907075957.GA15620@craig-wood.com> (raw)
In-Reply-To: <20090907151422.4d42e382.kamezawa.hiroyu@jp.fujitsu.com>

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@jp.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@jp.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@craig-wood.com> -- http://www.craig-wood.com/nick

      reply	other threads:[~2009-09-07  7:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03 11:34 Nick Craig-Wood
2009-09-03 12:14 ` Pekka Enberg
2009-09-04  0:06   ` KAMEZAWA Hiroyuki
2009-09-04  9:00     ` Nick Craig-Wood
2009-09-04  9:16       ` KAMEZAWA Hiroyuki
2009-09-04 16:52         ` Nick Craig-Wood
2009-09-04 17:31         ` Andrew Morton
2009-09-07  0:38           ` KAMEZAWA Hiroyuki
2009-09-07  6:14             ` KAMEZAWA Hiroyuki
2009-09-07  7:59               ` Nick Craig-Wood [this message]

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=20090907075957.GA15620@craig-wood.com \
    --to=nick@craig-wood.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=torvalds@linux-foundation.org \
    /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®