From patchwork Mon Nov 20 17:46:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 167313 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp105894vqb; Mon, 20 Nov 2023 09:48:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGXI7f2DSVGQB7SBXZqzf/m8NVbW34JEDur4GjY44/uXl8pZ/9D52POpipgCYnitGEa6iL X-Received: by 2002:a17:902:c40a:b0:1cc:3fce:8aa8 with SMTP id k10-20020a170902c40a00b001cc3fce8aa8mr6956260plk.6.1700502502092; Mon, 20 Nov 2023 09:48:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700502502; cv=none; d=google.com; s=arc-20160816; b=dV0OlPKjdHnpZMx9ZnhxEEuRt3tgcIUxES9kb8vMTeC+vjyNmHrkSrwmGAZQbRq0dv yiRMpgSnoc9R+VRYHEfi79T8IT72TVRRQbElKIb0hUdiHcJH4ok07Qx4SKSDX+1WY/sC RWtZKI5sJOZjWW1KaaX86lfx3k78zOZ7/ARaa7/sMzPLeJK++ly5rbaswk6DgKCZ+eIB VJ3khijAQmqtMUjJ0AdLIalasjqpz6hjBeh+QjFlBHH4g6f2BuaZaGBs7blL2JOm2LcY VwE43ueNtqNKX3hPDOfWacJgW+ilD0CZAiAoZBhe5BL3/TOB7PARFDuHVDUY4SqyxfOR f1Ug== 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 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id a4-20020a170902ee8400b001c61bd9db5csi8099594pld.317.2023.11.20.09.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:48:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; 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 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 38AC3804ADBF; Mon, 20 Nov 2023 09:48:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232871AbjKTRre (ORCPT + 27 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 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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:48:11 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783106111733371074 X-GMAIL-MSGID: 1783106111733371074 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 Reviewed-by: Oscar Salvador --- 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; /*