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 #ifdef __cplusplus
0019 #define LIST_POISON1  NULL
0020 #define LIST_POISON2  NULL
0021 #else
0022 /*
0023  * These are non-NULL pointers that will result in page faults
0024  * under normal circumstances, used to verify that nobody uses
0025  * non-initialized list entries.
0026  */
0027 #define LIST_POISON1  ((void *) 0x100 + POISON_POINTER_DELTA)
0028 #define LIST_POISON2  ((void *) 0x200 + POISON_POINTER_DELTA)
0029 #endif
0030 
0031 /********** include/linux/timer.h **********/
0032 /*
0033  * Magic number "tsta" to indicate a static timer initializer
0034  * for the object debugging code.
0035  */
0036 #define TIMER_ENTRY_STATIC  ((void *) 0x300 + POISON_POINTER_DELTA)
0037 
0038 /********** mm/page_poison.c **********/
0039 #define PAGE_POISON 0xaa
0040 
0041 /********** mm/page_alloc.c ************/
0042 
0043 #define TAIL_MAPPING    ((void *) 0x400 + POISON_POINTER_DELTA)
0044 
0045 /********** mm/slab.c **********/
0046 /*
0047  * Magic nums for obj red zoning.
0048  * Placed in the first word before and the first word after an obj.
0049  */
0050 #define RED_INACTIVE    0x09F911029D74E35BULL   /* when obj is inactive */
0051 #define RED_ACTIVE  0xD84156C5635688C0ULL   /* when obj is active */
0052 
0053 #define SLUB_RED_INACTIVE   0xbb
0054 #define SLUB_RED_ACTIVE     0xcc
0055 
0056 /* ...and for poisoning */
0057 #define POISON_INUSE    0x5a    /* for use-uninitialised poisoning */
0058 #define POISON_FREE 0x6b    /* for use-after-free poisoning */
0059 #define POISON_END  0xa5    /* end-byte of poisoning */
0060 
0061 /********** arch/$ARCH/mm/init.c **********/
0062 #define POISON_FREE_INITMEM 0xcc
0063 
0064 /********** arch/ia64/hp/common/sba_iommu.c **********/
0065 /*
0066  * arch/ia64/hp/common/sba_iommu.c uses a 16-byte poison string with a
0067  * value of "SBAIOMMU POISON\0" for spill-over poisoning.
0068  */
0069 
0070 /********** fs/jbd/journal.c **********/
0071 #define JBD_POISON_FREE     0x5b
0072 #define JBD2_POISON_FREE    0x5c
0073 
0074 /********** drivers/base/dmapool.c **********/
0075 #define POOL_POISON_FREED   0xa7    /* !inuse */
0076 #define POOL_POISON_ALLOCATED   0xa9    /* !initted */
0077 
0078 /********** drivers/atm/ **********/
0079 #define ATM_POISON_FREE     0x12
0080 #define ATM_POISON      0xdeadbeef
0081 
0082 /********** kernel/mutexes **********/
0083 #define MUTEX_DEBUG_INIT    0x11
0084 #define MUTEX_DEBUG_FREE    0x22
0085 
0086 /********** security/ **********/
0087 #define KEY_DESTROY     0xbd
0088 
0089 #endif