I have the following patches in the ext4.git tree which I plan to push
to Linus as bug fixes during this development cycles. Al, are you
happy with Miklos's v2 version of "fs: add file_dentrY()" patch?
Miklos Szeredi (4):
fs: add file_dentry()
nfs: use file_dentry()
ext4: use dget_parent() in ext4_file_open()
ext4: use file_dentry()
Theodore Ts'o (1):
ext4 crypto: use dget_parent() in ext4_d_revalidate()
fs/dcache.c | 5 ++++-
fs/ext4/crypto.c | 12 ++++++++----
fs/ext4/file.c | 12 ++++++++----
fs/nfs/dir.c | 6 +++---
fs/nfs/inode.c | 2 +-
fs/nfs/nfs4file.c | 4 ++--
fs/overlayfs/super.c | 33 +++++++++++++++++++++++++++++++++
include/linux/dcache.h | 10 ++++++++++
include/linux/fs.h | 10 ++++++++++
9 files changed, 79 insertions(+), 15 deletions(-)
--
2.5.0
From: Miklos Szeredi <redacted>
NFS may be used as lower layer of overlayfs and accessing f_path.dentry can
lead to a crash.
Fix by replacing direct access of file->f_path.dentry with the
file_dentry() accessor, which will always return a native object.
Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay")
Signed-off-by: Miklos Szeredi <redacted>
Tested-by: Goldwyn Rodrigues <redacted>
Acked-by: Trond Myklebust <redacted>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: <redacted> # v4.2
Cc: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
---
fs/nfs/dir.c | 6 +++---
fs/nfs/inode.c | 2 +-
fs/nfs/nfs4file.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
@@ -377,7 +377,7 @@ int nfs_readdir_xdr_filler(struct page **pages, nfs_readdir_descriptor_t *desc,again:timestamp=jiffies;gencount=nfs_inc_attr_generation_counter();-error=NFS_PROTO(inode)->readdir(file->f_path.dentry,cred,entry->cookie,pages,+error=NFS_PROTO(inode)->readdir(file_dentry(file),cred,entry->cookie,pages,NFS_SERVER(inode)->dtsize,desc->plus);if(error<0){/* We requested READDIRPLUS, but the server doesn't grok it */
@@ -560,7 +560,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *encount++;if(desc->plus!=0)-nfs_prime_dcache(desc->file->f_path.dentry,entry);+nfs_prime_dcache(file_dentry(desc->file),entry);status=nfs_readdir_add_to_array(entry,page);if(status!=0)
From: Miklos Szeredi <redacted>
EXT4 may be used as lower layer of overlayfs and accessing f_path.dentry
can lead to a crash.
Fix by replacing direct access of file->f_path.dentry with the
file_dentry() accessor, which will always return a native object.
Reported-by: Daniel Axtens <redacted>
Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay")
Fixes: ff978b09f973 ("ext4 crypto: move context consistency check to ext4_file_open()")
Signed-off-by: Miklos Szeredi <redacted>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: <redacted> # v4.5
---
fs/ext4/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
This avoids potential problems caused by a race where the inode gets
renamed out from its parent directory and the parent directory is
deleted while ext4_d_revalidate() is running.
Fixes: 28b4c263961c
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
---
fs/ext4/crypto.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
@@ -494,6 +497,7 @@ static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags)/* this should eventually be an flag in d_flags */cached_with_key=dentry->d_fsdata!=NULL;dir_has_key=(ci!=NULL);+dput(dir);/**Ifthedentrywascachedwithoutthekey,anditisa
From: Miklos Szeredi <redacted>
In f_op->open() lock on parent is not held, so there's no guarantee that
parent dentry won't go away at any time.
Even after this patch there's no guarantee that 'dir' will stay the parent
of 'inode', but at least it won't be freed while being used.
Fixes: ff978b09f973 ("ext4 crypto: move context consistency check to ext4_file_open()")
Signed-off-by: Miklos Szeredi <redacted>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: <redacted> # v4.5
---
fs/ext4/file.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
From: Miklos Szeredi <miklos@szeredi.hu>
This series fixes bugs in nfs and ext4 due to 4bacc9c9234c ("overlayfs:
Make f_path always point to the overlay and f_inode to the underlay").
Regular files opened on overlayfs will result in the file being opened on
the underlying filesystem, while f_path points to the overlayfs
mount/dentry.
This confuses filesystems which get the dentry from struct file and assume
it's theirs.
Add a new helper, file_dentry() [*], to get the filesystem's own dentry
from the file. This checks file->f_path.dentry->d_flags against
DCACHE_OP_REAL, and returns file->f_path.dentry if DCACHE_OP_REAL is not
set (this is the common, non-overlayfs case).
In the uncommon case it will call into overlayfs's ->d_real() to get the
underlying dentry, matching file_inode(file).
The reason we need to check against the inode is that if the file is copied
up while being open, d_real() would return the upper dentry, while the open
file comes from the lower dentry.
[*] If possible, it's better simply to use file_inode() instead.
Signed-off-by: Miklos Szeredi <redacted>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Tested-by: Goldwyn Rodrigues <redacted>
Reviewed-by: Trond Myklebust <redacted>
Cc: <redacted> # v4.2
Cc: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Daniel Axtens <redacted>
---
fs/dcache.c | 5 ++++-
fs/overlayfs/super.c | 33 +++++++++++++++++++++++++++++++++
include/linux/dcache.h | 10 ++++++++++
include/linux/fs.h | 10 ++++++++++
4 files changed, 57 insertions(+), 1 deletion(-)
On Sat, Mar 26, 2016 at 10:10 PM, Theodore Ts'o [off-list ref] wrote:
This avoids potential problems caused by a race where the inode gets
renamed out from its parent directory and the parent directory is
deleted while ext4_d_revalidate() is running.
Fixes: 28b4c263961c
Full Fixes-tag...
Fixes: 28b4c263961c ("ext4 crypto: revalidate dentry after adding or
removing the key")
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
@@ -494,6 +497,7 @@ static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags)/* this should eventually be an flag in d_flags */cached_with_key=dentry->d_fsdata!=NULL;dir_has_key=(ci!=NULL);+dput(dir);/**Ifthedentrywascachedwithoutthekey,anditisa--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sat, Mar 26, 2016 at 10:09 PM, Theodore Ts'o [off-list ref] wrote:
I have the following patches in the ext4.git tree which I plan to push
to Linus as bug fixes during this development cycles. Al, are you
happy with Miklos's v2 version of "fs: add file_dentrY()" patch?
Miklos Szeredi (4):
fs: add file_dentry()
nfs: use file_dentry()
ext4: use dget_parent() in ext4_file_open()
ext4: use file_dentry()
Theodore Ts'o (1):
ext4 crypto: use dget_parent() in ext4_d_revalidate()
I asked that already in a previous series of that patchset.
Are those CC-stable-tags correct?
fs: add file_dentry()
Cc: <redacted> # v4.2
nfs: use file_dentry()
Cc: <redacted> # v4.2
ext4: use dget_parent() in ext4_file_open()
Cc: <redacted> # v4.5
ext4: use file_dentry()
Cc: <redacted> # v4.5
ext4 crypto: use dget_parent() in ext4_d_revalidate()
Cc: stable@vger.kernel.org
- Sedat -
fs/dcache.c | 5 ++++-
fs/ext4/crypto.c | 12 ++++++++----
fs/ext4/file.c | 12 ++++++++----
fs/nfs/dir.c | 6 +++---
fs/nfs/inode.c | 2 +-
fs/nfs/nfs4file.c | 4 ++--
fs/overlayfs/super.c | 33 +++++++++++++++++++++++++++++++++
include/linux/dcache.h | 10 ++++++++++
include/linux/fs.h | 10 ++++++++++
9 files changed, 79 insertions(+), 15 deletions(-)
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sun, Mar 27, 2016 at 10:06:14AM +0200, Sedat Dilek wrote:
On Sat, Mar 26, 2016 at 10:09 PM, Theodore Ts'o [off-list ref] wrote:
quoted
I have the following patches in the ext4.git tree which I plan to push
to Linus as bug fixes during this development cycles. Al, are you
happy with Miklos's v2 version of "fs: add file_dentrY()" patch?
Miklos Szeredi (4):
fs: add file_dentry()
nfs: use file_dentry()
ext4: use dget_parent() in ext4_file_open()
ext4: use file_dentry()
Theodore Ts'o (1):
ext4 crypto: use dget_parent() in ext4_d_revalidate()
I asked that already in a previous series of that patchset.
Are those CC-stable-tags correct?
fs: add file_dentry()
Cc: <redacted> # v4.2
To quote from the commit description
This series fixes bugs in nfs and ext4 due to 4bacc9c9234c ("overlayfs:
Make f_path always point to the overlay and f_inode to the underlay").
% git tag --contains 4bacc9c9234c | grep ^v | head -1
v4.2
Cheers,
- Ted
On Sun, Mar 27, 2016 at 10:02:46AM +0200, Sedat Dilek wrote:
On Sat, Mar 26, 2016 at 10:10 PM, Theodore Ts'o [off-list ref] wrote:
quoted
This avoids potential problems caused by a race where the inode gets
renamed out from its parent directory and the parent directory is
deleted while ext4_d_revalidate() is running.
Fixes: 28b4c263961c
Full Fixes-tag...
Fixes: 28b4c263961c ("ext4 crypto: revalidate dentry after adding or
removing the key")
quoted
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
This for Linux v4.6(-rc1+) ?
Probably v4.6-rc2 at this point, since I'm still waiting for acks from
folks.
- Ted
On Sun, Mar 27, 2016 at 8:15 PM, Theodore Ts'o [off-list ref] wrote:
On Sun, Mar 27, 2016 at 10:06:14AM +0200, Sedat Dilek wrote:
quoted
On Sat, Mar 26, 2016 at 10:09 PM, Theodore Ts'o [off-list ref] wrote:
quoted
I have the following patches in the ext4.git tree which I plan to push
to Linus as bug fixes during this development cycles. Al, are you
happy with Miklos's v2 version of "fs: add file_dentrY()" patch?
Miklos Szeredi (4):
fs: add file_dentry()
nfs: use file_dentry()
ext4: use dget_parent() in ext4_file_open()
ext4: use file_dentry()
Theodore Ts'o (1):
ext4 crypto: use dget_parent() in ext4_d_revalidate()
I asked that already in a previous series of that patchset.
Are those CC-stable-tags correct?
fs: add file_dentry()
Cc: <redacted> # v4.2
To quote from the commit description
This series fixes bugs in nfs and ext4 due to 4bacc9c9234c ("overlayfs:
Make f_path always point to the overlay and f_inode to the underlay").
% git tag --contains 4bacc9c9234c | grep ^v | head -1
v4.2
v4.2, OK.
fs: add file_dentry()
Cc: <redacted> # v4.2
nfs: use file_dentry()
Cc: <redacted> # v4.2
v4.5 ?
ext4: use file_dentry()
Cc: <redacted> # v4.5
- Sedat -
On Sat, Mar 26, 2016 at 10:09 PM, Theodore Ts'o [off-list ref] wrote:
I have the following patches in the ext4.git tree which I plan to push
to Linus as bug fixes during this development cycles. Al, are you
happy with Miklos's v2 version of "fs: add file_dentrY()" patch?
Miklos Szeredi (4):
fs: add file_dentry()
nfs: use file_dentry()
ext4: use dget_parent() in ext4_file_open()
ext4: use file_dentry()
Theodore Ts'o (1):
ext4 crypto: use dget_parent() in ext4_d_revalidate()
fs/dcache.c | 5 ++++-
fs/ext4/crypto.c | 12 ++++++++----
fs/ext4/file.c | 12 ++++++++----
fs/nfs/dir.c | 6 +++---
fs/nfs/inode.c | 2 +-
fs/nfs/nfs4file.c | 4 ++--
fs/overlayfs/super.c | 33 +++++++++++++++++++++++++++++++++
include/linux/dcache.h | 10 ++++++++++
include/linux/fs.h | 10 ++++++++++
9 files changed, 79 insertions(+), 15 deletions(-)
--
2.5.0
On Sun, Mar 27, 2016 at 09:31:58PM +0200, Sedat Dilek wrote:
v4.5 ?
ext4: use file_dentry()
Cc: <redacted> # v4.5
This only became a problem in:
Fixes: ff978b09f973 ("ext4 crypto: move context consistency check to ext4_file_open()")
which showed up in v4.5. In fact that commit won't apply previous to
4.5.
- Ted
From: Chris Mason <hidden> Date: 2016-03-28 14:02:40
On Mon, Mar 28, 2016 at 12:51:22AM +0200, Sedat Dilek wrote:
On Sat, Mar 26, 2016 at 10:09 PM, Theodore Ts'o [off-list ref] wrote:
quoted
I have the following patches in the ext4.git tree which I plan to push
to Linus as bug fixes during this development cycles. Al, are you
happy with Miklos's v2 version of "fs: add file_dentrY()" patch?
Miklos Szeredi (4):
fs: add file_dentry()
nfs: use file_dentry()
ext4: use dget_parent() in ext4_file_open()
ext4: use file_dentry()
Theodore Ts'o (1):
ext4 crypto: use dget_parent() in ext4_d_revalidate()
fs/dcache.c | 5 ++++-
fs/ext4/crypto.c | 12 ++++++++----
fs/ext4/file.c | 12 ++++++++----
fs/nfs/dir.c | 6 +++---
fs/nfs/inode.c | 2 +-
fs/nfs/nfs4file.c | 4 ++--
fs/overlayfs/super.c | 33 +++++++++++++++++++++++++++++++++
include/linux/dcache.h | 10 ++++++++++
include/linux/fs.h | 10 ++++++++++
9 files changed, 79 insertions(+), 15 deletions(-)
--
2.5.0
Might be good to have...
"Btrfs: fix crash/invalid memory access on fsync when using overlayfs"
...also in this series.
Yeah, I've been waiting on Miklos' patch to push the corresponding btrfs
fix. I can do it separately or it can go in here too. Either way is
fine with me.
-chris
On Mon, Mar 28, 2016 at 10:02:22AM -0400, Chris Mason wrote:
quoted
Might be good to have...
"Btrfs: fix crash/invalid memory access on fsync when using overlayfs"
...also in this series.
Yeah, I've been waiting on Miklos' patch to push the corresponding btrfs
fix. I can do it separately or it can go in here too. Either way is
fine with me.
I wasn't cc'ed on this patch and the only version I can find has a
mangled e-mail address for Filipe Manana. If you can send me the
patch with your S-o-B, I'd be happy to include it in a push to Linus.
Cheers,
- Ted
From: Al Viro <viro@ZenIV.linux.org.uk> Date: 2016-03-29 19:58:48
On Sat, Mar 26, 2016 at 05:09:55PM -0400, Theodore Ts'o wrote:
I have the following patches in the ext4.git tree which I plan to push
to Linus as bug fixes during this development cycles. Al, are you
happy with Miklos's v2 version of "fs: add file_dentrY()" patch?
I'm not really happy, but I guess we'll have to live with that approach.
I would still like to point out that *any* use of file_dentry() (or
file->f_path.dentry, for that matter) is a serious red flag - odds are,
the code using it is broken, possibly by design.
I still don't understand the locking in ext4 crypto, and I'm not at all
convinced that it is correct ;-/ OTOH, there are filesystems where we
really need dentry and (hopefully) treat it sanely enough, so consider
that helper and method ACKed. I can take it via vfs.git, or leave it
to ext4.git, or do some combination thereof (e.g. the infrastructure
goes into never-rebased branch in vfs.git, with ext4/btrfs/nfs merging
from it). Up to you...
Al, still bloody unhappy about the whole pile of worms...
From: Chris Mason <hidden> Date: 2016-03-29 20:13:10
On Tue, Mar 29, 2016 at 01:15:23PM -0400, Theodore Ts'o wrote:
On Mon, Mar 28, 2016 at 10:02:22AM -0400, Chris Mason wrote:
quoted
quoted
Might be good to have...
"Btrfs: fix crash/invalid memory access on fsync when using overlayfs"
...also in this series.
Yeah, I've been waiting on Miklos' patch to push the corresponding btrfs
fix. I can do it separately or it can go in here too. Either way is
fine with me.
I wasn't cc'ed on this patch and the only version I can find has a
mangled e-mail address for Filipe Manana. If you can send me the
patch with your S-o-B, I'd be happy to include it in a push to Linus.