[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Patch: fix munmap on ARM
From:       Russell King <rmk () arm ! linux ! org ! uk>
Date:       2000-09-30 22:26:06
[Download RAW message or body]

Linus, lkml,

The following patch is required so that munmap(0x8000, *) does not cause
ARM kernels to hang.  The problem is that the machine vectors are at
virtual address 0.  Unfortunately, when free_pgtables() is called, it
clears first level page tables starting at 0 in this case, and takes
out the machine vectors.  This then results in an unrecoverable hang.

We already have FIRST_USER_PGD_NR to define the first entry in the pgd
which may be cleared, so we use this to clamp "start_index"
appropriately.  The following patch does this.  Tested on ARM.

There is only one concern that I can see with this patch - GCC may warn
about comparison always zero on architectures that define
FIRST_USER_PGD_NR to be zero.

--- orig/mm/mmap.c	Tue Sep  5 22:22:12 2000
+++ linux/mm/mmap.c	Sat Sep 30 14:24:23 2000
@@ -620,6 +620,8 @@
 	 * old method of shifting the VA >> by PGDIR_SHIFT doesn't work.
 	 */
 	start_index = pgd_index(first);
+	if (start_index < FIRST_USER_PGD_NR)
+		start_index = FIRST_USER_PGD_NR;
 	end_index = pgd_index(last);
 	if (end_index > start_index) {
 		clear_page_tables(mm, start_index, end_index - start_index);

   _____
  |_____| ------------------------------------------------- ---+---+-
  |   |         Russell King        rmk@arm.linux.org.uk      --- ---
  | | | | http://www.arm.linux.org.uk/personal/aboutme.html   /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |                                                     ---  |
    +-+-+ -------------------------------------------------  /\\\  |
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic