linux-um archives
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jeff Dike <jdike@addtoit.com>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] Re: [patch] uml fixes, 2.6.1-mm5-A2
Date: Fri, 23 Jan 2004 14:51:12 +0100	[thread overview]
Message-ID: <20040123135112.GA26758@elte.hu> (raw)
In-Reply-To: <20040123135647.GA6768@ccure.user-mode-linux.org>


* Jeff Dike <jdike@addtoit.com> wrote:

> On Fri, Jan 23, 2004 at 10:35:41AM +0100, Ingo Molnar wrote:
> > hm, there's this code in arch/um/sys-i386/bugs.c:arch_handle_signal():
> > 
> >         ip = UPT_IP(regs);
> >         if((*((char *) ip) != 0x0f) || ((*((char *) (ip + 1)) & 0xf0) != 0x40))
> >                 return(0);
> > 
> > we are running in the UML kernel context here. Is the dereferencing of
> > IP safe? 
> 
> No, it's not.  There needs to be a copy_from_user in there.

ok - partial patch below. (Couldnt figure out how to include the proper
uaccess.h file to get copy_from_user() - so the build will fail with
this patch for the time being.)

	Ingo

--- linux/arch/um/sys-i386/bugs.c.orig	
+++ linux/arch/um/sys-i386/bugs.c	
@@ -183,15 +183,16 @@ void arch_check_bugs(void)
 
 int arch_handle_signal(int sig, union uml_pt_regs *regs)
 {
-	unsigned long ip;
+	unsigned char tmp[2];
 
 	/* This is testing for a cmov (0x0f 0x4x) instruction causing a
 	 * SIGILL in init.
 	 */
 	if((sig != SIGILL) || (TASK_PID(get_current()) != 1)) return(0);
 
-	ip = UPT_IP(regs);
-	if((*((char *) ip) != 0x0f) || ((*((char *) (ip + 1)) & 0xf0) != 0x40))
+	if (copy_from_user(tmp, UPT_IP(regs), 2))
+		panic("SIGILL in init, could not read instructions!\n");
+	if((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40))
 		return(0);
 
 	if(host_has_cmov == 0)


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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-01-23 13:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-20 19:17 [uml-devel] [patch] uml-fixes-2.6.1-mm5-A1 Ingo Molnar
2004-01-20 19:43 ` [uml-devel] [patch] uml-fixes2-2.6.1-mm5-A0 Ingo Molnar
2004-01-20 20:01   ` [uml-devel] [patch] uml-fixes2-2.6.1-mm5-A1 Ingo Molnar
2004-01-22 16:21     ` [uml-devel] [patch] uml fixes, 2.6.1-mm5-A2 Ingo Molnar
2004-01-22 18:42       ` Jeff Dike
2004-01-23  6:18       ` nsb034
2004-01-28  4:39         ` Jeff Dike
2004-01-23  9:35       ` [uml-devel] " Ingo Molnar
2004-01-23 13:56         ` Jeff Dike
2004-01-23 13:51           ` Ingo Molnar [this message]
2004-01-23 16:09             ` 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=20040123135112.GA26758@elte.hu \
    --to=mingo@elte.hu \
    --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