From mboxrd@z Thu Jan 1 00:00:00 1970 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 2E1CAC19F2B for ; Fri, 29 Jul 2022 14:37:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6EFF58E0001; Fri, 29 Jul 2022 10:37:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 69EE86B0072; Fri, 29 Jul 2022 10:37:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 51AC18E0001; Fri, 29 Jul 2022 10:37:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 43BBA6B0071 for ; Fri, 29 Jul 2022 10:37:01 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1C859ABF88 for ; Fri, 29 Jul 2022 14:37:01 +0000 (UTC) X-FDA: 79740389442.16.9A9AB20 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf26.hostedemail.com (Postfix) with ESMTP id DA01E140022 for ; Fri, 29 Jul 2022 14:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659105419; x=1690641419; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=QFxIPJPgK4IPpJ/HviS1EILZsgjtlw3yJGq/7HtHu+I=; b=gWLkNY8Jx/Zxs91J1k2H+Yj2xV81vsQYDh4+LIkwjiErSJN8iMp3b6S1 0JFqDh9NtLG3DAy6Xo9zI8uRBQgxlTw2R49+ENl/wvDfIGONK6I/77bnc kaTvrO4FvCPQ3iSRfg+Qb7PYpWN4ZjvI3HUoOCRHbXvKTat5fxUlAiIPj e0TCgHA8nkNzT+TLPRNzEnmkm2ey+D6TpPPWNuViWl1I8qGvrTkjr/U+q /yViGyCnJ+7IrxMuzmMR4+O/H2iMAkdjePNL862IyHNFyRCQ+Qy90Q0/Z Ta0zCCWeTOxU2XJS6Db/h2zpgP5CNRA4fgZhvvYrVYpB9lpqZsRibPAYA A==; X-IronPort-AV: E=McAfee;i="6400,9594,10423"; a="289976619" X-IronPort-AV: E=Sophos;i="5.93,201,1654585200"; d="scan'208";a="289976619" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2022 07:36:56 -0700 X-IronPort-AV: E=Sophos;i="5.93,201,1654585200"; d="scan'208";a="704215764" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2022 07:36:53 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1oHR6g-001eZv-1G; Fri, 29 Jul 2022 17:36:50 +0300 Date: Fri, 29 Jul 2022 17:36:50 +0300 From: Andy Shevchenko To: Matthew Wilcox Cc: Mark Rutland , Jagdish Gediya , linux-kernel@vger.kernel.org, linux-mm@kvack.org, ying.huang@intel.com, dave.hansen@intel.com, Jonathan.Cameron@huawei.com, adobriyan@gmail.com, akpm@linux-foundation.org, rf@opensource.cirrus.com, pmladek@suse.com, will@kernel.org Subject: Re: [PATCH v3 1/2] lib/kstrtox.c: Add "false"/"true" support to kstrtobool() Message-ID: References: <20220426180203.70782-1-jvgediya@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=gWLkNY8J; spf=none (imf26.hostedemail.com: domain of andriy.shevchenko@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=andriy.shevchenko@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659105420; a=rsa-sha256; cv=none; b=KeV+j8bgG3efkidz5pzkpyaAUDqvZYIiNz8v6T4Ts/ZJXao3FbPHJEP+IqLv4NU1iwqg52 sCRb45c+fByGtRuwYuD0YlcE/bbRDdr63RpfoQ+BaNMv2LqltxhkHF1y0MdfFm4Azlgn+0 GrO1QYCqm/YGCLpMxbF0B3Jp0h4Qkz8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659105420; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+2TWPagBK4bnGBPyxWnpDDPXnfTOm1MX0yfpcIhlfzY=; b=dv8MaHRtBKXqMeqUSLHnyVrfnHOzCn8JWSNNrUFQTbLG+CGu9fGGTm/uOBGeCrtaxNQOJW BDaN6CwdS1Fxe+TUEByniToLpq9UIPGS0STs3LtsZJizGflBYOd4tGTlQVCavPDXwcm8CY bUP+ufb1wOu0XfzEcy+SpUD/gf1Nc1Q= X-Rspamd-Queue-Id: DA01E140022 Authentication-Results: imf26.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=gWLkNY8J; spf=none (imf26.hostedemail.com: domain of andriy.shevchenko@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=andriy.shevchenko@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) X-Rspamd-Server: rspam01 X-Rspam-User: X-Stat-Signature: psce7ux7r8bz1ge8757r39w4bho9zrcr X-HE-Tag: 1659105418-854123 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: On Fri, Jul 29, 2022 at 05:35:26PM +0300, Andy Shevchenko wrote: > On Mon, Jul 25, 2022 at 04:21:11PM +0100, Matthew Wilcox wrote: > > On Mon, Jul 25, 2022 at 03:55:27PM +0100, Mark Rutland wrote: > > > On Tue, Apr 26, 2022 at 11:32:02PM +0530, Jagdish Gediya wrote: > > > > At many places in kernel, It is necessary to convert sysfs input > > > > to corrosponding bool value e.g. "false" or "0" need to be converted > > > > to bool false, "true" or "1" need to be converted to bool true, > > > > places where such conversion is needed currently check the input > > > > string manually, kstrtobool() can be utilized at such places but > > > > currently it doesn't have support to accept "false"/"true". > > > > > > > > Add support to accept "false"/"true" as valid string in kstrtobool(). > > > > > > > > Signed-off-by: Jagdish Gediya > > > > Reviewed-by: Matthew Wilcox (Oracle) > > > > > > I've just spotted that this broke arm64's "rodata=full" command line option, > > > > That isn't a documented option. > > > > rodata= [KNL] > > on Mark read-only kernel memory as read-only (default). > > off Leave read-only kernel memory writable for debugging. > > > > Hopefully this is an object lesson in why you need to update the > > documentation when you extend a feature. > > > > > since "full" gets parsed as 'f' = FALSE, when previously that would have been > > > rejected. So anyone passing "rodata=full" on the command line will have rodata > > > disabled, which is not what they wanted. > > > > > > The current state of things is a bit messy (we prase the option twice because > > > arch code needs it early), and we can probably fix that with some refactoring, > > > but I do wonder if we actually want to open up the sysfs parsing to accept > > > anything *beginning* with [tTfF] rather than the full "true" and "false" > > > strings as previously, or whether it's worth reverting this for now in case > > > anything else is affected. > > > > Well, that's going to break people who've started using the new option. > > As a quick fix, how about only allowing either "f\0" or "fa"? > > I think we need to be more strict in kstrtobool(), i.e. 'f\0' ('t\0') and 'fal' > ('tru') perhaps? Actually kstrtobool() has been designed as a generic parser that should have lowest priority. It means that the code that uses it should take care of any other custom cases _before_ calling for kstrtobool(). -- With Best Regards, Andy Shevchenko