Blame view

include/linux/poison.h 2.66 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
c9cf55285   Randy Dunlap   [PATCH] add poiso...
2
3
4
5
  #ifndef _LINUX_POISON_H
  #define _LINUX_POISON_H
  
  /********** include/linux/list.h **********/
a29815a33   Avi Kivity   core, x86: make L...
6
7
8
9
10
11
12
13
14
15
16
  
  /*
   * Architectures might want to move the poison pointer offset
   * into some well-recognized area such as 0xdead000000000000,
   * that is also not mappable by user-space exploits:
   */
  #ifdef CONFIG_ILLEGAL_POINTER_VALUE
  # define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL)
  #else
  # define POISON_POINTER_DELTA 0
  #endif
c9cf55285   Randy Dunlap   [PATCH] add poiso...
17
18
19
20
21
  /*
   * These are non-NULL pointers that will result in page faults
   * under normal circumstances, used to verify that nobody uses
   * non-initialized list entries.
   */
8a5e5e02f   Vasily Kulikov   include/linux/poi...
22
23
  #define LIST_POISON1  ((void *) 0x100 + POISON_POINTER_DELTA)
  #define LIST_POISON2  ((void *) 0x200 + POISON_POINTER_DELTA)
c9cf55285   Randy Dunlap   [PATCH] add poiso...
24

c6f3a97f8   Thomas Gleixner   debugobjects: add...
25
26
27
28
29
  /********** include/linux/timer.h **********/
  /*
   * Magic number "tsta" to indicate a static timer initializer
   * for the object debugging code.
   */
b8a0255db   Vasily Kulikov   include/linux/poi...
30
  #define TIMER_ENTRY_STATIC	((void *) 0x300 + POISON_POINTER_DELTA)
c6f3a97f8   Thomas Gleixner   debugobjects: add...
31

6a11f75b6   Akinobu Mita   generic debug pag...
32
  /********** mm/debug-pagealloc.c **********/
1414c7f4f   Laura Abbott   mm/page_poisoning...
33
34
35
  #ifdef CONFIG_PAGE_POISONING_ZERO
  #define PAGE_POISON 0x00
  #else
6a11f75b6   Akinobu Mita   generic debug pag...
36
  #define PAGE_POISON 0xaa
1414c7f4f   Laura Abbott   mm/page_poisoning...
37
  #endif
6a11f75b6   Akinobu Mita   generic debug pag...
38

1c290f642   Kirill A. Shutemov   mm: sanitize page...
39
  /********** mm/page_alloc.c ************/
b8a0255db   Vasily Kulikov   include/linux/poi...
40
  #define TAIL_MAPPING	((void *) 0x400 + POISON_POINTER_DELTA)
1c290f642   Kirill A. Shutemov   mm: sanitize page...
41

c9cf55285   Randy Dunlap   [PATCH] add poiso...
42
43
44
45
46
  /********** mm/slab.c **********/
  /*
   * Magic nums for obj red zoning.
   * Placed in the first word before and the first word after an obj.
   */
b46b8f19c   David Woodhouse   Increase slab red...
47
48
  #define	RED_INACTIVE	0x09F911029D74E35BULL	/* when obj is inactive */
  #define	RED_ACTIVE	0xD84156C5635688C0ULL	/* when obj is active */
c9cf55285   Randy Dunlap   [PATCH] add poiso...
49

81819f0fc   Christoph Lameter   SLUB core
50
51
  #define SLUB_RED_INACTIVE	0xbb
  #define SLUB_RED_ACTIVE		0xcc
c9cf55285   Randy Dunlap   [PATCH] add poiso...
52
53
54
55
56
57
58
  /* ...and for poisoning */
  #define	POISON_INUSE	0x5a	/* for use-uninitialised poisoning */
  #define POISON_FREE	0x6b	/* for use-after-free poisoning */
  #define	POISON_END	0xa5	/* end-byte of poisoning */
  
  /********** arch/$ARCH/mm/init.c **********/
  #define POISON_FREE_INITMEM	0xcc
c9cf55285   Randy Dunlap   [PATCH] add poiso...
59
60
61
62
63
64
65
  /********** arch/ia64/hp/common/sba_iommu.c **********/
  /*
   * arch/ia64/hp/common/sba_iommu.c uses a 16-byte poison string with a
   * value of "SBAIOMMU POISON\0" for spill-over poisoning.
   */
  
  /********** fs/jbd/journal.c **********/
cd02ff0b1   Mingming Cao   jbd2: JBD_XXX to ...
66
67
  #define JBD_POISON_FREE		0x5b
  #define JBD2_POISON_FREE	0x5c
c9cf55285   Randy Dunlap   [PATCH] add poiso...
68
69
70
71
  
  /********** drivers/base/dmapool.c **********/
  #define	POOL_POISON_FREED	0xa7	/* !inuse */
  #define	POOL_POISON_ALLOCATED	0xa9	/* !initted */
b3c681e09   Randy Dunlap   [PATCH] update tw...
72
73
  /********** drivers/atm/ **********/
  #define ATM_POISON_FREE		0x12
3c6b37732   Randy Dunlap   [ATM]: add+use po...
74
  #define ATM_POISON		0xdeadbeef
b3c681e09   Randy Dunlap   [PATCH] update tw...
75

a7807a32b   Randy Dunlap   [PATCH] poison: a...
76
77
78
  /********** kernel/mutexes **********/
  #define MUTEX_DEBUG_INIT	0x11
  #define MUTEX_DEBUG_FREE	0x22
977625a69   Nicolai Hähnle   locking/mutex: In...
79
  #define MUTEX_POISON_WW_CTX	((void *) 0x500 + POISON_POINTER_DELTA)
a7807a32b   Randy Dunlap   [PATCH] poison: a...
80

19da3dd15   David Rientjes   flex_array: poiso...
81
82
  /********** lib/flex_array.c **********/
  #define FLEX_ARRAY_FREE	0x6c	/* for use-after-free poisoning */
a7807a32b   Randy Dunlap   [PATCH] poison: a...
83
84
  /********** security/ **********/
  #define KEY_DESTROY		0xbd
c9cf55285   Randy Dunlap   [PATCH] add poiso...
85
  #endif