#include "lkdtm.h"
#include <linux/slab.h>
#include <linux/highmem.h>
#include <linux/vmalloc.h>
#include <linux/sched/task_stack.h>
#include <linux/mman.h>
#include <linux/uaccess.h>
#include <asm/cacheflush.h>
static volatile size_t unconst;
static volatile size_t cache_size = …;
static struct kmem_cache *whitelist_cache;
static const unsigned char test_text[] = …;
static noinline unsigned char *trick_compiler(unsigned char *stack)
{ … }
static noinline unsigned char *do_usercopy_stack_callee(int value)
{ … }
static noinline void do_usercopy_stack(bool to_user, bool bad_frame)
{ … }
static void do_usercopy_slab_size(bool to_user)
{ … }
static void do_usercopy_slab_whitelist(bool to_user)
{ … }
static void lkdtm_USERCOPY_SLAB_SIZE_TO(void)
{ … }
static void lkdtm_USERCOPY_SLAB_SIZE_FROM(void)
{ … }
static void lkdtm_USERCOPY_SLAB_WHITELIST_TO(void)
{ … }
static void lkdtm_USERCOPY_SLAB_WHITELIST_FROM(void)
{ … }
static void lkdtm_USERCOPY_STACK_FRAME_TO(void)
{ … }
static void lkdtm_USERCOPY_STACK_FRAME_FROM(void)
{ … }
static void lkdtm_USERCOPY_STACK_BEYOND(void)
{ … }
static void lkdtm_USERCOPY_KERNEL(void)
{ … }
static void do_usercopy_page_span(const char *name, void *kaddr)
{ … }
static void lkdtm_USERCOPY_VMALLOC(void)
{ … }
static void lkdtm_USERCOPY_FOLIO(void)
{ … }
void __init lkdtm_usercopy_init(void)
{ … }
void __exit lkdtm_usercopy_exit(void)
{ … }
static struct crashtype crashtypes[] = …;
struct crashtype_category usercopy_crashtypes = …;