Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1357824pxb; Wed, 4 Nov 2020 06:58:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsUzRVgCpRxTLGG+27Pw5wFQckCwUfRTL2ez9wrtAAsQHvnsEyXHVZ6dnbw0hi8Kr02lsF X-Received: by 2002:a05:6402:b3b:: with SMTP id bo27mr12809099edb.376.1604501933676; Wed, 04 Nov 2020 06:58:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604501933; cv=none; d=google.com; s=arc-20160816; b=kang33wZ2yon9Pu/Gw2ndhooOdxx5vvo4D2IoxxspmXvPhfkV/lBmnEh83NinMbfEJ FeH977+8yvOSlyhUa4mWqMPP6u/E/2ITjoSFB1xuuqL4PRYrqtZ3Hr+rVPQ/UHspJYgH ElRVKTT+L8K81o35qcK9ZCGcJIlHyEHM5E9uba4nw+jp9kZ4K95l4J/dHqMmE6QtVflG w1PqxiqdxLIug2MgU/drPoaL2flnsvvj2+WmKCtyHl7bZpivfAJiI7yJbL2E9DO5uSSi qIzveBL7XRdJZ1Xvh38FZDtfEclFaQAWYvCTKXKyXBhJa6UosJ68caKhHyYpNCy4plAm sNUQ== 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=ctgVuI2WzWuLNSsVtP9t1O/ZNnmXGm3NLFiCjNDraUM=; b=0EnWP3yHajp+0V25auCPrf2Znf61v7zPZPlv2Y3dd8hVMdYZR7ixBpQFKO3V6kP3JM ga16j1f6HzCCVCuQYnh+4ZZosLunkZDLYBodjDRp1SBWd+H1NCGvUlpimvGK6ywLpNuM iS6naccBalj2vJuCmmjdw+WxGOEeN/fJ3TwBb2cWCAKbAIqi53wrZV8I/wvOPoNoXvEk 0/JFf6+pi+XMz0EqjBeJ4gYgVnpEZPbe26eNZ6Nnf0NsESx2swgbNx7CUE+CwiEJ9sQ+ M9UGAgIMe4k2KEcbV14YIEdrvqWWZuXAMnYgC4Aix8TB1+yKQUjp+npPeHI87Xs1piaM Iljg== 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 k6si1418199edr.114.2020.11.04.06.58.30; Wed, 04 Nov 2020 06:58:53 -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 S1730292AbgKDO40 (ORCPT + 99 others); Wed, 4 Nov 2020 09:56:26 -0500 Received: from foss.arm.com ([217.140.110.172]:38406 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730485AbgKDO4K (ORCPT ); Wed, 4 Nov 2020 09:56:10 -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 C1F0E139F; Wed, 4 Nov 2020 06:56:09 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.57.109]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DBD8C3F719; Wed, 4 Nov 2020 06:56:03 -0800 (PST) Date: Wed, 4 Nov 2020 14:56:01 +0000 From: Mark Rutland To: Marco Elver Cc: Andrew Morton , Alexander Potapenko , "H. Peter Anvin" , "Paul E. McKenney" , Andrey Konovalov , Andrey Ryabinin , Andy Lutomirski , Borislav Petkov , Catalin Marinas , Christoph Lameter , Dave Hansen , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Hillf Danton , Ingo Molnar , Jann Horn , Jonathan Cameron , Jonathan Corbet , Joonsoo Kim , =?utf-8?B?SsO2cm4=?= Engel , Kees Cook , Pekka Enberg , Peter Zijlstra , SeongJae Park , Thomas Gleixner , Vlastimil Babka , Will Deacon , the arch/x86 maintainers , "open list:DOCUMENTATION" , LKML , kasan-dev , Linux ARM , Linux Memory Management List Subject: Re: [PATCH v7 3/9] arm64, kfence: enable KFENCE for ARM64 Message-ID: <20201104145601.GB7577@C02TD0UTHF1T.local> References: <20201103175841.3495947-1-elver@google.com> <20201103175841.3495947-4-elver@google.com> <20201104130111.GA7577@C02TD0UTHF1T.local> 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 Wed, Nov 04, 2020 at 03:23:48PM +0100, Marco Elver wrote: > On Wed, 4 Nov 2020 at 14:06, Mark Rutland wrote: > > On Tue, Nov 03, 2020 at 06:58:35PM +0100, Marco Elver wrote: > > 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. > > Correct. > > > 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. > > Good idea, thanks. I guess there's no reason to not want to always > skip to instruction_pointer(regs)? I don't think we need the exception handling gunk in the trace, but note that you'd need to use stack_trace_save_regs(regs, ...) directly, rather than using stack_trace_save() and skipping based on instruction_pointer(regs). Otherwise, if the fault was somewhere in an exception handler, and we invoked the same function on the path to the kfence fault handler we might cut the trace at the wrong point. > In which case I can prepare a patch to make this change. If this > should go into a v8, please let me know. But it'd be easier as a > subsequent patch as you say, given it'll be easier to review and these > patches are in -mm now. I think it'd make more sense as a subsequent change, since it's liable to need a cycle or two of review, and I don't think it should block the rest of the series. Thanks, Mark.