mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 14:40:53 +07:00
f5e55e777c
Currently, trying to rename or link a regular file, directory, or symlink into an encrypted directory fails with EPERM when the source file is unencrypted or is encrypted with a different encryption policy, and is on the same mountpoint. It is correct for the operation to fail, but the choice of EPERM breaks tools like 'mv' that know to copy rather than rename if they see EXDEV, but don't know what to do with EPERM. Our original motivation for EPERM was to encourage users to securely handle their data. Encrypting files by "moving" them into an encrypted directory can be insecure because the unencrypted data may remain in free space on disk, where it can later be recovered by an attacker. It's much better to encrypt the data from the start, or at least try to securely delete the source data e.g. using the 'shred' program. However, the current behavior hasn't been effective at achieving its goal because users tend to be confused, hack around it, and complain; see e.g. https://github.com/google/fscrypt/issues/76. And in some cases it's actually inconsistent or unnecessary. For example, 'mv'-ing files between differently encrypted directories doesn't work even in cases where it can be secure, such as when in userspace the same passphrase protects both directories. Yet, you *can* already 'mv' unencrypted files into an encrypted directory if the source files are on a different mountpoint, even though doing so is often insecure. There are probably better ways to teach users to securely handle their files. For example, the 'fscrypt' userspace tool could provide a command that migrates unencrypted files into an encrypted directory, acting like 'shred' on the source files and providing appropriate warnings depending on the type of the source filesystem and disk. Receiving errors on unimportant files might also force some users to disable encryption, thus making the behavior counterproductive. It's desirable to make encryption as unobtrusive as possible. Therefore, change the error code from EPERM to EXDEV so that tools looking for EXDEV will fall back to a copy. This, of course, doesn't prevent users from still doing the right things to securely manage their files. Note that this also matches the behavior when a file is renamed between two project quota hierarchies; so there's precedent for using EXDEV for things other than mountpoints. xfstests generic/398 will require an update with this change. [Rewritten from an earlier patch series by Michael Halcrow.] Cc: Michael Halcrow <mhalcrow@google.com> Cc: Joe Richey <joerichey@google.com> Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
---|---|---|
.. | ||
caching | ||
cifs | ||
configfs | ||
ext4 | ||
nfs | ||
9p.txt | ||
adfs.txt | ||
affs.txt | ||
afs.txt | ||
autofs-mount-control.txt | ||
autofs.txt | ||
automount-support.txt | ||
befs.txt | ||
bfs.txt | ||
btrfs.txt | ||
ceph.txt | ||
coda.txt | ||
conf.py | ||
cramfs.txt | ||
dax.txt | ||
debugfs.txt | ||
devpts.txt | ||
directory-locking | ||
dlmfs.txt | ||
dnotify.txt | ||
ecryptfs.txt | ||
efivarfs.txt | ||
exofs.txt | ||
ext2.txt | ||
ext3.txt | ||
f2fs.txt | ||
fiemap.txt | ||
files.txt | ||
fscrypt.rst | ||
fuse-io.txt | ||
fuse.txt | ||
gfs2-glocks.txt | ||
gfs2-uevents.txt | ||
gfs2.txt | ||
hfs.txt | ||
hfsplus.txt | ||
hpfs.txt | ||
index.rst | ||
inotify.txt | ||
isofs.txt | ||
jfs.txt | ||
Locking | ||
locks.txt | ||
mandatory-locking.txt | ||
nilfs2.txt | ||
ntfs.txt | ||
ocfs2-online-filecheck.txt | ||
ocfs2.txt | ||
omfs.txt | ||
orangefs.txt | ||
overlayfs.txt | ||
path-lookup.rst | ||
path-lookup.txt | ||
porting | ||
proc.txt | ||
qnx6.txt | ||
quota.txt | ||
ramfs-rootfs-initramfs.txt | ||
relay.txt | ||
romfs.txt | ||
seq_file.txt | ||
sharedsubtree.txt | ||
spufs.txt | ||
squashfs.txt | ||
sysfs-pci.txt | ||
sysfs-tagging.txt | ||
sysfs.txt | ||
sysv-fs.txt | ||
tmpfs.txt | ||
ubifs-authentication.md | ||
ubifs.txt | ||
udf.txt | ||
ufs.txt | ||
vfat.txt | ||
vfs.txt | ||
xfs-delayed-logging-design.txt | ||
xfs-self-describing-metadata.txt | ||
xfs.txt |