lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 09 Feb 2011 09:49:15 +0800
From:	Tao Ma <tm@....ma>
To:	Boaz Harrosh <bharrosh@...asas.com>
CC:	"Aneesh Kumar K. V" <aneesh.kumar@...ux.vnet.ibm.com>,
	Nick Piggin <npiggin@...nel.dk>, linux-fsdevel@...r.kernel.org,
	linux-ext4@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>,
	Chris Mason <chris.mason@...cle.com>
Subject: Re: [PATCH] VFS: call synchronize_rcu after kill_sb.

On 02/09/2011 01:25 AM, Boaz Harrosh wrote:
> On 02/08/2011 06:57 PM, Aneesh Kumar K. V wrote:
>    
>> On Mon, 07 Feb 2011 15:14:40 +0200, Boaz Harrosh<bharrosh@...asas.com>  wrote:
>>      
>>> On 02/05/2011 11:01 AM, Tao Ma wrote:
>>>        
>>>> From: Tao Ma<boyu.mt@...bao.com>
>>>>
>>>> In fa0d7e3, we use rcu free inode instead of freeing the inode
>>>> directly. It causes a problem when we rmmod immediately after
>>>> we umount the volume[1].
>>>>
>>>> So we need to call synchronize_rcu after we kill_sb so that
>>>> the inode is freed before we do rmmod. The idea is inspired
>>>> by Chris Mason[2]. I tested with ext4 by umount+rmmod and it
>>>> doesn't show any error by now.
>>>>
>>>> 1. http://marc.info/?l=linux-fsdevel&m=129680863330185&w=2
>>>> 2. http://marc.info/?l=linux-fsdevel&m=129684698713709&w=2
>>>>
>>>> Cc: Nick Piggin<npiggin@...nel.dk>
>>>> Cc: Al Viro<viro@...iv.linux.org.uk>
>>>> Cc: Chris Mason<chris.mason@...cle.com>
>>>> Cc: Boaz Harrosh<bharrosh@...asas.com>
>>>> Signed-off-by: Tao Ma<boyu.mt@...bao.com>
>>>> ---
>>>>   fs/super.c |    7 +++++++
>>>>   1 files changed, 7 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/fs/super.c b/fs/super.c
>>>> index 74e149e..315bce9 100644
>>>> --- a/fs/super.c
>>>> +++ b/fs/super.c
>>>> @@ -177,6 +177,13 @@ void deactivate_locked_super(struct super_block *s)
>>>>   	struct file_system_type *fs = s->s_type;
>>>>   	if (atomic_dec_and_test(&s->s_active)) {
>>>>   		fs->kill_sb(s);
>>>> +		/*
>>>> +		 * We need to synchronize rcu here so that
>>>> +		 * the delayed rcu inode free can be executed
>>>> +		 * before we put_super.
>>>> +		 * https://bugzilla.kernel.org/show_bug.cgi?id=27652
>>>> +		 */
>>>> +		synchronize_rcu();
>>>>   		put_filesystem(fs);
>>>>   		put_super(s);
>>>>   	} else {
>>>>          
>>>
>>>        
> <>
>    
>> http://lwn.net/Articles/217484/ explains how to wait for rcu callback to finish
>>
>> -aneesh
>>      
> Yes thanks Aneesh, rcu_barrier does the trick
> ---
> From: Boaz Harrosh<bharrosh@...asas.com>
>
> In fa0d7e3, we use rcu free inode instead of freeing the inode
> directly. It causes a problem when we rmmod immediately after
> we umount the volume[1].
>
> So we need to call rcu_barrier after we kill_sb so that
> the inode is freed before we do rmmod. The idea is inspired
> by Aneesh Kumar. rcu_barrier will wait for all callbacks
> to end before preceding. The original patch was done by
> Tao Ma, but synchronize_rcu() is not enough here.
>
> 1. http://marc.info/?l=linux-fsdevel&m=129680863330185&w=2
> 2. http://marc.info/?l=linux-fsdevel&m=129684698713709&w=2
>
> Cc: Nick Piggin<npiggin@...nel.dk>
> Cc: Al Viro<viro@...iv.linux.org.uk>
> Cc: Chris Mason<chris.mason@...cle.com>
> Cc: Tao Ma<boyu.mt@...bao.com>
> Signed-off-by: Boaz Harrosh<bharrosh@...asas.com>
>    
It works now in my ext4 test box. Thanks for your work.
Tested-by: Tao Ma <boyu.mt@...bao.com>
> ---
> git diff --stat -p -M fs/super.c
>   fs/super.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/fs/super.c b/fs/super.c
> index 74e149e..5fd4ec9 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -177,6 +177,13 @@ void deactivate_locked_super(struct super_block *s)
>   	struct file_system_type *fs = s->s_type;
>   	if (atomic_dec_and_test(&s->s_active)) {
>   		fs->kill_sb(s);
> +		/*
> +		 * We need to synchronize rcu here so that
> +		 * the delayed rcu inode free can be executed
> +		 * before we put_super.
> +		 * https://bugzilla.kernel.org/show_bug.cgi?id=27652
> +		 */
> +		rcu_barrier();
>   		put_filesystem(fs);
>   		put_super(s);
>   	} else {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>    

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ