Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2403122rdb; Mon, 20 Nov 2023 09:48:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHupBRx93UQwKJnifWRrvCs1dIsfRNj6I3nbA/3rY3rX6Y5w9IVyHL5pu5LLHYMclpyQRuP X-Received: by 2002:a17:903:41c3:b0:1ca:a290:4c0c with SMTP id u3-20020a17090341c300b001caa2904c0cmr7058800ple.16.1700502497814; Mon, 20 Nov 2023 09:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700502497; cv=none; d=google.com; s=arc-20160816; b=JywWFwqIUjkfjxsHMJfK9QGMUiy4QB6ZBuq8b3jrN6DE36ykWBSxyITP1j5Pf+GglI L7PFxuwC5ea4MzTQnXnCGChFSDz1ynKSH4LPCCaSPCR1sVYN4/zmPrrfHUu0plg07b3h Q/KJKDBixacMckj5o8miRFLgvtZPH2hJxEk0oj+bPuYFKTC0o/PuABqZNYdyCYC+e2Uv uRtRbiov0cN1HfKWRdqfAgY0tq91X6qAOMAw+57Pw5ZYfHzfiaWnL+Z/mGD9uj50L3yh eVDd3sPei6OHN3NL2MsUNmIdWWYqwC1yTwbg8uiTNq4A0M5UCiqnpT4+9Foonw/SB3pK TVQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9mwqfN/pqk9HRQ931HoPPP333OlumxbY++YPCTeY76U=; fh=qWoxmPN1zRqnLSoCWGpfFsDtzJsx/SGdqx98lbP+Uho=; b=r7CtdSe/dU2lZc8YazwtBgKKJH8tgdQAJC2q1uIfwOCqnwqLmd9V1USMC4YauQyouB N73uafLHjwZAYRXHVvCQ2/R7/dHyXAtPbMomvHucIQntIZM21Q0XzCd7V7ZIkcIDJs6E WcoK0zNc3owcKNhj59lGwED/9q7d0FN9R2HHfWp/kV3c/klqjj0qv79gK6v+vg6rv9r2 ycrmzxW/5JFNHYg+Pou0dDHHLgLAnftUKFzYWGwkdk5x2XCdSlV5FZtwvW7QgaQrI36l 95TeaW/jLSdUFcj69YpnwEOozUvLE5Tfy6BNBsdyuvTHu5IPIEL6IrVU6wohN10oWvHv ya3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="bR/I30d5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i17-20020a170902c95100b001c3411c9b83si8782521pla.454.2023.11.20.09.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:48:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="bR/I30d5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4DD6C80A90DA; Mon, 20 Nov 2023 09:48:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231136AbjKTRre (ORCPT + 99 others); Mon, 20 Nov 2023 12:47:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232359AbjKTRrc (ORCPT ); Mon, 20 Nov 2023 12:47:32 -0500 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [IPv6:2001:41d0:203:375::bd]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FB29BA for ; Mon, 20 Nov 2023 09:47:29 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1700502447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9mwqfN/pqk9HRQ931HoPPP333OlumxbY++YPCTeY76U=; b=bR/I30d5ng/lYBtNQqgdoGfH5paO2CtcP21wojJGbtHFG33q9OSF6VODY4kRaiORiokLQo iZpd9D4Xa29yBgsAA1WjhOAcCg0lSOCGSH3njrApHXcLDY08VxXeaX0yqJ6yzjAbR1DXy7 0Hwm3iz+UTEkMpPA3RFCPkvRL0wjaJM= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v4 01/22] lib/stackdepot: print disabled message only if truly disabled Date: Mon, 20 Nov 2023 18:46:59 +0100 Message-Id: <73a25c5fff29f3357cd7a9330e85e09bc8da2cbe.1700502145.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:48:06 -0800 (PST) From: Andrey Konovalov Currently, if stack_depot_disable=off is passed to the kernel command-line after stack_depot_disable=on, stack depot prints a message that it is disabled, while it is actually enabled. Fix this by moving printing the disabled message to stack_depot_early_init. Place it before the __stack_depot_early_init_requested check, so that the message is printed even if early stack depot init has not been requested. Also drop the stack_table = NULL assignment from disable_stack_depot, as stack_table is NULL by default. Fixes: e1fdc403349c ("lib: stackdepot: add support to disable stack depot") Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov --- lib/stackdepot.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/stackdepot.c b/lib/stackdepot.c index 2f5aa851834e..0eeaef4f2523 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -101,14 +101,7 @@ static int next_pool_required = 1; static int __init disable_stack_depot(char *str) { - int ret; - - ret = kstrtobool(str, &stack_depot_disabled); - if (!ret && stack_depot_disabled) { - pr_info("disabled\n"); - stack_table = NULL; - } - return 0; + return kstrtobool(str, &stack_depot_disabled); } early_param("stack_depot_disable", disable_stack_depot); @@ -130,6 +123,15 @@ int __init stack_depot_early_init(void) return 0; __stack_depot_early_init_passed = true; + /* + * Print disabled message even if early init has not been requested: + * stack_depot_init() will not print one. + */ + if (stack_depot_disabled) { + pr_info("disabled\n"); + return 0; + } + /* * If KASAN is enabled, use the maximum order: KASAN is frequently used * in fuzzing scenarios, which leads to a large number of different @@ -138,7 +140,11 @@ int __init stack_depot_early_init(void) if (kasan_enabled() && !stack_bucket_number_order) stack_bucket_number_order = STACK_BUCKET_NUMBER_ORDER_MAX; - if (!__stack_depot_early_init_requested || stack_depot_disabled) + /* + * Check if early init has been requested after setting + * stack_bucket_number_order: stack_depot_init() uses its value. + */ + if (!__stack_depot_early_init_requested) return 0; /* -- 2.25.1