shadow.c (23689e91fb22c15b84ac6c22ad9942039792f3af) | shadow.c (f6e39794f4b6da7ca9b77f2f9ad11fd6f0ac83e5) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * This file contains KASAN runtime code that manages shadow memory for 4 * generic and software tag-based KASAN modes. 5 * 6 * Copyright (c) 2014 Samsung Electronics Co., Ltd. 7 * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com> 8 * --- 474 unchanged lines hidden (view full) --- 483 * mappings, so the KASAN_VMALLOC_VM_ALLOC flag is ignored. 484 * Software KASAN modes can't optimize zeroing memory by combining it 485 * with setting memory tags, so the KASAN_VMALLOC_INIT flag is ignored. 486 */ 487 488 if (!is_vmalloc_or_module_addr(start)) 489 return (void *)start; 490 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * This file contains KASAN runtime code that manages shadow memory for 4 * generic and software tag-based KASAN modes. 5 * 6 * Copyright (c) 2014 Samsung Electronics Co., Ltd. 7 * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com> 8 * --- 474 unchanged lines hidden (view full) --- 483 * mappings, so the KASAN_VMALLOC_VM_ALLOC flag is ignored. 484 * Software KASAN modes can't optimize zeroing memory by combining it 485 * with setting memory tags, so the KASAN_VMALLOC_INIT flag is ignored. 486 */ 487 488 if (!is_vmalloc_or_module_addr(start)) 489 return (void *)start; 490 |
491 /* 492 * Don't tag executable memory with the tag-based mode. 493 * The kernel doesn't tolerate having the PC register tagged. 494 */ 495 if (IS_ENABLED(CONFIG_KASAN_SW_TAGS) && 496 !(flags & KASAN_VMALLOC_PROT_NORMAL)) 497 return (void *)start; 498 |
|
491 start = set_tag(start, kasan_random_tag()); 492 kasan_unpoison(start, size, false); 493 return (void *)start; 494} 495 496/* 497 * Poison the shadow for a vmalloc region. Called as part of the 498 * freeing process at the time the region is freed. --- 55 unchanged lines hidden --- | 499 start = set_tag(start, kasan_random_tag()); 500 kasan_unpoison(start, size, false); 501 return (void *)start; 502} 503 504/* 505 * Poison the shadow for a vmalloc region. Called as part of the 506 * freeing process at the time the region is freed. --- 55 unchanged lines hidden --- |