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 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B19B6C636CA for ; Wed, 21 Jul 2021 13:55:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 49C6D60FED for ; Wed, 21 Jul 2021 13:55:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49C6D60FED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dtnr.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0BA016B0033; Wed, 21 Jul 2021 09:55:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 06BAE6B0072; Wed, 21 Jul 2021 09:55:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E74946B0078; Wed, 21 Jul 2021 09:55:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id AEABA6B0033 for ; Wed, 21 Jul 2021 09:55:30 -0400 (EDT) Received: from forelay.prod.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by fograve02.hostedemail.com (Postfix) with ESMTP id 1AD7822BFA for ; Wed, 21 Jul 2021 07:59:50 +0000 (UTC) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AC80E8248076 for ; Wed, 21 Jul 2021 07:59:49 +0000 (UTC) X-FDA: 78385846098.19.522DC92 Received: from mail-gateway-shared10.cyon.net (mail-gateway-shared10.cyon.net [194.126.200.61]) by imf19.hostedemail.com (Postfix) with ESMTP id 3C6DEB0000B3 for ; Wed, 21 Jul 2021 07:59:49 +0000 (UTC) Received: from s054.cyon.net ([149.126.4.63]) by mail-gateway-shared10.cyon.net with esmtpsa (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim) (envelope-from ) id 1m678q-0006um-6Z for linux-mm@kvack.org; Wed, 21 Jul 2021 09:59:46 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=maniswebdesign.ch; s=default; h=Content-Transfer-Encoding:MIME-Version: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description; bh=Mgl+Cw1GbbS3/FNcfpdOQxQiTKX+cwvXtqvdd711W6Q=; b=lJ8aXYNdWU7D9/LSzaCHB8jAt2 lExtNSRl1ZBMh3s3pS8o8o7qQcl40ha+bf64keHKwi7BjKh4E02MmdcfaPSr9/hdMjHhb+BZdiIPQ UME+2gf/aLk3OGj3PSv4Rwy/e67qNx2zmgEtiAszHC3pU+CpdFATcov9vGrBgFD7Hqecdcw0f4TSG vVcepIinvMmokVd6BOrQemzRA436k5jkznztqpILZjyVZ9KJmoEOuf2HlHNn0GH2BNbSnq6C0KddH +XoyqK3X1QynuFMMqq5tLZkastIqwMXQEJXBIQ5lA5h7oYHS427b7LhcRy5oFEZORhmNzcyKgZ1uM H4my8MsA==; Received: from [10.20.10.233] (port=56734 helo=mail.cyon.ch) by s054.cyon.net with esmtpa (Exim 4.94.2) (envelope-from ) id 1m678o-00CkDK-Vm; Wed, 21 Jul 2021 09:59:43 +0200 Message-ID: <03b37a40f89aea548e6423f8c27160177bd32d43.camel@dtnr.ch> Subject: Re: [Bug 213785] New: hugetlbfs: interprets mode as decimal (was: hugetlbfs scrambles mode when sticky bit is set) From: Dennis Camera To: Mike Kravetz , Andrew Morton , David Howells , Al Viro Cc: bugzilla-daemon@bugzilla.kernel.org, linux-mm@kvack.org Date: Wed, 21 Jul 2021 09:59:42 +0200 In-Reply-To: <4a02aa78-c600-f2f4-c7d3-d79164c2c8a1@oracle.com> References: <20210720150704.59f78224be810a0cf9dd5f39@linux-foundation.org> <4a02aa78-c600-f2f4-c7d3-d79164c2c8a1@oracle.com> Organization: maniswebdesign Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - s054.cyon.net X-AntiAbuse: Original Domain - kvack.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - dtnr.ch X-Get-Message-Sender-Via: s054.cyon.net: authenticated_id: mail@maniswebdesign.ch X-Authenticated-Sender: s054.cyon.net: mail@maniswebdesign.ch X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3C6DEB0000B3 X-Stat-Signature: 8t6snwtaxf9hdpg87dpmk3jn9nrzq6x8 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=maniswebdesign.ch header.s=default header.b=lJ8aXYNd; spf=none (imf19.hostedemail.com: domain of bugs@dtnr.ch has no SPF policy when checking 194.126.200.61) smtp.mailfrom=bugs@dtnr.ch; dmarc=none X-HE-Tag: 1626854389-428772 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Dear Mike, On Tue, 20 Jul 2021 21:38 -0700 Mike Kravetz wrote: > I took a quick look and believe a change in behavior was caused by > commit 32021982a324 "Convert the hugetlbfs to use the fs_context > during mount". Thanks for taking a look at this issue and pointing to the commit that introduced this change. It looks credible. > Prior to the commit, code processing the mode option used > match_octal() to convert the command line string to a numeric value. > Since match_octal expects a string representing an octal value, it > does > not require a leading '0'. As a result, prior to this commit the > argument 'mode=3D1700' would result in a mode value of 01700. After > the > commit one must precede octal values with 0. So, mode=3D1700 would > result > in a mode value of 03244 (& 01777U) =3D 1244. I've been racking my brain trying to figure out what was going on, but the solution is so simple=E2=80=A6 > If my analysis is correct, I am not sure how to proceed. IMO, the > current behavior is 'more correct'. However, until v5.1 a preceeding > 0 > was not required when specifying mode for hugetlbfs. So, this was > certainly a change in behavior. Suggestions? Generally, I would agree that interpreting integers as decimals is the correct way, but in the case of file modes I cannot remember having used or seen modes in anything but octal over all the years I've been working with Linux. As I understand Documentation/admin-guide/mm/hugetlbpage.rst the mode option should be interpreted as octal: > The mode option sets [the mode] to value & 01777. This value is given in octal. By default the value 0755 is picked. Furthermore, I had a look at the POSIX documentation for chmod(1) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/chmod.html) which also interprets all integers as octals. So my suggestion would be to convert the mode option to a fsparam_u32oct and if possible backport this change to the supported >=3D5.1 kernel versions. Regards, Dennis