diff mbox series

[RESEND] nsfs: add compat ioctl handler

Message ID 20221214-nsfs-ioctl-compat-v1-1-3180bf297a02@weissschuh.net (mailing list archive)
State New, archived
Headers show
Series [RESEND] nsfs: add compat ioctl handler | expand

Commit Message

Thomas Weißschuh Jan. 11, 2023, 4:42 p.m. UTC
As all parameters and return values of the ioctls have the same
representation on both 32bit and 64bit we can reuse the normal ioctl
handler for the compat handler.

All nsfs ioctls return a plain "int" filedescriptor which is a signed
4-byte integer type on both 32bit and 64bit.
The only parameter taken is by NS_GET_OWNER_UID and is a pointer to a
"uid_t" which is a 4-byte unsigned integer type on both 32bit and 64bit.

Fixes: 6786741dbf99 ("nsfs: add ioctl to get an owning user namespace for ns file descriptor")
Reported-By: Karel Zak <kzak@redhat.com>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
As all parameters and return values of the ioctls have the same
representation on both 32bit and 64bit we can reuse the normal ioctl
handler for the compat handler.

All nsfs ioctls return a plain "int" filedescriptor which is a signed
4-byte integer type on both 32bit and 64bit.
The only parameter taken is by NS_GET_OWNER_UID and is a pointer to a
"uid_t" which is a 4-byte unsigned integer type on both 32bit and 64bit.
---
To: Alexander Viro <viro@zeniv.linux.org.uk>
To: Andrey Vagin <avagin@openvz.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
To: Serge Hallyn <serge@hallyn.com>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Karel Zak <kzak@redhat.com>
---
 fs/nsfs.c | 1 +
 1 file changed, 1 insertion(+)


---
base-commit: f9ff5644bcc04221bae56f922122f2b7f5d24d62
change-id: 20221214-nsfs-ioctl-compat-1548bf6581a7

Best regards,

Comments

Thomas Weißschuh Jan. 11, 2023, 4:54 p.m. UTC | #1
On Wed, Jan 11, 2023 at 04:42:07PM +0000, Thomas Weißschuh wrote:
> diff --git a/fs/nsfs.c b/fs/nsfs.c
> index 3506f6074288..4d2644507364 100644
> --- a/fs/nsfs.c
> +++ b/fs/nsfs.c
> @@ -21,6 +21,7 @@ static long ns_ioctl(struct file *filp, unsigned int ioctl,
>  static const struct file_operations ns_file_operations = {
>  	.llseek		= no_llseek,
>  	.unlocked_ioctl = ns_ioctl,
> +	.compat_ioctl   = ns_ioctl,
>  };

Please disregard this patch. It was a resend of a wrong revision.
The correct revision was v3 which I also resent.

Sorry for the noise.
diff mbox series

Patch

diff --git a/fs/nsfs.c b/fs/nsfs.c
index 3506f6074288..4d2644507364 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -21,6 +21,7 @@  static long ns_ioctl(struct file *filp, unsigned int ioctl,
 static const struct file_operations ns_file_operations = {
 	.llseek		= no_llseek,
 	.unlocked_ioctl = ns_ioctl,
+	.compat_ioctl   = ns_ioctl,
 };
 
 static char *ns_dname(struct dentry *dentry, char *buffer, int buflen)