Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a11f75b authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds
Browse files

generic debug pagealloc



CONFIG_DEBUG_PAGEALLOC is now supported by x86, powerpc, sparc64, and
s390.  This patch implements it for the rest of the architectures by
filling the pages with poison byte patterns after free_pages() and
verifying the poison patterns before alloc_pages().

This generic one cannot detect invalid page accesses immediately but
invalid read access may cause invalid dereference by poisoned memory and
invalid write access can be detected after a long delay.

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 610a77e0
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -250,21 +250,3 @@ asmlinkage void do_bus_error(unsigned long addr, int write_access,
	dump_dtlb();
	die("Bus Error", regs, SIGKILL);
}

/*
 * This functionality is currently not possible to implement because
 * we're using segmentation to ensure a fixed mapping of the kernel
 * virtual address space.
 *
 * It would be possible to implement this, but it would require us to
 * disable segmentation at startup and load the kernel mappings into
 * the TLB like any other pages. There will be lots of trickery to
 * avoid recursive invocation of the TLB miss handler, though...
 */
#ifdef CONFIG_DEBUG_PAGEALLOC
void kernel_map_pages(struct page *page, int numpages, int enable)
{

}
EXPORT_SYMBOL(kernel_map_pages);
#endif
+3 −0
Original line number Diff line number Diff line
@@ -228,6 +228,9 @@ config PPC_OF_PLATFORM_PCI
	depends on PPC64 # not supported on 32 bits yet
	default n

config ARCH_SUPPORTS_DEBUG_PAGEALLOC
	def_bool y

source "init/Kconfig"

source "kernel/Kconfig.freezer"
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ config DEBUG_STACK_USAGE
config DEBUG_PAGEALLOC
        bool "Debug page memory allocations"
        depends on DEBUG_KERNEL && !HIBERNATION
	depends on ARCH_SUPPORTS_DEBUG_PAGEALLOC
        help
          Unmap pages from the kernel linear mapping after free_pages().
          This results in a large slowdown, but helps to find certain types
+3 −0
Original line number Diff line number Diff line
@@ -72,6 +72,9 @@ config PGSTE
config VIRT_CPU_ACCOUNTING
	def_bool y

config ARCH_SUPPORTS_DEBUG_PAGEALLOC
	def_bool y

mainmenu "Linux Kernel Configuration"

config S390
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ source "lib/Kconfig.debug"
config DEBUG_PAGEALLOC
	bool "Debug page memory allocations"
	depends on DEBUG_KERNEL
	depends on ARCH_SUPPORTS_DEBUG_PAGEALLOC
	help
	  Unmap pages from the kernel linear mapping after free_pages().
	  This results in a slowdown, but helps to find certain types of
Loading