Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753399AbbH0MQb (ORCPT ); Thu, 27 Aug 2015 08:16:31 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:37276 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752836AbbH0MQ3 (ORCPT ); Thu, 27 Aug 2015 08:16:29 -0400 MIME-Version: 1.0 In-Reply-To: <1440577578-15813-11-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1440577578-15813-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1440577578-15813-11-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Date: Thu, 27 Aug 2015 15:16:28 +0300 Message-ID: Subject: Re: [PATCH V2 10/10] powerpc/mm: kasan: Add kasan support for ppc64 From: Andrey Ryabinin To: "Aneesh Kumar K.V" Cc: Benjamin Herrenschmidt , paulus@samba.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2868 Lines: 69 2015-08-26 11:26 GMT+03:00 Aneesh Kumar K.V : > + k_start = (unsigned long)kasan_mem_to_shadow(start); > + k_end = (unsigned long)kasan_mem_to_shadow(end); > + for (; k_start < k_end; k_start += page_size) { > + p = vmemmap_alloc_block(page_size, node); > + if (!p) { > + pr_info("Disabled Kasan, for lack of free mem\n"); > + /* Free the stuff or panic ? */ vmemmap_alloc_block() panics on allocation failure, so you don't need this if block. You could replace this with memblock_virt_alloc_try_nid_nopanic(), but note that if/when we will have working asan-stack=1 there will be no way for fallback. > + return; > + } > + htab_bolt_mapping(k_start, k_start + page_size, > + __pa(p), pgprot_val(PAGE_KERNEL), > + mmu_vmemmap_psize, mmu_kernel_ssize); > + } > + } > + /* > + * At this point kasan is fully initialized. Enable error messages > + */ > + init_task.kasan_depth = 0; > + __kasan_enabled = true; > + pr_info("Kernel address sanitizer initialized\n"); > +} > diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S > index 736d18b3cefd..154bd8a0b437 100644 > --- a/arch/powerpc/mm/slb_low.S > +++ b/arch/powerpc/mm/slb_low.S > @@ -80,11 +80,15 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) > /* Check virtual memmap region. To be patches at kernel boot */ > cmpldi cr0,r9,0xf > bne 1f > +2: > .globl slb_miss_kernel_load_vmemmap > slb_miss_kernel_load_vmemmap: > li r11,0 > b 6f > 1: > + /* Kasan region same as vmemmap mapping */ > + cmpldi cr0,r9,0xe > + beq 2b > #endif /* CONFIG_SPARSEMEM_VMEMMAP */ > > /* vmalloc mapping gets the encoding from the PACA as the mapping > diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype > index c140e94c7c72..7a7c9d54f80e 100644 > --- a/arch/powerpc/platforms/Kconfig.cputype > +++ b/arch/powerpc/platforms/Kconfig.cputype > @@ -75,6 +75,7 @@ config PPC_BOOK3S_64 > select HAVE_ARCH_TRANSPARENT_HUGEPAGE if PPC_64K_PAGES > select ARCH_SUPPORTS_NUMA_BALANCING > select IRQ_WORK > + select HAVE_ARCH_KASAN if SPARSEMEM_VMEMMAP > > config PPC_BOOK3E_64 > bool "Embedded processors" > -- > 2.5.0 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/