Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754786AbbG0P7a (ORCPT ); Mon, 27 Jul 2015 11:59:30 -0400 Received: from foss.arm.com ([217.140.101.70]:54142 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752831AbbG0P71 (ORCPT ); Mon, 27 Jul 2015 11:59:27 -0400 Date: Mon, 27 Jul 2015 16:59:23 +0100 From: Catalin Marinas To: Andrey Ryabinin Cc: Will Deacon , linux-arm-kernel@lists.infradead.org, Alexey Klimov , Arnd Bergmann , linux-mm@kvack.org, Linus Walleij , linux-kernel@vger.kernel.org, David Keitel , Alexander Potapenko , Andrew Morton , Dmitry Vyukov Subject: Re: [PATCH v4 5/7] arm64: add KASAN support Message-ID: <20150727155922.GB350@e104818-lin.cambridge.arm.com> References: <1437756119-12817-1-git-send-email-a.ryabinin@samsung.com> <1437756119-12817-6-git-send-email-a.ryabinin@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1437756119-12817-6-git-send-email-a.ryabinin@samsung.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: 1374 Lines: 40 On Fri, Jul 24, 2015 at 07:41:57PM +0300, Andrey Ryabinin wrote: > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index 4d2a925..2cacf55 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -40,6 +40,12 @@ else > TEXT_OFFSET := 0x00080000 > endif > > +# KASAN_SHADOW_OFFSET = VA_START + (1 << (VA_BITS - 3)) - (1 << 61) > +KASAN_SHADOW_OFFSET := $(shell printf "0x%x\n" $$(( \ > + (-1 << $(CONFIG_ARM64_VA_BITS)) \ > + + (1 << ($(CONFIG_ARM64_VA_BITS) - 3)) \ > + - (1 << (64 - 3)) )) ) Does this work with any POSIX shell? Do we always have a 64-bit type? As I wasn't sure about this, I suggested awk (or perl). > +static void __init clear_pgds(unsigned long start, > + unsigned long end) > +{ > + /* > + * Remove references to kasan page tables from > + * swapper_pg_dir. pgd_clear() can't be used > + * here because it's nop on 2,3-level pagetable setups > + */ > + for (; start && start < end; start += PGDIR_SIZE) > + set_pgd(pgd_offset_k(start), __pgd(0)); > +} I don't think we need the "start" check, just "start < end". Do you expect a start == 0 (or overflow)? -- Catalin -- 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/