Re: Taint kernel when we detect a corrupted slab.

From: Dave Jones
Date: Tue Sep 18 2012 - 15:54:13 EST


On Tue, Sep 18, 2012 at 12:27:58PM -0700, David Rientjes wrote:
> On Tue, 18 Sep 2012, Christoph Lameter wrote:
>
> > On Tue, 18 Sep 2012, Dave Jones wrote:
> >
> > > It doesn't seem worth adding a new taint flag for this, so just re-use
> > > the one from 'bad page'
> >
> > Acked-by: Christoph Lameter <cl@xxxxxxxxx>
>
> [Fixing Pekka's email address]
>
> Dave, would you like to add something similar to __slab_error() for
> CONFIG_SLAB?

Sure. This ?

Dave

--


Taint kernel when we detect a corrupted slab.

It doesn't seem worth adding a new taint flag for this, so just re-use
the one from 'bad page'

Signed-off-by: Dave Jones <davej@xxxxxxxxxx>

diff --git a/mm/slub.c b/mm/slub.c
index 2fdd96f..0c5009d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -568,6 +568,8 @@ static void slab_bug(struct kmem_cache *s, char *fmt, ...)
printk(KERN_ERR "BUG %s (%s): %s\n", s->name, print_tainted(), buf);
printk(KERN_ERR "----------------------------------------"
"-------------------------------------\n\n");
+
+ add_taint(TAINT_BAD_PAGE);
}

static void slab_fix(struct kmem_cache *s, char *fmt, ...)
diff --git a/mm/slab.c b/mm/slab.c
index c685475..cbce8c9 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -818,6 +818,7 @@ static void __slab_error(const char *function, struct kmem_cache *cachep,
printk(KERN_ERR "slab error in %s(): cache `%s': %s\n",
function, cachep->name, msg);
dump_stack();
+ add_taint(TAINT_BAD_PAGE);
}

/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/