2021-02-26 22:16:21

by Sarthak Kukreti

[permalink] [raw]
Subject: [PATCH] ext4: Add xattr commands to compat ioctl handler

This allows 32-bit userspace utils to use FS_IOC_FSGETXATTR and
FS_IOC_FSSETXATTR on a 64-bit kernel.

Signed-off-by: Sarthak Kukreti <[email protected]>
---
fs/ext4/ioctl.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index f0381876a7e5b..055c26296ab46 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -1371,6 +1371,8 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return -EFAULT;
return ext4_ioctl_group_add(file, &input);
}
+ case EXT4_IOC_FSGETXATTR:
+ case EXT4_IOC_FSSETXATTR:
case EXT4_IOC_MOVE_EXT:
case EXT4_IOC_RESIZE_FS:
case FITRIM:
--
2.30.1.766.gb4fecdf3b7-goog


2021-02-26 22:23:32

by Eric Biggers

[permalink] [raw]
Subject: Re: [PATCH] ext4: Add xattr commands to compat ioctl handler

On Fri, Feb 26, 2021 at 02:14:41PM -0800, Sarthak Kukreti wrote:
> This allows 32-bit userspace utils to use FS_IOC_FSGETXATTR and
> FS_IOC_FSSETXATTR on a 64-bit kernel.
>
> Signed-off-by: Sarthak Kukreti <[email protected]>
> ---
> fs/ext4/ioctl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index f0381876a7e5b..055c26296ab46 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c
> @@ -1371,6 +1371,8 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> return -EFAULT;
> return ext4_ioctl_group_add(file, &input);
> }
> + case EXT4_IOC_FSGETXATTR:
> + case EXT4_IOC_FSSETXATTR:
> case EXT4_IOC_MOVE_EXT:
> case EXT4_IOC_RESIZE_FS:
> case FITRIM:

These were already added to the list by commit a54d8d34d235
("ext4: Add EXT4_IOC_FSGETXATTR/EXT4_IOC_FSSETXATTR to compat_ioctl").

- Eric

2021-11-06 03:02:50

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] ext4: Add xattr commands to compat ioctl handler

Hi Sarthak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tytso-ext4/dev]
[also build test ERROR on v5.15 next-20211105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Sarthak-Kukreti/ext4-Add-xattr-commands-to-compat-ioctl-handler/20210929-170204
base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
config: x86_64-randconfig-a014-20210929 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/77441a0a6a03c9cd99a43a342217ec6d3e7fc1ea
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sarthak-Kukreti/ext4-Add-xattr-commands-to-compat-ioctl-handler/20210929-170204
git checkout 77441a0a6a03c9cd99a43a342217ec6d3e7fc1ea
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> fs/ext4/ioctl.c:1328:7: error: use of undeclared identifier 'EXT4_IOC_FSGETXATTR'
case EXT4_IOC_FSGETXATTR:
^
>> fs/ext4/ioctl.c:1329:7: error: use of undeclared identifier 'EXT4_IOC_FSSETXATTR'
case EXT4_IOC_FSSETXATTR:
^
2 errors generated.


vim +/EXT4_IOC_FSGETXATTR +1328 fs/ext4/ioctl.c

1284
1285 #ifdef CONFIG_COMPAT
1286 long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1287 {
1288 /* These are just misnamed, they actually get/put from/to user an int */
1289 switch (cmd) {
1290 case EXT4_IOC32_GETVERSION:
1291 cmd = EXT4_IOC_GETVERSION;
1292 break;
1293 case EXT4_IOC32_SETVERSION:
1294 cmd = EXT4_IOC_SETVERSION;
1295 break;
1296 case EXT4_IOC32_GROUP_EXTEND:
1297 cmd = EXT4_IOC_GROUP_EXTEND;
1298 break;
1299 case EXT4_IOC32_GETVERSION_OLD:
1300 cmd = EXT4_IOC_GETVERSION_OLD;
1301 break;
1302 case EXT4_IOC32_SETVERSION_OLD:
1303 cmd = EXT4_IOC_SETVERSION_OLD;
1304 break;
1305 case EXT4_IOC32_GETRSVSZ:
1306 cmd = EXT4_IOC_GETRSVSZ;
1307 break;
1308 case EXT4_IOC32_SETRSVSZ:
1309 cmd = EXT4_IOC_SETRSVSZ;
1310 break;
1311 case EXT4_IOC32_GROUP_ADD: {
1312 struct compat_ext4_new_group_input __user *uinput;
1313 struct ext4_new_group_data input;
1314 int err;
1315
1316 uinput = compat_ptr(arg);
1317 err = get_user(input.group, &uinput->group);
1318 err |= get_user(input.block_bitmap, &uinput->block_bitmap);
1319 err |= get_user(input.inode_bitmap, &uinput->inode_bitmap);
1320 err |= get_user(input.inode_table, &uinput->inode_table);
1321 err |= get_user(input.blocks_count, &uinput->blocks_count);
1322 err |= get_user(input.reserved_blocks,
1323 &uinput->reserved_blocks);
1324 if (err)
1325 return -EFAULT;
1326 return ext4_ioctl_group_add(file, &input);
1327 }
> 1328 case EXT4_IOC_FSGETXATTR:
> 1329 case EXT4_IOC_FSSETXATTR:

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (3.61 kB)
.config.gz (28.97 kB)
Download all attachments