linux-um archives
 help / color / mirror / Atom feed
From: BlaisorBlade <blaisorblade_spam@yahoo.it>
To: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com>
Subject: Re: [uml-devel] [PATCH] fix writing into /dev/kmem
Date: Sun, 29 Feb 2004 17:20:19 +0100	[thread overview]
Message-ID: <200402291720.19359.blaisorblade_spam@yahoo.it> (raw)
In-Reply-To: <20040229023636.GB8272@ccure.user-mode-linux.org>

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

Alle 03:36, domenica 29 febbraio 2004, Jeff Dike ha scritto:
> The patch below fixes a bug in the /dev/kmem driver which causes UML to
> die if you write to it.

Also, I forgot one thing, about this Oops:

the i386 Oopses, normally, kill only the thread which triggered the fault - 
while instead Uml panics altogether. Cannot this be changed at 
arch/um/kernel/trap_kern.c:segv()?

        if(!is_user)
-                panic("Kernel mode fault at addr 0x%lx, ip 0x%lx",
-                      address, ip);
+		 die("Oops".....) //some printk calls... can be omitted
+		 do_exit(SIGKILL);

like arch/i386/mm/fault.c: do_page_fault() ?
With the above change, cat /dev/kmem could only create an Oops on the cat 
process (and possibly some deadlock, but better than a straight crash).

By the way: in handle_page_fault(), there is some dead code (attached is the 
removal patch).

I also do not understand the loop around handle_mm_fault call, but I could be 
wrong: are you sure that after a successful handle_mm_fault (i.e. a major or 
minor fault) pte_present(*pte) could be false? If handle_mm_fault is not 
successful, we exit the loop anyway.

-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729

[-- Attachment #2: Dead-trap-code.patch --]
[-- Type: text/x-diff, Size: 444 bytes --]

--- ./arch/um/kernel/trap_kern.c.fix	2004-02-20 18:43:26.000000000 +0100
+++ ./arch/um/kernel/trap_kern.c	2004-02-29 17:12:49.000000000 +0100
@@ -74,13 +74,7 @@
 			err = -ENOMEM;
 			goto out_of_memory;
 		default:
-			if (current->pid == 1) {
-				up_read(&mm->mmap_sem);
-				yield();
-				down_read(&mm->mmap_sem);
-				goto survive;
-			}
-			goto out;
+			BUG();
 		}
 		pte = pte_offset_kernel(pmd, page);
 	} while(!pte_present(*pte));

  parent reply	other threads:[~2004-02-29 16:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-29  2:36 [uml-devel] [PATCH] fix writing into /dev/kmem Jeff Dike
2004-02-29 12:25 ` BlaisorBlade
2004-03-02  1:31   ` Jeff Dike
2004-03-02 18:41     ` BlaisorBlade
2004-03-04  2:02       ` Jeff Dike
2004-03-08 11:50         ` BlaisorBlade
2004-02-29 16:20 ` BlaisorBlade [this message]
2004-03-02  1:11   ` Jeff Dike
2004-03-02  1:31   ` 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=200402291720.19359.blaisorblade_spam@yahoo.it \
    --to=blaisorblade_spam@yahoo.it \
    --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