* there are unencrypted files in an encrypted directory in F2FS
@ 2016-09-19 4:16 ` xiakaixu
0 siblings, 0 replies; 2+ messages in thread
From: xiakaixu @ 2016-09-19 4:16 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: guoweichao, linux-kernel@vger.kernel.org, linux-f2fs-devel
Hi Kim,
According to the encryption design policy "all of the files or
subdirectories in an encrypted directory must be encrypted". But
the current f2fs code seems allow to there are unencrypted files
in an encrypted directory. For example, the f2fs_create() and
f2fs_mknod() functions call f2fs_new_inode() to check the child inode.
/* If the directory encrypted, then we should encrypt the inode. */
if (f2fs_encrypted_inode(dir) && f2fs_may_encrypt(inode))
f2fs_set_encrypted_inode(inode);
static inline bool f2fs_may_encrypt(struct inode *inode)
{
#ifdef CONFIG_F2FS_FS_ENCRYPTION
umode_t mode = inode->i_mode;
return (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode));
#else
return 0;
#endif
}
So even if the child inode is not REG/DIR/LNK and it still can be created
successfully which is unencrypted file. Instead, maybe here we can return
-EACCESS. Not sure about it :)
--
Regards
Kaixu Xia
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
* there are unencrypted files in an encrypted directory in F2FS
@ 2016-09-19 4:16 ` xiakaixu
0 siblings, 0 replies; 2+ messages in thread
From: xiakaixu @ 2016-09-19 4:16 UTC (permalink / raw)
To: Jaegeuk Kim
Cc: linux-f2fs-devel, linux-kernel@vger.kernel.org, liushuoran,
guoweichao, Bintian
Hi Kim,
According to the encryption design policy "all of the files or
subdirectories in an encrypted directory must be encrypted". But
the current f2fs code seems allow to there are unencrypted files
in an encrypted directory. For example, the f2fs_create() and
f2fs_mknod() functions call f2fs_new_inode() to check the child inode.
/* If the directory encrypted, then we should encrypt the inode. */
if (f2fs_encrypted_inode(dir) && f2fs_may_encrypt(inode))
f2fs_set_encrypted_inode(inode);
static inline bool f2fs_may_encrypt(struct inode *inode)
{
#ifdef CONFIG_F2FS_FS_ENCRYPTION
umode_t mode = inode->i_mode;
return (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode));
#else
return 0;
#endif
}
So even if the child inode is not REG/DIR/LNK and it still can be created
successfully which is unencrypted file. Instead, maybe here we can return
-EACCESS. Not sure about it :)
--
Regards
Kaixu Xia
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-19 4:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19 4:16 there are unencrypted files in an encrypted directory in F2FS xiakaixu
2016-09-19 4:16 ` xiakaixu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.