From 56beecf61af5a16dd2b72c157ac326e659f65aa2 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Mon, 18 Oct 2004 18:15:02 -0700 Subject: [PATCH] [PATCH] taint on bad_page Hugh and I both thought this would be generally useful. Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/kernel.h | 1 + kernel/panic.c | 6 ++++-- mm/page_alloc.c | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index f60ba2c96469c..cf2f984e1b955 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -152,6 +152,7 @@ extern enum system_states { #define TAINT_UNSAFE_SMP (1<<2) #define TAINT_FORCED_RMMOD (1<<3) #define TAINT_MACHINE_CHECK (1<<4) +#define TAINT_BAD_PAGE (1<<5) extern void dump_stack(void); diff --git a/kernel/panic.c b/kernel/panic.c index 6dddb56fbdad0..c7ab9981c7aa7 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -112,6 +112,7 @@ EXPORT_SYMBOL(panic); * 'S' - SMP with CPUs not designed for SMP. * 'R' - User forced a module unload. * 'M' - Machine had a machine check experience. + * 'B' - System has hit bad_page. * * The string is overwritten by the next call to print_taint(). */ @@ -120,12 +121,13 @@ const char *print_tainted(void) { static char buf[20]; if (tainted) { - snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c", + snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c", tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G', tainted & TAINT_FORCED_MODULE ? 'F' : ' ', tainted & TAINT_UNSAFE_SMP ? 'S' : ' ', tainted & TAINT_FORCED_RMMOD ? 'R' : ' ', - tainted & TAINT_MACHINE_CHECK ? 'M' : ' '); + tainted & TAINT_MACHINE_CHECK ? 'M' : ' ', + tainted & TAINT_BAD_PAGE ? 'B' : ' '); } else snprintf(buf, sizeof(buf), "Not tainted"); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bd4e102ee22e3..274a7af40a89e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -94,6 +94,7 @@ static void bad_page(const char *function, struct page *page) set_page_count(page, 0); reset_page_mapcount(page); page->mapping = NULL; + tainted |= TAINT_BAD_PAGE; } #ifndef CONFIG_HUGETLB_PAGE -- 2.53.0