From: Kees Cook <keescook@chromium.org>
To: Thomas Huth <thuth@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-nfs@vger.kernel.org,
"J. Bruce Fields" <bfields@fieldses.org>,
Chuck Lever <chuck.lever@oracle.com>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna.schumaker@netapp.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Iurii Zaikin <yzaikin@google.com>,
linux-s390@vger.kernel.org, Jia He <hejianet@gmail.com>,
Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Subject: Re: [PATCH 2/2] lockd: change the proc_handler for nsm_use_hostnames
Date: Thu, 16 Sep 2021 15:05:20 -0700 [thread overview]
Message-ID: <202109161503.07F872F6@keescook> (raw)
In-Reply-To: <20210803105937.52052-3-thuth@redhat.com>
On Tue, Aug 03, 2021 at 12:59:37PM +0200, Thomas Huth wrote:
> From: Jia He <hejianet@gmail.com>
>
> nsm_use_hostnames is a module parameter and it will be exported to sysctl
> procfs. This is to let user sometimes change it from userspace. But the
> minimal unit for sysctl procfs read/write it sizeof(int).
> In big endian system, the converting from/to bool to/from int will cause
> error for proc items.
>
> This patch use a new proc_handler proc_dobool to fix it.
>
> Signed-off-by: Jia He <hejianet@gmail.com>
> Reviewed-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
> [thuth: Fix typo in commit message]
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> fs/lockd/svc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
> index 2de048f80eb8..0ab9756ed235 100644
> --- a/fs/lockd/svc.c
> +++ b/fs/lockd/svc.c
> @@ -584,7 +584,7 @@ static struct ctl_table nlm_sysctls[] = {
> .data = &nsm_use_hostnames,
> .maxlen = sizeof(int),
For robustness, maybe this should be:
.maxlen = sizeof(nsm_use_hostnames),
> .mode = 0644,
> - .proc_handler = proc_dointvec,
> + .proc_handler = proc_dobool,
> },
> {
> .procname = "nsm_local_state",
> --
> 2.27.0
>
Reviewed-by: Kees Cook <keescook@chromium.org>
Also, I wonder what other BE-corrupted bools are out there?
--
Kees Cook
next prev parent reply other threads:[~2021-09-16 22:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-03 10:59 [PATCH 0/2] Fix /proc/sys/fs/nfs/nsm_use_hostnames on big endian machines Thomas Huth
2021-08-03 10:59 ` [PATCH 1/2] sysctl: introduce new proc handler proc_dobool Thomas Huth
2021-08-18 9:38 ` Thomas Huth
2021-09-16 5:16 ` Thomas Huth
2021-09-16 22:03 ` Kees Cook
2021-08-03 10:59 ` [PATCH 2/2] lockd: change the proc_handler for nsm_use_hostnames Thomas Huth
2021-09-16 22:05 ` Kees Cook [this message]
2021-08-03 14:08 ` [PATCH 0/2] Fix /proc/sys/fs/nfs/nsm_use_hostnames on big endian machines J. Bruce Fields
2021-08-03 14:24 ` Chuck Lever III
2021-08-04 2:12 ` Jia He
2021-08-09 17:50 ` Chuck Lever III
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=202109161503.07F872F6@keescook \
--to=keescook@chromium.org \
--cc=anna.schumaker@netapp.com \
--cc=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=hejianet@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=thuth@redhat.com \
--cc=trond.myklebust@hammerspace.com \
--cc=xinhui.pan@linux.vnet.ibm.com \
--cc=yzaikin@google.com \
/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).