Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp743432pxb; Thu, 31 Mar 2022 16:45:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFf2t2i546IPxJ1zIY5q4oLiKAGn7g0SAzkTIjMt/855l63lUAl/AbYsaMa9lSOD56lYaO X-Received: by 2002:a17:907:7f0b:b0:6e0:a336:a3f5 with SMTP id qf11-20020a1709077f0b00b006e0a336a3f5mr6619957ejc.541.1648770331312; Thu, 31 Mar 2022 16:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648770331; cv=none; d=google.com; s=arc-20160816; b=rbbdq+4wFLRzb13otCHEVNxybYiPMUOKKTvp25lv1daqFiyn1OSVCqE21/yyyKZOXE LL/oRFHfKvCW27wd4Ms4X1O4YVMIFGghfHhtQERxN3wL7mAa4WG+eWa+oe0v1QGqhVOD nuZ8fz5YvWcO3Y5/cNc/uGsW4Q+gUUtUbsYmEaPp6nUBpFitleLtTGEm/q7d1pi6PVwA l8EuIVAOQ03CaN8KcgYyE16WC7VhyIty78HbkTsMB2ASZYpkRtV50dPpriHFnq19EaTN cUNjhSHdxa4cVm8pmCRV4DZDbDjkmaYnSZn0hrWKdms14NLRzdxzkZWJNdlhWo07WG+L nmWA== 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=uimB3CbDpS0DUMhyGl7lXwsqLbLRgTTv+8wuN43Tu1A=; b=q8q0r36OYGuxB3qjBosXY3yO8451jVJBaqv1onau0LUsaJaIIQjjisdg9qbBDDOzML QqKY7v4y+29Dx278xhPgr6o+wE/gzpmhNWpx6pUK4EuCtyNruv3ALJrfLCApaG90fFG8 /R32EyueecA6Ly12viMEqtBcq29w5eURBoPpJIsalBsSFh+FRR4kU/B/g2druHsVJ5fH ZOMz81+bbByG/kh+/yX5yk//7rhtaW4UPiA4rTnZ4oiho8l4Qus3HQmp2NgGNkE/U6lJ QZZ+fHGDx8ZD18jnb7oqQHNkY4RYwzAUTv+N+p0axpuJ/ePRWbh7wLZG4NUwrppsRbDy EVgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a056402358c00b00418ff2e4cf9si583450edc.538.2022.03.31.16.45.04; Thu, 31 Mar 2022 16:45:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232942AbiCaMlA (ORCPT + 99 others); Thu, 31 Mar 2022 08:41:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236191AbiCaMk7 (ORCPT ); Thu, 31 Mar 2022 08:40:59 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 042AD117CBA for ; Thu, 31 Mar 2022 05:39:12 -0700 (PDT) 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 B975123A; Thu, 31 Mar 2022 05:39:11 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.21.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0BA223F718; Thu, 31 Mar 2022 05:39:08 -0700 (PDT) Date: Thu, 31 Mar 2022 13:39:01 +0100 From: Mark Rutland To: andrey.konovalov@linux.dev Cc: Marco Elver , Alexander Potapenko , Catalin Marinas , Will Deacon , Andrew Morton , Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Vincenzo Frascino , Sami Tolvanen , Peter Collingbourne , Evgenii Stepanov , Florian Mayer , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: Re: [PATCH v2 0/4] kasan, arm64, scs, stacktrace: collect stack traces from Shadow Call Stack Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 31, 2022 at 10:54:08AM +0100, Mark Rutland wrote: > On Wed, Mar 23, 2022 at 04:32:51PM +0100, andrey.konovalov@linux.dev wrote: > > From: Andrey Konovalov > > > > kasan, arm64, scs, stacktrace: collect stack traces from Shadow Call Stack > > > > Currently, KASAN always uses the normal stack trace collection routines, > > which rely on the unwinder, when saving alloc and free stack traces. > > > > Instead of invoking the unwinder, collect the stack trace by copying > > frames from the Shadow Call Stack whenever it is enabled. This reduces > > boot time by 30% for all KASAN modes when Shadow Call Stack is enabled. > > That is an impressive number. TBH, I'm shocked that this has *that* much of an > improvement, and I suspect this means we're doing something unnecssarily > expensive in the regular unwinder. I've had a quick look into this, to see what we could do to improve the regular unwinder, but I can't reproduce that 30% number. In local testing the worst can I could get to was 6-13% (with both the stacktrace *and* stackdepot logic hacked out entirely). I'm testing with clang 13.0.0 from the llvm.org binary releases, with defconfig + SHADOW_CALL_STACK + KASAN_