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] [day] [month] [year] [list]
Message-ID: <20210324212017.0cd11e7e@oasis.local.home>
Date:   Wed, 24 Mar 2021 21:20:17 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Li Huafei <lihuafei1@...wei.com>
Cc:     <mingo@...hat.com>, <jolsa@...hat.com>,
        <linux-kernel@...r.kernel.org>, <yangjihong1@...wei.com>,
        <xukuohai@...wei.com>, <zhangjinhao2@...wei.com>
Subject: Re: [PATCH 1/2] ftrace: Update ftrace_ops->next pointer with
 rcu_assign_pointer()

On Wed, 17 Mar 2021 18:25:28 +0800
Li Huafei <lihuafei1@...wei.com> wrote:

> The unregistered ftrace_ops may be freed by the caller, so we should use
> rcu_assign_pointer() in remove_ftrace_ops() to remove the ftrace_ops,
> which ensures that no more users will reference the ftrace_ops after
> synchronize_rcu() is called.

The patch is fine, but we don't use synchronize_rcu() to protect the
list. We use synchronize_rcu_tasks().

-- Steve


> 
> Signed-off-by: Li Huafei <lihuafei1@...wei.com>
> ---
>  kernel/trace/ftrace.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 4d8e35575549..2e315a145d20 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -282,7 +282,7 @@ static int remove_ftrace_ops(struct ftrace_ops __rcu **list,
>  			lockdep_is_held(&ftrace_lock)) == ops &&
>  	    rcu_dereference_protected(ops->next,
>  			lockdep_is_held(&ftrace_lock)) == &ftrace_list_end) {
> -		*list = &ftrace_list_end;
> +		rcu_assign_pointer(*list, &ftrace_list_end);
>  		return 0;
>  	}
>  
> @@ -293,7 +293,7 @@ static int remove_ftrace_ops(struct ftrace_ops __rcu **list,
>  	if (*p != ops)
>  		return -1;
>  
> -	*p = (*p)->next;
> +	rcu_assign_pointer(*p, (*p)->next);
>  	return 0;
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ