Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1285107pxb; Wed, 4 Nov 2020 05:08:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8dJw5tuyZD1LSnH1hssIkmF9x+nR4HX6e+tu6NZh7J6KYGLcN4KlCSFfO+dISiceE+l8e X-Received: by 2002:a17:906:1c8f:: with SMTP id g15mr24586999ejh.179.1604495334181; Wed, 04 Nov 2020 05:08:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604495334; cv=none; d=google.com; s=arc-20160816; b=N4Ny7DvtOCPjkNvf1qnjjf4wjoPzgjLRozVQsMoVn7XRsAR/LBBv/3XGfVM2WuUkeN HEay+4j+SC6GXRPWZAIMkU3TQTuZfUf2+Ks+58ENTENwZVIngqBN45sFXCOq8qbanmYf 7p6fWwL6m9p2tNDt+/Z28eE709PJAsXn20o0Ojtvtt2B6FCgEh97uxL/lQGDFzutrnG8 Ix16CEMqvx7KTKekN1hbG5ptolPAW86vpn4oBdHs4VxI0Hewta4r62s0JaVuJqN43ptx fq3wdHByDhMOBp6zSFQLGqWhHbR4sRX+REXKFglwxswKc2ELtgAl5pZMMspPBTLWoQ25 S36Q== 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=0x486GN3XGbl9tzPuRm5HyRGnSu1RYkhpCwVe6aq+Wo=; b=gssmATUrmnvx7zoxLvlYLmX42nu5ULB2ejWIHkplNxuiApi1tn6zRmIodDZcZ6EZIZ K1p0g8juXYZ3DMB5ig6VSEbEY3Cc1OOHSf9CMGHhCSgAyVPGwMqXrBqqSw3poIdB5Ev2 +f4lDF1wZen+3Sj7/DfMTDfQMqUMaHRgCj82+0Qu8HfybgNwMtemwGc9koIDo7dD8SGW A8yAVnHEbKFx/oW1kDJVBCE6ohg/H5c7EVoVGaSjbBoUtlyr44R1s/Np3oMh0ieUs4ZE o0PeJ5OZZcjGqXFzrtnEKhhNewXph6B9W6PCnsxq07yjzrjXYpt4HGZ4ke7iKFhvZSDW QxRA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qt2si1381185ejb.653.2020.11.04.05.08.31; Wed, 04 Nov 2020 05:08:54 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729851AbgKDNGw (ORCPT + 99 others); Wed, 4 Nov 2020 08:06:52 -0500 Received: from foss.arm.com ([217.140.110.172]:36860 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729183AbgKDNGw (ORCPT ); Wed, 4 Nov 2020 08:06:52 -0500 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 1F721139F; Wed, 4 Nov 2020 05:06:51 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.57.109]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 29D1D3F719; Wed, 4 Nov 2020 05:06:46 -0800 (PST) Date: Wed, 4 Nov 2020 13:06:37 +0000 From: Mark Rutland To: Marco Elver Cc: akpm@linux-foundation.org, glider@google.com, hpa@zytor.com, paulmck@kernel.org, andreyknvl@google.com, aryabinin@virtuozzo.com, luto@kernel.org, bp@alien8.de, catalin.marinas@arm.com, cl@linux.com, dave.hansen@linux.intel.com, rientjes@google.com, dvyukov@google.com, edumazet@google.com, gregkh@linuxfoundation.org, hdanton@sina.com, mingo@redhat.com, jannh@google.com, Jonathan.Cameron@huawei.com, corbet@lwn.net, iamjoonsoo.kim@lge.com, joern@purestorage.com, keescook@chromium.org, penberg@kernel.org, peterz@infradead.org, sjpark@amazon.com, tglx@linutronix.de, vbabka@suse.cz, will@kernel.org, x86@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Subject: Re: [PATCH v7 3/9] arm64, kfence: enable KFENCE for ARM64 Message-ID: <20201104130111.GA7577@C02TD0UTHF1T.local> References: <20201103175841.3495947-1-elver@google.com> <20201103175841.3495947-4-elver@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201103175841.3495947-4-elver@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 03, 2020 at 06:58:35PM +0100, Marco Elver wrote: > Add architecture specific implementation details for KFENCE and enable > KFENCE for the arm64 architecture. In particular, this implements the > required interface in . > > KFENCE requires that attributes for pages from its memory pool can > individually be set. Therefore, force the entire linear map to be mapped > at page granularity. Doing so may result in extra memory allocated for > page tables in case rodata=full is not set; however, currently > CONFIG_RODATA_FULL_DEFAULT_ENABLED=y is the default, and the common case > is therefore not affected by this change. > > Reviewed-by: Dmitry Vyukov > Co-developed-by: Alexander Potapenko > Signed-off-by: Alexander Potapenko > Signed-off-by: Marco Elver Thanks for dilligently handling all the review feedback. This looks good to me now, so FWIW: Reviewed-by: Mark Rutland There is one thing that I thing we should improve as a subsequent cleanup, but I don't think that should block this as-is. > +#define KFENCE_SKIP_ARCH_FAULT_HANDLER "el1_sync" IIUC, the core kfence code is using this to figure out where to trace from when there's a fault taken on an access to a protected page. It would be better if the arch code passed the exception's pt_regs into the kfence fault handler, and the kfence began the trace began from there. That would also allow for dumping the exception registers which can help with debugging (e.g. figuring out how the address was derived when it's calculated from multiple source registers). That would also be a bit more robust to changes in an architectures' exception handling code. Thanks, Mark.