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: <YE8ZL8VTllD5RLOf@dhcp22.suse.cz>
Date:   Mon, 15 Mar 2021 09:22:07 +0100
From:   Michal Hocko <mhocko@...e.com>
To:     Jiang Biao <benbjiang@...il.com>
Cc:     akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, robinlai@...cent.com,
        benbjiang@...cent.com
Subject: Re: [PATCH] mm/oom_kill: fix wild pointer in out_of_memory

On Sat 13-03-21 12:23:00, Jiang Biao wrote:
> From: Bin Lai <robinlai@...cent.com>
> 
> From: Bin Lai <robinlai@...cent.com>
> 
> The oc->chosen is used by oom implementation, and the caller does
> not initialize this variable. If the tasks of memcg are all unkillable,
> oom_evaluate_task cann't choose any task, and the oc->chosen will be
> a wild pointer. So we should initialize oc->chosen before calling
> oom_evaluate_task.

All callers do initialize oom_control on the stack and even partial
structure initialization on stack will result in the zeroying of all
other structure's element. So I do not think there is any problem.

> 
> Signed-off-by: Bin Lai <robinlai@...cent.com>
> Reviewed-by: Jiang Biao <benbjiang@...cent.com>
> 
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 9efaf43..0658a30 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -366,6 +366,7 @@ static int oom_evaluate_task(struct task_struct *task, void *arg)
>  static void select_bad_process(struct oom_control *oc)
>  {
>  	oc->chosen_points = LONG_MIN;
> +	oc->chosen = NULL;
>  
>  	if (is_memcg_oom(oc))
>  		mem_cgroup_scan_tasks(oc->memcg, oom_evaluate_task, oc);
> -- 
> 1.8.3.1
> 

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ