From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758879AbbA2XMb (ORCPT ); Thu, 29 Jan 2015 18:12:31 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59128 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758806AbbA2XM0 (ORCPT ); Thu, 29 Jan 2015 18:12:26 -0500 Date: Thu, 29 Jan 2015 15:12:24 -0800 From: Andrew Morton To: Andrey Ryabinin Cc: linux-kernel@vger.kernel.org, Dmitry Vyukov , Konstantin Serebryany , Dmitry Chernenkov , Andrey Konovalov , Yuri Gribov , Konstantin Khlebnikov , Sasha Levin , Christoph Lameter , Joonsoo Kim , Dave Hansen , Andi Kleen , x86@kernel.org, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Jonathan Corbet , Andy Lutomirski , linux-doc@vger.kernel.org (open list:DOCUMENTATION) Subject: Re: [PATCH v10 02/17] x86_64: add KASan support Message-Id: <20150129151224.4e7947af78605c199763102c@linux-foundation.org> In-Reply-To: <1422544321-24232-3-git-send-email-a.ryabinin@samsung.com> References: <1404905415-9046-1-git-send-email-a.ryabinin@samsung.com> <1422544321-24232-1-git-send-email-a.ryabinin@samsung.com> <1422544321-24232-3-git-send-email-a.ryabinin@samsung.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Jan 2015 18:11:46 +0300 Andrey Ryabinin wrote: > This patch adds arch specific code for kernel address sanitizer. > > 16TB of virtual addressed used for shadow memory. > It's located in range [ffffec0000000000 - fffffc0000000000] > between vmemmap and %esp fixup stacks. > > At early stage we map whole shadow region with zero page. > Latter, after pages mapped to direct mapping address range > we unmap zero pages from corresponding shadow (see kasan_map_shadow()) > and allocate and map a real shadow memory reusing vmemmap_populate() > function. > > Also replace __pa with __pa_nodebug before shadow initialized. > __pa with CONFIG_DEBUG_VIRTUAL=y make external function call (__phys_addr) > __phys_addr is instrumented, so __asan_load could be called before > shadow area initialized. > > ... > > --- a/lib/Kconfig.kasan > +++ b/lib/Kconfig.kasan > @@ -5,6 +5,7 @@ if HAVE_ARCH_KASAN > > config KASAN > bool "AddressSanitizer: runtime memory debugger" > + depends on !MEMORY_HOTPLUG > help > Enables address sanitizer - runtime memory debugger, > designed to find out-of-bounds accesses and use-after-free bugs. That's a significant restriction. It has obvious runtime implications. It also means that `make allmodconfig' and `make allyesconfig' don't enable kasan, so compile coverage will be impacted. This wasn't changelogged. What's the reasoning and what has to be done to fix it? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by kanga.kvack.org (Postfix) with ESMTP id A01A76B006C for ; Thu, 29 Jan 2015 18:12:26 -0500 (EST) Received: by mail-pa0-f52.google.com with SMTP id kx10so44291173pab.11 for ; Thu, 29 Jan 2015 15:12:26 -0800 (PST) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org. [140.211.169.12]) by mx.google.com with ESMTPS id yc6si9047668pbc.16.2015.01.29.15.12.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jan 2015 15:12:25 -0800 (PST) Date: Thu, 29 Jan 2015 15:12:24 -0800 From: Andrew Morton Subject: Re: [PATCH v10 02/17] x86_64: add KASan support Message-Id: <20150129151224.4e7947af78605c199763102c@linux-foundation.org> In-Reply-To: <1422544321-24232-3-git-send-email-a.ryabinin@samsung.com> References: <1404905415-9046-1-git-send-email-a.ryabinin@samsung.com> <1422544321-24232-1-git-send-email-a.ryabinin@samsung.com> <1422544321-24232-3-git-send-email-a.ryabinin@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Andrey Ryabinin Cc: linux-kernel@vger.kernel.org, Dmitry Vyukov , Konstantin Serebryany , Dmitry Chernenkov , Andrey Konovalov , Yuri Gribov , Konstantin Khlebnikov , Sasha Levin , Christoph Lameter , Joonsoo Kim , Dave Hansen , Andi Kleen , x86@kernel.org, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Jonathan Corbet , Andy Lutomirski , "open list:DOCUMENTATION" On Thu, 29 Jan 2015 18:11:46 +0300 Andrey Ryabinin wrote: > This patch adds arch specific code for kernel address sanitizer. > > 16TB of virtual addressed used for shadow memory. > It's located in range [ffffec0000000000 - fffffc0000000000] > between vmemmap and %esp fixup stacks. > > At early stage we map whole shadow region with zero page. > Latter, after pages mapped to direct mapping address range > we unmap zero pages from corresponding shadow (see kasan_map_shadow()) > and allocate and map a real shadow memory reusing vmemmap_populate() > function. > > Also replace __pa with __pa_nodebug before shadow initialized. > __pa with CONFIG_DEBUG_VIRTUAL=y make external function call (__phys_addr) > __phys_addr is instrumented, so __asan_load could be called before > shadow area initialized. > > ... > > --- a/lib/Kconfig.kasan > +++ b/lib/Kconfig.kasan > @@ -5,6 +5,7 @@ if HAVE_ARCH_KASAN > > config KASAN > bool "AddressSanitizer: runtime memory debugger" > + depends on !MEMORY_HOTPLUG > help > Enables address sanitizer - runtime memory debugger, > designed to find out-of-bounds accesses and use-after-free bugs. That's a significant restriction. It has obvious runtime implications. It also means that `make allmodconfig' and `make allyesconfig' don't enable kasan, so compile coverage will be impacted. This wasn't changelogged. What's the reasoning and what has to be done to fix it? -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org