mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
mm: slub: panic for object and slab errors
If the SLUB_DEBUG_PANIC_ON Kconfig option is selected, also panic for object and slab errors to allow capturing relevant debug data. Change-Id: Idc582ef48d3c0d866fa89cf8660ff0a5402f7e15 Signed-off-by: David Keitel <dkeitel@codeaurora.org>
This commit is contained in:
parent
08c53911c5
commit
4d976899f7
1 changed files with 12 additions and 4 deletions
16
mm/slub.c
16
mm/slub.c
|
@ -613,11 +613,21 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
|
||||||
dump_stack();
|
dump_stack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SLUB_DEBUG_PANIC_ON
|
||||||
|
static void slab_panic(const char *cause)
|
||||||
|
{
|
||||||
|
panic("%s\n", cause);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static inline void slab_panic(const char *cause) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void object_err(struct kmem_cache *s, struct page *page,
|
static void object_err(struct kmem_cache *s, struct page *page,
|
||||||
u8 *object, char *reason)
|
u8 *object, char *reason)
|
||||||
{
|
{
|
||||||
slab_bug(s, "%s", reason);
|
slab_bug(s, "%s", reason);
|
||||||
print_trailer(s, page, object);
|
print_trailer(s, page, object);
|
||||||
|
slab_panic(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void slab_err(struct kmem_cache *s, struct page *page, const char *fmt, ...)
|
static void slab_err(struct kmem_cache *s, struct page *page, const char *fmt, ...)
|
||||||
|
@ -631,6 +641,7 @@ static void slab_err(struct kmem_cache *s, struct page *page, const char *fmt, .
|
||||||
slab_bug(s, "%s", buf);
|
slab_bug(s, "%s", buf);
|
||||||
print_page_info(page);
|
print_page_info(page);
|
||||||
dump_stack();
|
dump_stack();
|
||||||
|
slab_panic("slab error");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_object(struct kmem_cache *s, void *object, u8 val)
|
static void init_object(struct kmem_cache *s, void *object, u8 val)
|
||||||
|
@ -649,12 +660,9 @@ static void init_object(struct kmem_cache *s, void *object, u8 val)
|
||||||
static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
|
static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
|
||||||
void *from, void *to)
|
void *from, void *to)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SLUB_DEBUG_PANIC_ON
|
slab_panic("object poison overwritten");
|
||||||
panic("Found corruption 0x%p-0x%p=0x%x\n", from, to - 1, data);
|
|
||||||
#else
|
|
||||||
slab_fix(s, "Restoring 0x%p-0x%p=0x%x\n", from, to - 1, data);
|
slab_fix(s, "Restoring 0x%p-0x%p=0x%x\n", from, to - 1, data);
|
||||||
memset(from, data, to - from);
|
memset(from, data, to - from);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_bytes_and_report(struct kmem_cache *s, struct page *page,
|
static int check_bytes_and_report(struct kmem_cache *s, struct page *page,
|
||||||
|
|
Loading…
Reference in a new issue