From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762681AbbA3QP5 (ORCPT ); Fri, 30 Jan 2015 11:15:57 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:54483 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762475AbbA3QPy (ORCPT ); Fri, 30 Jan 2015 11:15:54 -0500 X-AuditID: cbfec7f4-b7f126d000001e9a-91-54cbada50c49 Message-id: <54CBAE2E.2030106@samsung.com> Date: Fri, 30 Jan 2015 19:15:42 +0300 From: Andrey Ryabinin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-version: 1.0 To: Andrew Morton 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" Subject: Re: [PATCH v10 02/17] x86_64: add KASan support 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> <20150129151224.4e7947af78605c199763102c@linux-foundation.org> In-reply-to: <20150129151224.4e7947af78605c199763102c@linux-foundation.org> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRmVeSWpSXmKPExsVy+t/xq7pL154OMbhyxtLi996ZrBZz1q9h szhy7Tu7xfVvbxgtnhxoZ7T49PIBo8Xzhw/ZLSY8bGO3mLZR3GJldzObxfZnb5ksVnY+YLVY 2LaExeLyrjlsFvfW/Ge1WL22gdXi0oEFTBaLj9xmtnj3bDKzxeZNU5ktfmx4zOog6nH/zV8W j/k7PzJ67Jx1l91jwaZSj8V7XjJ5bFrVyeax6dMkdo+ut1eYPN6dO8fucWLGbxaPJ1emM3ks 7pvM6vHx6S0Wj/f7rrJ5fN4k53Gi5QtrgEAUl01Kak5mWWqRvl0CV8bpNcfZCx7xVTzoncLY wPiTu4uRk0NCwERi+swmFghbTOLCvfVsXYxcHEICSxklpp6dCOU0M0n8u9fG1MXIwcEroCVx eJ8RSAOLgKrEytav7CA2m4CexL9Z29lAbFGBCIkPq76C2bwCghI/Jt8DWyAioCux6vkuZpCZ zAJ3WSWafi1kBEkIC1hIrP+0khViWQOTxOs5+8E6OAW8JY6tPMQIspgZaMP9i1ogYWYBeYnN a94yT2AUmIVkxyyEqllIqhYwMq9iFE0tTS4oTkrPNdQrTswtLs1L10vOz93ECIntLzsYFx+z OsQowMGoxMN7I/F0iBBrYllxZe4hRgkOZiUR3imTgEK8KYmVValF+fFFpTmpxYcYmTg4pRoY EzyWSzVl9D1cueqhptq5kHvC6bZ5AQH95zZzClUrH7aYlPK22+fIP6dlAoH/exP4H7re+i8q d4FhjkyfkcPuj4fYbWqVjMWrm/WLW7LmrWG++W9NvXOaW6Z3cEy2uvxkGX4fndpb5tnsmvNW GXR8Ty10W7l1N5PcMo0ei/rN94qCWHT33lRiKc5INNRiLipOBAAihwnfywIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/30/2015 02:12 AM, Andrew Morton wrote: > 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? > Yes, this is runtime dependency. Hot adding memory won't work. Since we don't have shadow for hotplugged memory, kernel will crash on the first access to it. To fix this we need to allocate shadow for new memory. Perhaps it would be better to have a runtime warning instead of Kconfig dependecy?