Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965439AbbHKQhT (ORCPT ); Tue, 11 Aug 2015 12:37:19 -0400 Received: from foss.arm.com ([217.140.101.70]:54285 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965400AbbHKQhP (ORCPT ); Tue, 11 Aug 2015 12:37:15 -0400 Date: Tue, 11 Aug 2015 17:37:10 +0100 From: Catalin Marinas To: Andrey Ryabinin Cc: Will Deacon , linux-arm-kernel@lists.infradead.org, Yury , Alexey Klimov , Arnd Bergmann , linux-mm@kvack.org, Linus Walleij , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, David Keitel , Alexander Potapenko , "Aneesh Kumar K.V" , Michal Marek , Andrew Morton , Dmitry Vyukov Subject: Re: [PATCH v5 5/6] arm64: add KASAN support Message-ID: <20150811163709.GI23307@e104818-lin.cambridge.arm.com> References: <1439259499-13913-1-git-send-email-ryabinin.a.a@gmail.com> <1439259499-13913-6-git-send-email-ryabinin.a.a@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1439259499-13913-6-git-send-email-ryabinin.a.a@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1780 Lines: 37 On Tue, Aug 11, 2015 at 05:18:18AM +0300, Andrey Ryabinin wrote: > This patch adds arch specific code for kernel address sanitizer > (see Documentation/kasan.txt). > > 1/8 of kernel addresses reserved for shadow memory. There was no > big enough hole for this, so virtual addresses for shadow were > stolen from vmalloc area. > > At early boot stage the whole shadow region populated with just > one physical page (kasan_zero_page). Later, this page reused > as readonly zero shadow for some memory that KASan currently > don't track (vmalloc). > After mapping the physical memory, pages for shadow memory are > allocated and mapped. > > Functions like memset/memmove/memcpy do a lot of memory accesses. > If bad pointer passed to one of these function it is important > to catch this. Compiler's instrumentation cannot do this since > these functions are written in assembly. > KASan replaces memory functions with manually instrumented variants. > Original functions declared as weak symbols so strong definitions > in mm/kasan/kasan.c could replace them. Original functions have aliases > with '__' prefix in name, so we could call non-instrumented variant > if needed. > Some files built without kasan instrumentation (e.g. mm/slub.c). > Original mem* function replaced (via #define) with prefixed variants > to disable memory access checks for such files. > > Signed-off-by: Andrey Ryabinin > Tested-by: Linus Walleij Reviewed-by: Catalin Marinas -- 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/