Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp708699rdh; Thu, 26 Oct 2023 13:28:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEol1V78z5ybqUNzVxPWm3YOXLCt97MnPiZPhK4BA/hWV671g8B6O2zsR48RkNev1yTZZUz X-Received: by 2002:a05:6808:2023:b0:3ae:1675:700e with SMTP id q35-20020a056808202300b003ae1675700emr529016oiw.36.1698352114677; Thu, 26 Oct 2023 13:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698352114; cv=none; d=google.com; s=arc-20160816; b=Eq8yP99MZny3U5IqiL20bggvGDNsv4DIuVMfu4iLGYwfQe9tkik9AIIoOu2dAo+n67 uuODEa/BT8ZzSpuSiJD4zdp+QkAGBqOOqPvzD4ieH49nTDwkuUoj1kxSsV3BBXluOzi5 QiyPORGqxlzw/aow1zxTxEsBFZtZuCrSq7b6BWCUJdr6Z0y0OiodcxxuIKSUkfukWAtE lpCJzQLjgCAndbqweRiVroCQtRLtDdYXCsbySnB7sHqZgI6D7T/4ZIrFXz5kqK7TYxpe PCfq59hTLIPvlbgtFSZKjZLVOcMk2m1s/SlBnPNM2xormmWaFd8ylNfA3pByXPShzPuB 6quQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=kXYcCHbJg58Ieumk8Pr2f/O/cn/d7Aaxj+WCDVOiCJ4=; fh=J1Qt2dYQZwHfoASHEf8Q1j6KnDtpzzpCUlDsDM7WT0M=; b=M+FOTqplDKKnON8+IXnZ1l3MulBi9kR4apBf0WkyjkZ0yuHjqg6yzZXQK/VfVHWvVO kTCgRraw4mU8RaZqlxANZTpw73JGwHo8Xv92mebyYIvQZzUhzu8aYYENmRbUKQ9IoIk1 gOoLH90xsXl6d5CvSRUjykyL13UPcsH53LcoSLbI49tQVvm4ONhTJXdEs8KxQVhwx7Ub s8drTNKxoLSnvB72HYMWkgA/YnxVAvNzUQtY2XXVIpK4A/E32tXw/wZntqnZvzdJxU1G R4GhQziF1mc4Pt3QqgwtqT/tnCCUb4t8nGkFANZeBC34egoOkjJinT7BfjQxsW5Oqp0S a3mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=W2lYs0jB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 201-20020a2503d2000000b00d9cb25e80fdsi246040ybd.278.2023.10.26.13.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 13:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=W2lYs0jB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 0A74E81A1E8E; Thu, 26 Oct 2023 13:28:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbjJZU2b (ORCPT + 99 others); Thu, 26 Oct 2023 16:28:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjJZU2a (ORCPT ); Thu, 26 Oct 2023 16:28:30 -0400 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [IPv6:2001:41d0:1004:224b::b3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68F29191 for ; Thu, 26 Oct 2023 13:28:27 -0700 (PDT) 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=1698352105; 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; bh=kXYcCHbJg58Ieumk8Pr2f/O/cn/d7Aaxj+WCDVOiCJ4=; b=W2lYs0jBZASwDmrGC7f3bhRJi1VgwgTxiQ3RIZjGLNNdTO8/OPBdW4X4uhHMYI5OiC8QGP ciJayvPMPDdB7OySvUkmjqVOmTGfr2FVLWNih5vlqS6+fVpQRGEEEUtyYehvMmDP6rye5y TUAua2T66HZ38KRK+FAe2C1E7oaBx5s= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH 1/1] lib/stackdepot: print disabled message only if truly disabled Date: Thu, 26 Oct 2023 22:28:16 +0200 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 26 Oct 2023 13:28:33 -0700 (PDT) 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") 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