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]
Date:   Mon, 3 Oct 2022 15:18:09 +0900
From:   Hyeonggon Yoo <42.hyeyoo@...il.com>
To:     SeongJae Park <sj@...nel.org>
Cc:     akpm@...ux-foundation.org, damon@...ts.linux.dev,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/damon/core: initialize damon_target->list in
 damon_new_target()

On Sun, Oct 02, 2022 at 07:31:30PM +0000, SeongJae Park wrote:
> 'struct damon_target' creation function, 'damon_new_target()' is not
> initializing its '->list' field, unlike other DAMON structs creator
> functions such as 'damon_new_region()'.  Normal users of
> 'damon_new_target()' initializes the field by adding the target to DAMON
> context's targets list, but some code could access the uninitialized
> field.
> 
> This commit avoids the case by initializing the field in
> 'damon_new_target()'.
> 
> Reported-by: Hyeonggon Yoo <42.hyeyoo@...il.com>
> Fixes: f23b8eee1871 ("mm/damon/core: implement region-based sampling")
> Signed-off-by: SeongJae Park <sj@...nel.org>
> ---
> 
>  mm/damon/core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 1d952fa7ba3e..1e6691771a95 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -345,6 +345,7 @@ struct damon_target *damon_new_target(void)
>  	t->pid = NULL;
>  	t->nr_regions = 0;
>  	INIT_LIST_HEAD(&t->regions_list);
> +	INIT_LIST_HEAD(&t->list);
>  
>  	return t;
>  }

I tried again with it and this fixes the bug I reported.
Tested-by: Hyeonggon Yoo <42.hyeyoo@...il.com>

Thank you for such a quick fix!

> -- 
> 2.25.1
> 

-- 
Thanks,
Hyeonggon

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ