|
@@ -156,9 +156,18 @@ static __always_inline int PageCompound(struct page *page)
|
|
|
return test_bit(PG_head, &page->flags) || PageTail(page);
|
|
|
}
|
|
|
|
|
|
+#define PAGE_POISON_PATTERN -1l
|
|
|
+static inline int PagePoisoned(const struct page *page)
|
|
|
+{
|
|
|
+ return page->flags == PAGE_POISON_PATTERN;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* Page flags policies wrt compound pages
|
|
|
*
|
|
|
+ * PF_POISONED_CHECK
|
|
|
+ * check if this struct page poisoned/uninitialized
|
|
|
+ *
|
|
|
* PF_ANY:
|
|
|
* the page flag is relevant for small, head and tail pages.
|
|
|
*
|
|
@@ -176,17 +185,20 @@ static __always_inline int PageCompound(struct page *page)
|
|
|
* PF_NO_COMPOUND:
|
|
|
* the page flag is not relevant for compound pages.
|
|
|
*/
|
|
|
-#define PF_ANY(page, enforce) page
|
|
|
-#define PF_HEAD(page, enforce) compound_head(page)
|
|
|
+#define PF_POISONED_CHECK(page) ({ \
|
|
|
+ VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
|
|
|
+ page; })
|
|
|
+#define PF_ANY(page, enforce) PF_POISONED_CHECK(page)
|
|
|
+#define PF_HEAD(page, enforce) PF_POISONED_CHECK(compound_head(page))
|
|
|
#define PF_ONLY_HEAD(page, enforce) ({ \
|
|
|
VM_BUG_ON_PGFLAGS(PageTail(page), page); \
|
|
|
- page;})
|
|
|
+ PF_POISONED_CHECK(page); })
|
|
|
#define PF_NO_TAIL(page, enforce) ({ \
|
|
|
VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \
|
|
|
- compound_head(page);})
|
|
|
+ PF_POISONED_CHECK(compound_head(page)); })
|
|
|
#define PF_NO_COMPOUND(page, enforce) ({ \
|
|
|
VM_BUG_ON_PGFLAGS(enforce && PageCompound(page), page); \
|
|
|
- page;})
|
|
|
+ PF_POISONED_CHECK(page); })
|
|
|
|
|
|
/*
|
|
|
* Macros to create function definitions for page flags
|