common.c (942baad211336efefb93a8369478888ab845c450) | common.c (7a3b835371883558eb63e069d891bd87f562380d) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * This file contains common KASAN code. 4 * 5 * Copyright (c) 2014 Samsung Electronics Co., Ltd. 6 * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com> 7 * 8 * Some code borrowed from https://github.com/xairy/kasan-prototype by --- 83 unchanged lines hidden (view full) --- 92 */ 93slab_flags_t __kasan_never_merge(void) 94{ 95 if (kasan_stack_collection_enabled()) 96 return SLAB_KASAN; 97 return 0; 98} 99 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * This file contains common KASAN code. 4 * 5 * Copyright (c) 2014 Samsung Electronics Co., Ltd. 6 * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com> 7 * 8 * Some code borrowed from https://github.com/xairy/kasan-prototype by --- 83 unchanged lines hidden (view full) --- 92 */ 93slab_flags_t __kasan_never_merge(void) 94{ 95 if (kasan_stack_collection_enabled()) 96 return SLAB_KASAN; 97 return 0; 98} 99 |
100void __kasan_alloc_pages(struct page *page, unsigned int order, bool init) | 100void __kasan_unpoison_pages(struct page *page, unsigned int order, bool init) |
101{ 102 u8 tag; 103 unsigned long i; 104 105 if (unlikely(PageHighMem(page))) 106 return; 107 108 tag = kasan_random_tag(); 109 for (i = 0; i < (1 << order); i++) 110 page_kasan_tag_set(page + i, tag); 111 kasan_unpoison(page_address(page), PAGE_SIZE << order, init); 112} 113 | 101{ 102 u8 tag; 103 unsigned long i; 104 105 if (unlikely(PageHighMem(page))) 106 return; 107 108 tag = kasan_random_tag(); 109 for (i = 0; i < (1 << order); i++) 110 page_kasan_tag_set(page + i, tag); 111 kasan_unpoison(page_address(page), PAGE_SIZE << order, init); 112} 113 |
114void __kasan_free_pages(struct page *page, unsigned int order, bool init) | 114void __kasan_poison_pages(struct page *page, unsigned int order, bool init) |
115{ 116 if (likely(!PageHighMem(page))) 117 kasan_poison(page_address(page), PAGE_SIZE << order, 118 KASAN_FREE_PAGE, init); 119} 120 121/* 122 * Adaptive redzone policy taken from the userspace AddressSanitizer runtime. --- 463 unchanged lines hidden --- | 115{ 116 if (likely(!PageHighMem(page))) 117 kasan_poison(page_address(page), PAGE_SIZE << order, 118 KASAN_FREE_PAGE, init); 119} 120 121/* 122 * Adaptive redzone policy taken from the userspace AddressSanitizer runtime. --- 463 unchanged lines hidden --- |