[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <429d87b0-3a53-052a-a304-0afa8d51900d@huawei.com>
Date: Wed, 13 Oct 2021 18:38:12 +0800
From: "chenxiaosong (A)" <chenxiaosong2@...wei.com>
To: Greg KH <gregkh@...uxfoundation.org>
CC: <viro@...iv.linux.org.uk>, <stable@...r.kernel.org>,
<linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<dhowells@...hat.com>, <yukuai3@...wei.com>, <yi.zhang@...wei.com>,
<zhangxiaoxu5@...wei.com>
Subject: Re: [PATCH 4.19,v2] VFS: Fix fuseblk memory leak caused by mount
concurrency
在 2021/10/13 18:11, Greg KH 写道:
> On Wed, Oct 13, 2021 at 05:51:01PM +0800, ChenXiaoSong wrote:
>> If two processes mount same superblock, memory leak occurs:
>>
>> CPU0 | CPU1
>> do_new_mount | do_new_mount
>> fs_set_subtype | fs_set_subtype
>> kstrdup |
>> | kstrdup
>> memrory leak |
>>
>> Fix this by adding a write lock while calling fs_set_subtype.
>>
>> Linus's tree already have refactoring patchset [1], one of them can fix this bug:
>> c30da2e981a7 (fuse: convert to use the new mount API)
>>
>> Since we did not merge the refactoring patchset in this branch, I create this patch.
>>
>> [1] https://patchwork.kernel.org/project/linux-fsdevel/patch/20190903113640.7984-3-mszeredi@redhat.com/
>>
>> Fixes: 79c0b2df79eb (add filesystem subtype support)
>> Cc: David Howells <dhowells@...hat.com>
>> Signed-off-by: ChenXiaoSong <chenxiaosong2@...wei.com>
>> ---
>> v1: Can not mount sshfs ([PATCH linux-4.19.y] VFS: Fix fuseblk memory leak caused by mount concurrency)
>> v2: Use write lock while writing superblock
>>
>> fs/namespace.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> As you are referring to a fuse-only patch above, why are you trying to
> resolve this issue in the core namespace code instead?
>
> How does fuse have anything to do with this?
>
> confused,
>
> greg k-h
> .
>
Now, only `fuse_fs_type` and `fuseblk_fs_type` has `FS_HAS_SUBTYPE` flag
in kernel code, but maybe there is a filesystem module(`struct
file_system_type` has `FS_HAS_SUBTYPE` flag). And only mounting fuseblk
filesystem(e.g. ntfs) will occur memory leak now.
Powered by blists - more mailing lists