bdzwillo / wrapfs_nfs

Wrapfs loopback filesystem with nfs support
4 stars 0 forks source link

exec mv causes kernel coredump #1

Closed jcbmao closed 8 months ago

jcbmao commented 8 months ago

When mounting wrapfs using the command “mount -t wrapfs /home/test /home/test” and then executing “mv /home/test/file /home/test/file1”, it causes a kernel coredump. The line of code causing the crash is “lower_dentry = wrapfs_get_lower_dentry(dentry);” in the “wrapfs_readlink” function of “inode.c”.What could be the issue?

os version: centos7.6

bdzwillo commented 8 months ago

Thank you for the report. I was able reproduce the crash when wrapfs is mounted on top of a local xfs directory on centos-7.9. When wrapfs is mounted on top of a nfsv3 mount like on our production servers file renames work fine.

I will take a look at how to fix that.

jcbmao commented 8 months ago

Thank you for your response.The issue has been resolved,Please provide a detailed description of the specific cause.

jcbmao commented 8 months ago

Have the issue been fixed?

bdzwillo commented 8 months ago

It's not obvious why an invalid dentry param is passed there. I have to take a deeper look next week.

jcbmao commented 8 months ago

Has this issue been resolved?

bdzwillo commented 8 months ago

The crash is fixed now. This occured only on redhat7 kernels, because redhat intruduced an inode_operations_wrapper struct to backport some inode operations from newer kernels. An illegal function pointer was called in vfs_rename when the S_IOPS_WRAPPER flag of an underlying inode did not match the layout of the wrapfs iops struct.

The crash did only happen when the virtual filesystem was mounted on top of a filesystem using the S_IOPS_WRAPPER layout (btrfs,cifs,ext2,ext4,fuse,gfs2,xfs).

This crash happens also with the original wrapfs implementation and the ecryptfs module included in the redhat kernel tree. The redhat7 overlayfs kernel module is compatible with the wrapper layout.

jcbmao commented 8 months ago

Is there a solution to the problem of data loss occurring when copying files to the /home/test directory and executing the command “mount -t wrapfs /home/test /home/test” to mount wrapfs, causing the file copying to be interrupted?

Code branch is “intercept_modify”.