Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2234316pxb; Wed, 30 Mar 2022 20:11:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuS97ccqIK3wfHPLjBkjFcW2Jrr/VBzoG03UuUObO5S2e12bcbUEWxsPbc94MtROsKH8cg X-Received: by 2002:a17:90b:3508:b0:1c6:e4f9:538b with SMTP id ls8-20020a17090b350800b001c6e4f9538bmr3706233pjb.158.1648696303309; Wed, 30 Mar 2022 20:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648696303; cv=none; d=google.com; s=arc-20160816; b=aqnk0guHDa29fNPMm8tLA+AA1/2sZaN1ZDvaxBEZCWnQ/WWl8sEi0zVCqOM0sdObkX gFbTRmsTt1i3BEx8vwu7+vw438mBlmW6VB4oHbRE5u3cV1YoLyMSG3rI/IFCRhXCwKaI O2opu67B8n+5ZvzXuJjI1nzNXV9rFARcpkOOVORyMWLrZpzz68I71Kntosx8XOLrpvSN MRgWEFbqSub1To6qAbo9Apv/cQYkzbti0R9lJOEZUKdtSbmq0PXMlmWPFv/Qrw8QhNFJ IVQhK+NNy9LkaywLZm6yUjfVN8IqlhfV8bD+yHAIXkwro9DOIOLlPnPMgDPwrjdU6I7M /O6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ZahETGQ5QFUGU9cdr5iIBFtuwsgQ6vA8xk/koQJqNS8=; b=FwTnOCoMzFqgHa5mbRtG3AHDGdqEL6LgKLN+tMxJdVegqvCTQ0LCOhc4KxdFFEqV/Q /f2kaxL1NMkYsSAXbrOnEoF0s2WB2znELTXVTEgVgKhXVnO6fmvDQRRM5MdcoLWV0Hhl igTLGrcLSvdtxoyU4CssABKHZVOEd1u8I31sgBmw8+rHANRA/wfUlFfe30rQQr26lyPE lkgyvsGuodtWuyRlh64HH9sTtoqWjUSVjhStPlJe8fuQ/fbwhg51HBFfqP9seeMZ8Urv wg/vqeQ+ordUPkBe+bWGh9dxGYlWHrpbIASdoRxCkAt0saEBvNGdvTbGR8qAaHBUNXhW F6wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hIo45tQd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 25-20020a630e59000000b003980091c8fasi19960973pgo.356.2022.03.30.20.11.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 20:11:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hIo45tQd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9E47FF65E7; Wed, 30 Mar 2022 19:47:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240604AbiC2Sim (ORCPT + 99 others); Tue, 29 Mar 2022 14:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240607AbiC2Sik (ORCPT ); Tue, 29 Mar 2022 14:38:40 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AEE618A788 for ; Tue, 29 Mar 2022 11:36:57 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id x4so22061975iop.7 for ; Tue, 29 Mar 2022 11:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZahETGQ5QFUGU9cdr5iIBFtuwsgQ6vA8xk/koQJqNS8=; b=hIo45tQdIyHSPqQxFA7cSGVqQAnnccWCcVxAPl+j61kcrTdvGs9L6Z7QfGblvZHskW /ZH26jVAGveFN3wqlh6mHLHWhTwxdwvTUpk7zKHOKHFw3WMnlBqLm8UVaxSt2JlujyDm wyATLvxsF6/pkIk4aBMtp+n9UZHgMCj4czzC8IONRr7cYeN1nxDL5Llqib9rAvl+eFXm bGOLbAsfBsQE4U4GVjXueGWhWegCAub+RhffcZF/FUlxuyCsgZBX9ZynT5LhrSqg+Qi6 40IqGBWNbKtEUnsLc052T7BhOiD0DtGVm6I9C72hjuJrArU9PpnkE4TJFmW9PFYxTHbC qu4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZahETGQ5QFUGU9cdr5iIBFtuwsgQ6vA8xk/koQJqNS8=; b=EdFcmlNvbisV3jNDlMHhK+JQTh1VlogYGuaqpABhK5Y6CcnhxBERFlyeJpsdbsWgHG pMaRR668ELNkuoAxlgk5hl6O5tmqSCvWwxSuPlGQxLkq90ktedA0ZKONym/eRZ27Inyg 8D4wu+ue8deZvJuazbypy0QYrAOQL3iSI2uQ9IJhKa7EJ1LtElKMQswz3N/A/OLUrGoR 77MtC/jdlGLH5wdgPq79hQzeqI+siqA2rPtEsjORCydp8XE8Ot/TrkGIqQmuu8CjFmmh bz0sXaDMkDa83Zl6ivn2AYt/Fx1psYaxQb09J9HhwamZuvqaoPdF0SKHk1K9Dal9AeI2 DSeg== X-Gm-Message-State: AOAM532vQ3itEDwVjtUGSQexSDUyeMJ/DKg5JdRC/42imp+C5GjHYA9y ULjBjpJ1W4Tr1nWBgi1Uy1LFe4h8xCmAFgo9x5U= X-Received: by 2002:a05:6602:3c5:b0:64c:727d:6e95 with SMTP id g5-20020a05660203c500b0064c727d6e95mr6978541iov.118.1648579017088; Tue, 29 Mar 2022 11:36:57 -0700 (PDT) MIME-Version: 1.0 References: <7027b9b6b0cae2921ff65739582ae499bf61470c.1648049113.git.andreyknvl@google.com> In-Reply-To: From: Andrey Konovalov Date: Tue, 29 Mar 2022 20:36:46 +0200 Message-ID: Subject: Re: [PATCH v2 4/4] kasan: use stack_trace_save_shadow To: Marco Elver Cc: andrey.konovalov@linux.dev, Alexander Potapenko , Catalin Marinas , Will Deacon , Andrew Morton , Dmitry Vyukov , Andrey Ryabinin , kasan-dev , Mark Rutland , Vincenzo Frascino , Sami Tolvanen , Peter Collingbourne , Evgenii Stepanov , Florian Mayer , Linux Memory Management List , LKML , Andrey Konovalov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, Mar 28, 2022 at 2:49 PM Marco Elver wrote: > > > diff --git a/mm/kasan/common.c b/mm/kasan/common.c > > index d9079ec11f31..8d9d35c6562b 100644 > > --- a/mm/kasan/common.c > > +++ b/mm/kasan/common.c > > @@ -33,10 +33,13 @@ > > depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc) > > { > > unsigned long entries[KASAN_STACK_DEPTH]; > > - unsigned int nr_entries; > > + unsigned int size; > > Why did this variable name change? So the lines below fit within one line. It won't be needed with the other change you suggested. > > - nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 0); > > - return __stack_depot_save(entries, nr_entries, flags, can_alloc); > > + if (IS_ENABLED(CONFIG_HAVE_SHADOW_STACKTRACE)) > > Would it be more reliable to check the return-code? I.e. do: > > int size; > > size = stack_trace_save_shadow(...) > if (size < 0) > size = stack_trace_save(...); Sounds good, will do in v3. Thanks!