#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/highmem.h>
#include <linux/page_ext.h>
#include <linux/poison.h>
#include <linux/ratelimit.h>
static bool want_page_poisoning __read_mostly;
static int __init early_page_poison_param(char *buf)
return strtobool(buf, &want_page_poisoning);
early_param("page_poison", early_page_poison_param);
bool page_poisoning_enabled(void)
return (want_page_poisoning ||
(!IS_ENABLED(CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC) &&
debug_pagealloc_enabled()));
EXPORT_SYMBOL_GPL(page_poisoning_enabled);
static void poison_page(struct page *page)
void *addr = kmap_atomic(page);
memset(addr, PAGE_POISON, PAGE_SIZE);
static void poison_pages(struct page *page, int n)
static bool single_bit_flip(unsigned char a, unsigned char b)
unsigned char error = a ^ b;
return error && !(error & (error - 1));