linux-um archives
 help / color / mirror / Atom feed
From: Gerd Knorr <kraxel@bytesex.org>
To: Jeff Dike <jdike@addtoit.com>,
	uml devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [uml-devel] [patch] fix fault handling
Date: Mon, 17 May 2004 19:21:11 +0200	[thread overview]
Message-ID: <20040517172111.GA12321@bytesex.org> (raw)

  Hi,

skas has a design bug: PTRACE_FAULTINFO doesn't pass enougth
informations.  Specifically the trap_no is missing, so you
don't know for sure whenever the SIGSEGV was a page fault or
a general protection fault.  I think that should be fixed in
skas4 (where we'll break backward compatibility anyway).

For the time being I've tried to fix that with the patch below,
which makes the uml kernel pass through general protection SEGV
to the app and seems to have no ill side effects.

  Gerd

--- linux-2.6.5/arch/um/kernel/skas/process.c.segv	2004-05-14 18:40:36.155621129 +0200
+++ linux-2.6.5/arch/um/kernel/skas/process.c	2004-05-14 19:49:00.762159068 +0200
@@ -54,6 +54,17 @@
 		panic("handle_segv - PTRACE_FAULTINFO failed, errno = %d\n",
 		      errno);
 
+	if (!(fault.is_write & 4)) {
+		/*
+		    kernel fault -- likely that was general
+ 		    protection fault (trap_no = 13), not a
+		    page fault (trap_no = 14).  But we don't
+		    know for sure as PTRACE_FAULTINFO doesn't
+		    tell us :-/
+		*/
+		bad_segv(fault.addr, 0, fault.is_write);
+		return;
+	}
 	segv(fault.addr, 0, FAULT_WRITE(fault.is_write), 1, NULL);
 }
 


-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
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:[~2004-05-17 17:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-17 17:21 Gerd Knorr [this message]
2004-05-20  0:26 ` [uml-devel] Re: [patch] fix fault handling Jeff Dike

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=20040517172111.GA12321@bytesex.org \
    --to=kraxel@bytesex.org \
    --cc=jdike@addtoit.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox