blob: 601a2156a0d48ccf417421282487ba9b36b1070b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Kees Cook9a49a522016-02-22 14:09:29 -08002#ifndef __LKDTM_H
3#define __LKDTM_H
4
Kees Cook6d2e91a2016-07-15 16:04:39 -07005#define pr_fmt(fmt) "lkdtm: " fmt
6
7#include <linux/kernel.h>
8
Kees Cook00f496c2016-06-26 22:17:25 -07009/* lkdtm_bugs.c */
10void __init lkdtm_bugs_init(int *recur_param);
11void lkdtm_PANIC(void);
12void lkdtm_BUG(void);
13void lkdtm_WARNING(void);
Kees Cook1ee170e2019-08-19 10:24:52 -070014void lkdtm_WARNING_MESSAGE(void);
Kees Cook00f496c2016-06-26 22:17:25 -070015void lkdtm_EXCEPTION(void);
16void lkdtm_LOOP(void);
Kees Cook24cccab2019-04-06 08:59:19 -070017void lkdtm_EXHAUST_STACK(void);
Kees Cook00f496c2016-06-26 22:17:25 -070018void lkdtm_CORRUPT_STACK(void);
Kees Cook93e78c62017-08-04 14:34:40 -070019void lkdtm_CORRUPT_STACK_STRONG(void);
Kees Cook00f496c2016-06-26 22:17:25 -070020void lkdtm_UNALIGNED_LOAD_STORE_WRITE(void);
21void lkdtm_SOFTLOCKUP(void);
22void lkdtm_HARDLOCKUP(void);
23void lkdtm_SPINLOCKUP(void);
24void lkdtm_HUNG_TASK(void);
Kees Cookae2e1aa2020-04-06 20:12:34 -070025void lkdtm_OVERFLOW_SIGNED(void);
26void lkdtm_OVERFLOW_UNSIGNED(void);
27void lkdtm_ARRAY_BOUNDS(void);
Kees Cook6819d102016-08-17 14:42:12 -070028void lkdtm_CORRUPT_LIST_ADD(void);
29void lkdtm_CORRUPT_LIST_DEL(void);
Kees Cooke22aa9d2017-03-24 10:51:25 -070030void lkdtm_CORRUPT_USER_DS(void);
Kees Cook7b25a852017-08-04 13:04:21 -070031void lkdtm_STACK_GUARD_PAGE_LEADING(void);
32void lkdtm_STACK_GUARD_PAGE_TRAILING(void);
Kees Cook06b32fd2019-06-22 13:18:23 -070033void lkdtm_UNSET_SMEP(void);
Andy Lutomirskib09511c2019-11-24 21:18:04 -080034#ifdef CONFIG_X86_32
35void lkdtm_DOUBLE_FAULT(void);
36#endif
Amit Daniel Kachhap6cb69822020-03-13 14:35:04 +053037void lkdtm_CORRUPT_PAC(void);
Kees Cook00f496c2016-06-26 22:17:25 -070038
Kees Cookffc514f2016-06-26 21:45:23 -070039/* lkdtm_heap.c */
Kees Cook966fede2019-07-11 20:53:29 -070040void __init lkdtm_heap_init(void);
41void __exit lkdtm_heap_exit(void);
Kees Cookffc514f2016-06-26 21:45:23 -070042void lkdtm_OVERWRITE_ALLOCATION(void);
43void lkdtm_WRITE_AFTER_FREE(void);
44void lkdtm_READ_AFTER_FREE(void);
45void lkdtm_WRITE_BUDDY_AFTER_FREE(void);
46void lkdtm_READ_BUDDY_AFTER_FREE(void);
Kees Cook966fede2019-07-11 20:53:29 -070047void lkdtm_SLAB_FREE_DOUBLE(void);
48void lkdtm_SLAB_FREE_CROSS(void);
49void lkdtm_SLAB_FREE_PAGE(void);
Kees Cookffc514f2016-06-26 21:45:23 -070050
Kees Cook0d9eb292016-06-26 15:12:31 -070051/* lkdtm_perms.c */
52void __init lkdtm_perms_init(void);
53void lkdtm_WRITE_RO(void);
54void lkdtm_WRITE_RO_AFTER_INIT(void);
55void lkdtm_WRITE_KERN(void);
56void lkdtm_EXEC_DATA(void);
57void lkdtm_EXEC_STACK(void);
58void lkdtm_EXEC_KMALLOC(void);
59void lkdtm_EXEC_VMALLOC(void);
60void lkdtm_EXEC_RODATA(void);
61void lkdtm_EXEC_USERSPACE(void);
Christophe Leroy59a12202018-12-14 15:26:20 +000062void lkdtm_EXEC_NULL(void);
Kees Cook0d9eb292016-06-26 15:12:31 -070063void lkdtm_ACCESS_USERSPACE(void);
Christophe Leroy59a12202018-12-14 15:26:20 +000064void lkdtm_ACCESS_NULL(void);
Kees Cook0d9eb292016-06-26 15:12:31 -070065
Kees Cook95925c92017-04-24 13:23:21 -070066/* lkdtm_refcount.c */
67void lkdtm_REFCOUNT_INC_OVERFLOW(void);
68void lkdtm_REFCOUNT_ADD_OVERFLOW(void);
69void lkdtm_REFCOUNT_INC_NOT_ZERO_OVERFLOW(void);
70void lkdtm_REFCOUNT_ADD_NOT_ZERO_OVERFLOW(void);
71void lkdtm_REFCOUNT_DEC_ZERO(void);
72void lkdtm_REFCOUNT_DEC_NEGATIVE(void);
73void lkdtm_REFCOUNT_DEC_AND_TEST_NEGATIVE(void);
74void lkdtm_REFCOUNT_SUB_AND_TEST_NEGATIVE(void);
75void lkdtm_REFCOUNT_INC_ZERO(void);
76void lkdtm_REFCOUNT_ADD_ZERO(void);
77void lkdtm_REFCOUNT_INC_SATURATED(void);
78void lkdtm_REFCOUNT_DEC_SATURATED(void);
79void lkdtm_REFCOUNT_ADD_SATURATED(void);
80void lkdtm_REFCOUNT_INC_NOT_ZERO_SATURATED(void);
81void lkdtm_REFCOUNT_ADD_NOT_ZERO_SATURATED(void);
82void lkdtm_REFCOUNT_DEC_AND_TEST_SATURATED(void);
83void lkdtm_REFCOUNT_SUB_AND_TEST_SATURATED(void);
Kees Cookc7fea482017-07-21 06:19:14 -070084void lkdtm_REFCOUNT_TIMING(void);
85void lkdtm_ATOMIC_TIMING(void);
Kees Cook95925c92017-04-24 13:23:21 -070086
Kees Cooka3dff712016-06-26 08:46:23 -070087/* lkdtm_rodata.c */
Kees Cook9a49a522016-02-22 14:09:29 -080088void lkdtm_rodata_do_nothing(void);
89
Kees Cooka3dff712016-06-26 08:46:23 -070090/* lkdtm_usercopy.c */
91void __init lkdtm_usercopy_init(void);
92void __exit lkdtm_usercopy_exit(void);
93void lkdtm_USERCOPY_HEAP_SIZE_TO(void);
94void lkdtm_USERCOPY_HEAP_SIZE_FROM(void);
Kees Cooke47e3112017-06-14 18:56:55 -070095void lkdtm_USERCOPY_HEAP_WHITELIST_TO(void);
96void lkdtm_USERCOPY_HEAP_WHITELIST_FROM(void);
Kees Cooka3dff712016-06-26 08:46:23 -070097void lkdtm_USERCOPY_STACK_FRAME_TO(void);
98void lkdtm_USERCOPY_STACK_FRAME_FROM(void);
99void lkdtm_USERCOPY_STACK_BEYOND(void);
100void lkdtm_USERCOPY_KERNEL(void);
Jann Hornbef45902018-08-28 22:14:21 +0200101void lkdtm_USERCOPY_KERNEL_DS(void);
Kees Cooka3dff712016-06-26 08:46:23 -0700102
Alexander Popovf90d1e02018-08-17 01:17:00 +0300103/* lkdtm_stackleak.c */
104void lkdtm_STACKLEAK_ERASING(void);
105
Kees Cookb0eb93c2019-08-08 11:37:45 -0700106/* cfi.c */
107void lkdtm_CFI_FORWARD_PROTO(void);
108
Kees Cook9a49a522016-02-22 14:09:29 -0800109#endif