[PATCH] mm: data overlapping in page struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch is to fix a data overlapping issue in struct page. The
problem was introduced a few months ago by "split page table lock"
change in which mapping is moved into the same union with ptl. Since
private has fixed length (size of unsigned long), depending on config
options, ptl may have larger size than private. In this case, ptl will
overlap to mapping and may overwrite the original data in mapping. 
The simplest way of fixing this is to move mapping out of the union, as
in this patch. There may be better approaches; I'll leave it to the
experts more familiar with this part of code.  

We have discussed this with some of the Novell kernel engineers in the
CC list.

Signed-off-by: Hui Yu <[email protected]>

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 498ff87..edb9a22 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -234,18 +234,18 @@ struct page {
 						 * indicates order in
the buddy
 						 * system.
 						 */
-		struct address_space *mapping;	/* If low bit clear,
points to
-						 * inode address_space,
or NULL.
-						 * If page mapped as
anonymous
-						 * memory, low bit is
set, and
-						 * it points to anon_vma
object:
-						 * see PAGE_MAPPING_ANON
below.
-						 */
 	    };
 #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
 	    spinlock_t ptl;
 #endif
 	};
+	struct address_space *mapping;	/* If low bit clear, points to
+					 * inode address_space, or NULL.
+					 * If page mapped as anonymous
+					 * memory, low bit is set, and
+					 * it points to anon_vma object:
+					 * see PAGE_MAPPING_ANON below.
+					 */
 	pgoff_t index;			/* Our offset within mapping. */
 	struct list_head lru;		/* Pageout list, eg. active_list
 					 * protected by zone->lru_lock !


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux