From patchwork Thu Oct 26 20:28:16 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: 13437854 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AD51C25B48 for ; Thu, 26 Oct 2023 20:28:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 687E78D0031; Thu, 26 Oct 2023 16:28:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6111C8D0001; Thu, 26 Oct 2023 16:28:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B1608D0031; Thu, 26 Oct 2023 16:28:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 346418D0001 for ; Thu, 26 Oct 2023 16:28:30 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1007F160406 for ; Thu, 26 Oct 2023 20:28:30 +0000 (UTC) X-FDA: 81388750380.29.D972074 Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) by imf02.hostedemail.com (Postfix) with ESMTP id 1986A8001A for ; Thu, 26 Oct 2023 20:28:27 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=W2lYs0jB; spf=pass (imf02.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.218.175.175 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698352108; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=kXYcCHbJg58Ieumk8Pr2f/O/cn/d7Aaxj+WCDVOiCJ4=; b=xjEpLoqkBdUeL+83uAZCGqcqdNUWCNERBkf62106QfQNwC4kP7Pa4NblwiV35QTcNovT/F xDpcr7kIiikwjjgkWWP5gpF7mgKRcFWUuOf3mnJ/+BlNiU36xz41+LqkFJWTKAd1GxaDeI HBl+ZQfMbVTG3wioCVf6W1eXwTyrBpM= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=W2lYs0jB; spf=pass (imf02.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.218.175.175 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698352108; a=rsa-sha256; cv=none; b=dJlw1OFAo1l7wt1c5RA5To3PgMn0HuPZNiJkvPd3+KsFdScczCM8o96e5aPCsvA1w1oPmb 0vPcKxfGEtZiDqqF0gAJtKwKcyDiacnpSTtgdw3j8ovlQXznPgIpnvwupyZlaF+qi+RVdn 9oD7D3zLpXkGucuGHw7HYc2xkqrom8s= 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 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 1986A8001A X-Rspam-User: X-Stat-Signature: 74bw7gep9nkda7qqax6c9iuei18tarex X-Rspamd-Server: rspam01 X-HE-Tag: 1698352107-868551 X-HE-Meta: U2FsdGVkX18GS0ZaebfYdued8wby7QG0Mhlv1pojTukiZ05G5Xq3kE1gEZ7kZpTm9wFpFVnQnJZ0R3kVXpJTed+v8KNOPkU2GSEpshgE1PRPzaeDUAemmT9rDHxSmZbUmr6Bq8OPl5vHPOOratxeUYUqSoZdbQhiQbrTBh1ExhsUYYq4rKBnUV2yMOldQE4mCRm6eq6r0IvEMJgOPJHraf1EF/phMOHeD94V8ozNExAwMYNhsqCFwdTrTOhlueSDTP/TcA5761F0pnw9SvNKjC/D853OM1f3mghwfnULBX+7QLQnSeu7Bi2xkmJsW8grdTGtAytebDCXnJJHI1VkqfkbxQk+ERDYFX0KVHwtjbLsLLRWI3QFxIvNSci5Kdjn/3Z0W+Ptm70GyMDTgTFKyz8SKj9Kxxgl69c5FRw/I82k7p54lv8F2Vl0PhRfdluTJ7Gl6hwjUp+tU2aTxEwZzJPL5Y6mYxP25EpEWnRH41LSfQrQHqhzdeE6V7ZU9C6gFQWpekVCeefSr9HffDGsM1Az4oalnWzZNt9suRHtZB/lw2ge19WA1Mz3VECH+KzyrcDuMX3bvmPi1F/8ALMncsG3UitMQ/0kyKFB3mO6GzryNWHdxyIhsO2fl0VidY1W2r1Z4HdzEO04j7P7RcyPBVNCchBD+Rm0xF0X88CFJ0mpV6Pcm5IqSnFosNwoBQpK4vD+W/ALfuTCku+y0NdR61Vl6QyredS6dIr/z7U8GvfGtc1KgP4YDv4Sjrt0BmGEfETMPWviPjhGGfXGxnqoBMBgNwG4X+/H1fxgdoB9eXB0QcQIXJIw+EcN11+zFM9YzkCJDnQ3Jul0Z5rxnusK+8QA2OH9d09++iDxcJ5CVD18HCpNH9YTatD/HBBFyHU0mkVuiym8IMMGUosBU5Ke7u4x9tuKh4uequ7JkwHe/Q0YeJnKiK4FLJpivB45/54qAaoGRLTJNCT4MdvccaU 4oq5rvLp geF3IOlImSS+oqdJVXRuxCrE5V2CR4gOnN1se+IdW249zRhc4rlFAR1kACDYs2PFmlrvUov3NHPeqi2CsJjf6xDyoXw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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; /*