All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Dike <jdike@addtoit.com>
To: John Reiser <jreiser@BitWagon.com>
Cc: uml-devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: Re: [uml-devel] reading uninit memory in do_io (ubd_kern.c)
Date: Thu, 6 Dec 2007 00:01:24 -0500	[thread overview]
Message-ID: <20071206050124.GA12584@c2.user-mode-linux.org> (raw)
In-Reply-To: <47577C8A.8060104@BitWagon.com>

On Wed, Dec 05, 2007 at 08:37:30PM -0800, John Reiser wrote:
> Thanks for the tip.  I was getting stuck trying to figure out the
> ptrace() shenanigans involved with the stub [skas0 mode] that turns
> SIGSEGV into SIGUSR1.  Valgrind has its own ideas about what
> should happen with signals, and the ptracing gets complicated.

I think if you just don't follow that clone, things will be better.
However, since you ask, what happens is this:
	process (at startup, in userspace_tramp) sets the handler in
the stub as its SIGSEGV handler
	process accesses memory that hasn't been mapped and segfaults
	UML kernel sees SIGSEGV and allows it to be delivered
	stub SIGSEGV handler reads page fault information out of its
sigcontext struct and puts it someplace the UML kernel can find
	handler sends itself a SIGUSR1
	SIGUSR1 is masked in this handler, so it's delivered right
after the sigreturn
	UML kernel sees SIGUSR1 and knows the page fault data is
available

> The very first thing that the skas0 stub does is field SIGSEGV because
> the page which contains the entry point of the PT_INTERP of /sbin/init
> is not present.

Right, that's the first page fault.

> The signal handler in the stub forwards this SIGSGEV
> to uml as SIGUSR1, and the ptrace()ing code inside uml "understands"
> what the child is doing.

See above, it's not really describable as forwarding.

> Perhaps valgrind could recognize the
> skas0 stub (SIGSEGV.sa_handler >= 0xbffe0000, etc.) and adapt,
> or perhaps both valgrind and uml should cooperate here.  I'm still
> puzzling over this one.

I would just let this clone escape - things should just work then.

				Jeff

-- 
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

      reply	other threads:[~2007-12-06  5:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-04 23:31 [uml-devel] reading uninit memory in do_io (ubd_kern.c) John Reiser
2007-12-05  0:22 ` Jeff Dike
2007-12-05  0:46   ` John Reiser
2007-12-05  2:17     ` Jeff Dike
2007-12-06  2:10     ` Jeff Dike
2007-12-06  4:37       ` John Reiser
2007-12-06  5:01         ` Jeff Dike [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=20071206050124.GA12584@c2.user-mode-linux.org \
    --to=jdike@addtoit.com \
    --cc=jreiser@BitWagon.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.