Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_POISON_H
0003 #define _LINUX_POISON_H
0004 
0005 /********** include/linux/list.h **********/
0006 
0007 /*
0008  * Architectures might want to move the poison pointer offset
0009  * into some well-recognized area such as 0xdead000000000000,
0010  * that is also not mappable by user-space exploits:
0011  */
0012 #ifdef CONFIG_ILLEGAL_POINTER_VALUE
0013 # define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL)
0014 #else
0015 # define POISON_POINTER_DELTA 0
0016 #endif
0017 
0018 /*
0019  * These are non-NULL pointers that will result in page faults
0020  * under normal circumstances, used to verify that nobody uses
0021  * non-initialized list entries.
0022  */
0023 #define LIST_POISON1  ((void *) 0x100 + POISON_POINTER_DELTA)
0024 #define LIST_POISON2  ((void *) 0x122 + POISON_POINTER_DELTA)
0025 
0026 /********** include/linux/timer.h **********/
0027 #define TIMER_ENTRY_STATIC  ((void *) 0x300 + POISON_POINTER_DELTA)
0028 
0029 /********** mm/page_poison.c **********/
0030 #define PAGE_POISON 0xaa
0031 
0032 /********** mm/page_alloc.c ************/
0033 
0034 #define TAIL_MAPPING    ((void *) 0x400 + POISON_POINTER_DELTA)
0035 
0036 /********** mm/slab.c **********/
0037 /*
0038  * Magic nums for obj red zoning.
0039  * Placed in the first word before and the first word after an obj.
0040  */
0041 #define RED_INACTIVE    0x09F911029D74E35BULL   /* when obj is inactive */
0042 #define RED_ACTIVE  0xD84156C5635688C0ULL   /* when obj is active */
0043 
0044 #define SLUB_RED_INACTIVE   0xbb
0045 #define SLUB_RED_ACTIVE     0xcc
0046 
0047 /* ...and for poisoning */
0048 #define POISON_INUSE    0x5a    /* for use-uninitialised poisoning */
0049 #define POISON_FREE 0x6b    /* for use-after-free poisoning */
0050 #define POISON_END  0xa5    /* end-byte of poisoning */
0051 
0052 /********** arch/$ARCH/mm/init.c **********/
0053 #define POISON_FREE_INITMEM 0xcc
0054 
0055 /********** arch/ia64/hp/common/sba_iommu.c **********/
0056 /*
0057  * arch/ia64/hp/common/sba_iommu.c uses a 16-byte poison string with a
0058  * value of "SBAIOMMU POISON\0" for spill-over poisoning.
0059  */
0060 
0061 /********** fs/jbd/journal.c **********/
0062 #define JBD_POISON_FREE     0x5b
0063 #define JBD2_POISON_FREE    0x5c
0064 
0065 /********** drivers/base/dmapool.c **********/
0066 #define POOL_POISON_FREED   0xa7    /* !inuse */
0067 #define POOL_POISON_ALLOCATED   0xa9    /* !initted */
0068 
0069 /********** drivers/atm/ **********/
0070 #define ATM_POISON_FREE     0x12
0071 #define ATM_POISON      0xdeadbeef
0072 
0073 /********** kernel/mutexes **********/
0074 #define MUTEX_DEBUG_INIT    0x11
0075 #define MUTEX_DEBUG_FREE    0x22
0076 #define MUTEX_POISON_WW_CTX ((void *) 0x500 + POISON_POINTER_DELTA)
0077 
0078 /********** security/ **********/
0079 #define KEY_DESTROY     0xbd
0080 
0081 /********** net/core/page_pool.c **********/
0082 #define PP_SIGNATURE        (0x40 + POISON_POINTER_DELTA)
0083 
0084 #endif