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

List:       linux-kernel
Subject:    PATCH: Error checking page_size to see if userspace page_size_int = 2.
From:       Christopher Sacchi <chris.sacchi () gmail ! com>
Date:       2012-12-31 18:38:21
Message-ID: CAGh4K3JtRit+g7Oxn_=TamjmxiAhp7RFJX2KxnNDh5ppgq6SYw () mail ! gmail ! com
[Download RAW message or body]

This patch is for the pagemap.h. This checks to see if the
page_size_int is 2, if not, set the value to 2, and return 1.
The code is under the double-dashed lines.

--
Signed-off-by: Christopher P. Sacchi chris.sacchi@gmail.com
--- pagemap.h	2012-12-21 20:19:00.000000000 -0500
+++ pagemap.h	2012-12-31 13:07:51.566631871 -0500
@@ -14,11 +14,15 @@
 #include <linux/bitops.h>
 #include <linux/hardirq.h> /* for in_interrupt() */
 #include <linux/hugetlb_inline.h>
-
 /*
  * Bits in mapping->flags.  The lower __GFP_BITS_SHIFT bits are the page
  * allocation mode flags.
  */
+/*
+* Here we declare the number that
+* the PAGE_SIZE should have.
+* We need it an integer for checking
+* and writing. This value should be two.
+* If not, later we'll check.
+*/
+int page_size_integer = 2;
 enum mapping_flags {
 	AS_EIO		= __GFP_BITS_SHIFT + 0,	/* IO error on async write */
 	AS_ENOSPC	= __GFP_BITS_SHIFT + 1,	/* ENOSPC on async write */
@@ -426,6 +430,18 @@ extern void add_page_wait_queue(struct p
  * This assumes that two userspace pages are always sufficient.  That's
  * not true if PAGE_CACHE_SIZE > PAGE_SIZE.
  */
+
+/*
+* Here we'll check for if the two userspace pages are not sufficient,
+* and if PAGE_CACHE_SIZE > PAGE_SIZE.
+* This will return 1 if true,
+* and will set the value back to 2 in case of a fault.
+*/
+static inline int fault_userspace_assumption_sufficient_not_true()
+{
+	if (PAGE_CACHE_SIZE > PAGE_SIZE) {
+		page_size_int = 2;
+		return 1;
+	}
+}
 static inline int fault_in_pages_writeable(char __user *uaddr, int size)
 {
 	int ret;
--

Regards,
Christopher
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
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