Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3817613pxk; Tue, 29 Sep 2020 07:04:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi034ZvIB73MQ9M3vU0IUjE47GPeqt2voj6AqJjptBGwH7G7v8c+xvTg4r0OhzYjMn4oAS X-Received: by 2002:a17:906:4087:: with SMTP id u7mr4043224ejj.466.1601388258175; Tue, 29 Sep 2020 07:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601388258; cv=none; d=google.com; s=arc-20160816; b=JPUy35vmx0Et6Tvg3gUsu1Tp9ZB0P+U7HTjnCetDN3LlNMceJDGkUm9wawBg1pbvAn PpKJimk8/XWP/yF7pcBAhhX3bdXrrizYadhHgdvex3wt1C1IH3ouRNk6g01pxgGSEvEl jNwf2fEXNx3wSpJskAsmrahAABuuqijI+Vlxj3mFueTqAP++6pPgamF7zYaPW9KQ/5ws FhxOW9JYoAh5tMtUCg7/lTHksgz+4hE5bEZp0A4wEwHWwc5hPN1PEGvkRilo3vqDU4Ul PIluz3DYfNy8OSvRIkrManwzKlTu703hYh5pNn22vguEI1xn1pX5fs6/taoEPiyogDrL mOqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=DWZoY0cfNfLiRVkVMiwHWltX/QEEJoUPsFYcZfXaYck=; b=sVfrs8Wx+vWHXCuaxIY0S+97AS3L9phN7Kf0CgusFxThbq1530VBOus3ZKXKcX1EST f434WcPIYbWjqUu5MsUpHRPV+t83VWu9/0bCNq9r5FmSK0LdX+bjgDzV79DZ6F1e0A7x UCpj4r7SbkPZiPd1xRv7K1zjKEkAFyKQrUu16Z11nSL3k55ncSFv/EM9GT2kxWYtUJJ0 kIFgpSVladzMgfRI+7w07cTar7Z7UXKw2MNmWly/ei2YARkkBfdqc9LCxUHW4CvzNvzn ltVRx2s0gGpb4W9K2gEa0Th6fIm9GlJ75666UJSIYKMrhxbfy4bsodK1rROR27C37tYQ NMYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pg3si2828026ejb.94.2020.09.29.07.03.54; Tue, 29 Sep 2020 07:04:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730657AbgI2OCh (ORCPT + 99 others); Tue, 29 Sep 2020 10:02:37 -0400 Received: from foss.arm.com ([217.140.110.172]:45442 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729073AbgI2OCh (ORCPT ); Tue, 29 Sep 2020 10:02:37 -0400 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 9C5AA31B; Tue, 29 Sep 2020 07:02:36 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.51.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 921A33F6CF; Tue, 29 Sep 2020 07:02:29 -0700 (PDT) Date: Tue, 29 Sep 2020 15:02:26 +0100 From: Mark Rutland To: Alexander Potapenko Cc: Will Deacon , Marco Elver , Andrew Morton , "H. Peter Anvin" , "Paul E. McKenney" , Andrey Konovalov , Andrey Ryabinin , Andy Lutomirski , Borislav Petkov , Catalin Marinas , Christoph Lameter , Dave Hansen , David Rientjes , Dmitriy Vyukov , Eric Dumazet , Greg Kroah-Hartman , Hillf Danton , Ingo Molnar , Jann Horn , Jonathan.Cameron@huawei.com, Jonathan Corbet , Joonsoo Kim , Kees Cook , Pekka Enberg , Peter Zijlstra , sjpark@amazon.com, Thomas Gleixner , Vlastimil Babka , the arch/x86 maintainers , "open list:DOCUMENTATION" , LKML , kasan-dev , Linux ARM , Linux Memory Management List Subject: Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64 Message-ID: <20200929140226.GB53442@C02TD0UTHF1T.local> References: <20200921132611.1700350-1-elver@google.com> <20200921132611.1700350-4-elver@google.com> <20200921143059.GO2139@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2020 at 05:25:11PM +0200, Alexander Potapenko wrote: > Will, > > > Given that the pool is relatively small (i.e. when compared with our virtual > > address space), dedicating an area of virtual space sounds like it makes > > the most sense here. How early do you need it to be available? > > How do we assign struct pages to a fixed virtual space area (I'm > currently experimenting with 0xffff7f0000000000-0xffff7f0000200000)? You don't. There should be a struct page for each of the /physical/ pages, and these can be found: * via the physical address, using phyts_to_page() or pfn_to_page() * via the linear/direct map, using virt_to_page() * via the vmalloc page tables using vmalloc_to_page() If you need virt_to_page() to work, the address has to be part of the linear/direct map. If you need to find the struct page for something that's part of the kernel image you can use virt_to_page(lm_alias(x)). > Looks like filling page table entries (similarly to what's being done > in arch/arm64/mm/kasan_init.c) is not enough. > I thought maybe vmemmap_populate() would do the job, but it didn't > (virt_to_pfn() still returns invalid PFNs). As above, I think lm_alias() will solve the problem here. Please see that and CONFIG_DEBUG_VIRTUAL. Thanks, Mark.