From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 565FEC4727C for ; Tue, 29 Sep 2020 15:07:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9AED92076B for ; Tue, 29 Sep 2020 15:07:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yPa6zfwM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9AED92076B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iNPug8Ew57DmuIzq7SMJYebA+coQVKaQA6LK1rzhHC0=; b=yPa6zfwM1p98whIx8g5js5hP7 d6l+ZLeEFJI2etTAQ8navxmF/GdgtKZkVNvIUlSYxhuA7B0LmztijVL6KFUNSeO66Q4hBJjA5gLXb FXwfj3fUiOf2B/xcrVRnM0x/dWS+/+3vowUBMwX1XQeQmBU69fcKpq2aUV5yGQdH75c+q2vdJwdit QqarOtXWiA9oMdRerrNdlogCyImm1OW6PB5u3fLup2M1rMt9/EFF//8vffz7utD3QgTI4GknDiTwI xBlqalamLcIySsztRWYLnyV64yP+G++qpdtlIJS6vExtNPlAo7ONJwc8c1j+Pasmzj1w1MDXZxtKL c0epKBVAQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNHCc-0007zd-Sk; Tue, 29 Sep 2020 15:06:02 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNHCa-0007yX-Ly for linux-arm-kernel@lists.infradead.org; Tue, 29 Sep 2020 15:06:01 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 566D91063; Tue, 29 Sep 2020 08:05:58 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.51.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BE43B3F6CF; Tue, 29 Sep 2020 08:05:51 -0700 (PDT) Date: Tue, 29 Sep 2020 16:05:49 +0100 From: Mark Rutland To: Marco Elver Subject: Re: [PATCH v3 01/10] mm: add Kernel Electric-Fence infrastructure Message-ID: <20200929150549.GE53442@C02TD0UTHF1T.local> References: <20200921132611.1700350-1-elver@google.com> <20200921132611.1700350-2-elver@google.com> <20200929142411.GC53442@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200929_110600_764970_0A8EA837 X-CRM114-Status: GOOD ( 25.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hillf Danton , "open list:DOCUMENTATION" , Peter Zijlstra , Catalin Marinas , Dave Hansen , Linux Memory Management List , Eric Dumazet , Alexander Potapenko , "H. Peter Anvin" , Christoph Lameter , Will Deacon , SeongJae Park , Jonathan Corbet , the arch/x86 maintainers , kasan-dev , Ingo Molnar , Vlastimil Babka , David Rientjes , Andrey Ryabinin , Kees Cook , "Paul E. McKenney" , Jann Horn , Andrey Konovalov , Borislav Petkov , Andy Lutomirski , Jonathan Cameron , Thomas Gleixner , Andrew Morton , Dmitry Vyukov , Linux ARM , Greg Kroah-Hartman , LKML , Pekka Enberg , Joonsoo Kim Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 29, 2020 at 04:51:29PM +0200, Marco Elver wrote: > On Tue, 29 Sep 2020 at 16:24, Mark Rutland wrote: > [...] > > > > From other sub-threads it sounds like these addresses are not part of > > the linear/direct map. Having kmalloc return addresses outside of the > > linear map is going to break anything that relies on virt<->phys > > conversions, and is liable to make DMA corrupt memory. There were > > problems of that sort with VMAP_STACK, and this is why kvmalloc() is > > separate from kmalloc(). > > > > Have you tested with CONFIG_DEBUG_VIRTUAL? I'd expect that to scream. > > > > I strongly suspect this isn't going to be safe unless you always use an > > in-place carevout from the linear map (which could be the linear alias > > of a static carevout). > > That's an excellent point, thank you! Indeed, on arm64, a version with > naive static-pool screams with CONFIG_DEBUG_VIRTUAL. > > We'll try to put together an arm64 version using a carveout as you suggest. Great, thanks! Just to be clear, the concerns for DMA and virt<->phys conversions also apply to x86 (the x86 virt<->phys conversion behaviour is more forgiving in the common case, but still has cases that can go wrong). Other than the code to initialize the page tables for the careveout, I think the carevout code can be geenric. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel