Commit 56beecf6 authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds

[PATCH] taint on bad_page

Hugh and I both thought this would be generally useful.
Signed-off-by: default avatarNick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a9e96e12
...@@ -152,6 +152,7 @@ extern enum system_states { ...@@ -152,6 +152,7 @@ extern enum system_states {
#define TAINT_UNSAFE_SMP (1<<2) #define TAINT_UNSAFE_SMP (1<<2)
#define TAINT_FORCED_RMMOD (1<<3) #define TAINT_FORCED_RMMOD (1<<3)
#define TAINT_MACHINE_CHECK (1<<4) #define TAINT_MACHINE_CHECK (1<<4)
#define TAINT_BAD_PAGE (1<<5)
extern void dump_stack(void); extern void dump_stack(void);
......
...@@ -112,6 +112,7 @@ EXPORT_SYMBOL(panic); ...@@ -112,6 +112,7 @@ EXPORT_SYMBOL(panic);
* 'S' - SMP with CPUs not designed for SMP. * 'S' - SMP with CPUs not designed for SMP.
* 'R' - User forced a module unload. * 'R' - User forced a module unload.
* 'M' - Machine had a machine check experience. * 'M' - Machine had a machine check experience.
* 'B' - System has hit bad_page.
* *
* The string is overwritten by the next call to print_taint(). * The string is overwritten by the next call to print_taint().
*/ */
...@@ -120,12 +121,13 @@ const char *print_tainted(void) ...@@ -120,12 +121,13 @@ const char *print_tainted(void)
{ {
static char buf[20]; static char buf[20];
if (tainted) { 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_PROPRIETARY_MODULE ? 'P' : 'G',
tainted & TAINT_FORCED_MODULE ? 'F' : ' ', tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
tainted & TAINT_UNSAFE_SMP ? 'S' : ' ', tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
tainted & TAINT_FORCED_RMMOD ? 'R' : ' ', tainted & TAINT_FORCED_RMMOD ? 'R' : ' ',
tainted & TAINT_MACHINE_CHECK ? 'M' : ' '); tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
tainted & TAINT_BAD_PAGE ? 'B' : ' ');
} }
else else
snprintf(buf, sizeof(buf), "Not tainted"); snprintf(buf, sizeof(buf), "Not tainted");
......
...@@ -94,6 +94,7 @@ static void bad_page(const char *function, struct page *page) ...@@ -94,6 +94,7 @@ static void bad_page(const char *function, struct page *page)
set_page_count(page, 0); set_page_count(page, 0);
reset_page_mapcount(page); reset_page_mapcount(page);
page->mapping = NULL; page->mapping = NULL;
tainted |= TAINT_BAD_PAGE;
} }
#ifndef CONFIG_HUGETLB_PAGE #ifndef CONFIG_HUGETLB_PAGE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment