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:   Mon, 22 Feb 2021 09:44:39 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     "Matthew Wilcox (Oracle)" <willy@...radead.org>
CC:     <linux-kernel@...r.kernel.org>, Michal Hocko <mhocko@...e.com>,
        <linux-mm@...ck.org>, Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] mm: Use rcu_dereference in in_vfork

On 2021/2/22 3:42, Matthew Wilcox (Oracle) wrote:
> Fix a sparse warning by using rcu_dereference().  Technically this is a
> bug and a sufficiently aggressive compiler could reload the `real_parent'
> pointer outside the protection of the rcu lock (and access freed memory),
> but I think it's pretty unlikely to happen.
> 
> Fixes: b18dc5f291c0 ("mm, oom: skip vforked tasks from being selected")
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>

Looks good to me. Thanks!
Reviewed-by: Miaohe Lin <linmiaohe@...wei.com>

> ---
>  include/linux/sched/mm.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
> index 1ae08b8462a4..90b2a0bce11c 100644
> --- a/include/linux/sched/mm.h
> +++ b/include/linux/sched/mm.h
> @@ -140,7 +140,8 @@ static inline bool in_vfork(struct task_struct *tsk)
>  	 * another oom-unkillable task does this it should blame itself.
>  	 */
>  	rcu_read_lock();
> -	ret = tsk->vfork_done && tsk->real_parent->mm == tsk->mm;
> +	ret = tsk->vfork_done &&
> +			rcu_dereference(tsk->real_parent)->mm == tsk->mm;
>  	rcu_read_unlock();
>  
>  	return ret;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ