mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
![Vegard Nossum](/assets/img/avatar_default.png)
This adds support for tracking the initializedness of memory that was allocated with the page allocator. Highmem requests are not tracked. Cc: Dave Hansen <dave@linux.vnet.ibm.com> Acked-by: Pekka Enberg <penberg@cs.helsinki.fi> [build fix for !CONFIG_KMEMCHECK] Signed-off-by: Ingo Molnar <mingo@elte.hu> [rebased for mainline inclusion] Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
103 lines
2.6 KiB
C
103 lines
2.6 KiB
C
#ifndef LINUX_KMEMCHECK_H
|
|
#define LINUX_KMEMCHECK_H
|
|
|
|
#include <linux/mm_types.h>
|
|
#include <linux/types.h>
|
|
|
|
#ifdef CONFIG_KMEMCHECK
|
|
extern int kmemcheck_enabled;
|
|
|
|
/* The slab-related functions. */
|
|
void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node);
|
|
void kmemcheck_free_shadow(struct page *page, int order);
|
|
void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
|
|
size_t size);
|
|
void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size);
|
|
|
|
void kmemcheck_pagealloc_alloc(struct page *p, unsigned int order,
|
|
gfp_t gfpflags);
|
|
|
|
void kmemcheck_show_pages(struct page *p, unsigned int n);
|
|
void kmemcheck_hide_pages(struct page *p, unsigned int n);
|
|
|
|
bool kmemcheck_page_is_tracked(struct page *p);
|
|
|
|
void kmemcheck_mark_unallocated(void *address, unsigned int n);
|
|
void kmemcheck_mark_uninitialized(void *address, unsigned int n);
|
|
void kmemcheck_mark_initialized(void *address, unsigned int n);
|
|
void kmemcheck_mark_freed(void *address, unsigned int n);
|
|
|
|
void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n);
|
|
void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n);
|
|
void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n);
|
|
|
|
int kmemcheck_show_addr(unsigned long address);
|
|
int kmemcheck_hide_addr(unsigned long address);
|
|
#else
|
|
#define kmemcheck_enabled 0
|
|
|
|
static inline void
|
|
kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node)
|
|
{
|
|
}
|
|
|
|
static inline void
|
|
kmemcheck_free_shadow(struct page *page, int order)
|
|
{
|
|
}
|
|
|
|
static inline void
|
|
kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
|
|
size_t size)
|
|
{
|
|
}
|
|
|
|
static inline void kmemcheck_slab_free(struct kmem_cache *s, void *object,
|
|
size_t size)
|
|
{
|
|
}
|
|
|
|
static inline void kmemcheck_pagealloc_alloc(struct page *p,
|
|
unsigned int order, gfp_t gfpflags)
|
|
{
|
|
}
|
|
|
|
static inline bool kmemcheck_page_is_tracked(struct page *p)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline void kmemcheck_mark_unallocated(void *address, unsigned int n)
|
|
{
|
|
}
|
|
|
|
static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n)
|
|
{
|
|
}
|
|
|
|
static inline void kmemcheck_mark_initialized(void *address, unsigned int n)
|
|
{
|
|
}
|
|
|
|
static inline void kmemcheck_mark_freed(void *address, unsigned int n)
|
|
{
|
|
}
|
|
|
|
static inline void kmemcheck_mark_unallocated_pages(struct page *p,
|
|
unsigned int n)
|
|
{
|
|
}
|
|
|
|
static inline void kmemcheck_mark_uninitialized_pages(struct page *p,
|
|
unsigned int n)
|
|
{
|
|
}
|
|
|
|
static inline void kmemcheck_mark_initialized_pages(struct page *p,
|
|
unsigned int n)
|
|
{
|
|
}
|
|
|
|
#endif /* CONFIG_KMEMCHECK */
|
|
|
|
#endif /* LINUX_KMEMCHECK_H */
|