From: Dennis Camera <bugs+kernel.org@dtnr.ch>
To: Mike Kravetz <mike.kravetz@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Howells <dhowells@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>
Cc: bugzilla-daemon@bugzilla.kernel.org, linux-mm@kvack.org
Subject: Re: [Bug 213785] New: hugetlbfs: interprets mode as decimal (was: hugetlbfs scrambles mode when sticky bit is set)
Date: Wed, 21 Jul 2021 09:59:42 +0200 [thread overview]
Message-ID: <03b37a40f89aea548e6423f8c27160177bd32d43.camel@dtnr.ch> (raw)
In-Reply-To: <4a02aa78-c600-f2f4-c7d3-d79164c2c8a1@oracle.com>
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=1700' would result in a mode value of 01700. After
> the
> commit one must precede octal values with 0. So, mode=1700 would
> result
> in a mode value of 03244 (& 01777U) = 1244.
I've been racking my brain trying to figure out what was going on, but
the solution is so simple…
> 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
>=5.1 kernel versions.
Regards,
Dennis
next prev parent reply other threads:[~2021-07-21 13:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-213785-27@https.bugzilla.kernel.org/>
2021-07-20 22:07 ` [Bug 213785] New: hugetlbfs scrambles mode when sticky bit is set Andrew Morton
2021-07-21 4:38 ` Mike Kravetz
2021-07-21 7:59 ` Dennis Camera [this message]
2021-07-21 11:57 ` Matthew Wilcox
2021-07-21 17:48 ` Mike Kravetz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=03b37a40f89aea548e6423f8c27160177bd32d43.camel@dtnr.ch \
--to=bugs+kernel.org@dtnr.ch \
--cc=akpm@linux-foundation.org \
--cc=bugzilla-daemon@bugzilla.kernel.org \
--cc=dhowells@redhat.com \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).