All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch added to mm-hotfixes-unstable branch
@ 2024-01-02 17:58 Andrew Morton
  2024-01-03  2:33 ` Qi Zheng
  2024-01-03  2:40 ` Qi Zheng
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2024-01-02 17:58 UTC (permalink / raw)
  To: mm-commits, zhengqi.arch, syzbot+1e0ed05798af62917464, songmuchun,
	penguin-kernel, akpm


The patch titled
     Subject: mm: shrinker: use kvzalloc_node() from memcg_expand_one_shrinker_map()
has been added to the -mm mm-hotfixes-unstable branch.  Its filename is
     mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch

This patch will later appear in the mm-hotfixes-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Subject: mm: shrinker: use kvzalloc_node() from memcg_expand_one_shrinker_map()
Date: Wed, 3 Jan 2024 00:46:36 +0900

syzbot is reporting uninit-value at shrinker_alloc(), for commit
307bececcd12 ("mm: shrinker: add a secondary array for
shrinker_info::{map, nr_deferred}") which assumed that the ->unit was
allocated with __GFP_ZERO forgot to replace kvmalloc_node() in
memcg_expand_one_shrinker_map() with kvzalloc_node().

Link: https://lkml.kernel.org/r/b1a78c6a-b3fa-46ed-810a-ce546e726d44@I-love.SAKURA.ne.jp
Fixes: 307bececcd12 ("mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: syzbot <syzbot+1e0ed05798af62917464@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=1e0ed05798af62917464
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/shrinker.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/shrinker.c~mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map
+++ a/mm/shrinker.c
@@ -126,7 +126,7 @@ static int expand_one_shrinker_info(stru
 		if (new_nr_max <= old->map_nr_max)
 			continue;
 
-		new = kvmalloc_node(sizeof(*new) + new_size, GFP_KERNEL, nid);
+		new = kvzalloc_node(sizeof(*new) + new_size, GFP_KERNEL, nid);
 		if (!new)
 			return -ENOMEM;
 
_

Patches currently in -mm which might be from penguin-kernel@I-love.SAKURA.ne.jp are

mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: + mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch added to mm-hotfixes-unstable branch
  2024-01-02 17:58 + mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch added to mm-hotfixes-unstable branch Andrew Morton
@ 2024-01-03  2:33 ` Qi Zheng
  2024-01-03  2:46   ` Tetsuo Handa
  2024-01-03  2:40 ` Qi Zheng
  1 sibling, 1 reply; 4+ messages in thread
From: Qi Zheng @ 2024-01-03  2:33 UTC (permalink / raw)
  To: Andrew Morton
  Cc: mm-commits, syzbot+1e0ed05798af62917464, songmuchun,
	penguin-kernel



On 2024/1/3 01:58, Andrew Morton wrote:
> The patch titled
>       Subject: mm: shrinker: use kvzalloc_node() from memcg_expand_one_shrinker_map()
> has been added to the -mm mm-hotfixes-unstable branch.  Its filename is
>       mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch
> 
> This patch will shortly appear at
>       https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch
> 
> This patch will later appear in the mm-hotfixes-unstable branch at
>      git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> 
> Before you just go and hit "reply", please:
>     a) Consider who else should be cc'ed
>     b) Prefer to cc a suitable mailing list as well
>     c) Ideally: find the original patch on the mailing list and do a
>        reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> 
> The -mm tree is included into linux-next via the mm-everything
> branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there every 2-3 working days
> 
> ------------------------------------------------------
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Subject: mm: shrinker: use kvzalloc_node() from memcg_expand_one_shrinker_map()
> Date: Wed, 3 Jan 2024 00:46:36 +0900
> 
> syzbot is reporting uninit-value at shrinker_alloc(), for commit
> 307bececcd12 ("mm: shrinker: add a secondary array for
> shrinker_info::{map, nr_deferred}") which assumed that the ->unit was
> allocated with __GFP_ZERO forgot to replace kvmalloc_node() in
> memcg_expand_one_shrinker_map() with kvzalloc_node().
> 
> Link: https://lkml.kernel.org/r/b1a78c6a-b3fa-46ed-810a-ce546e726d44@I-love.SAKURA.ne.jp

Thanks for fixing this!

Reviewed-by: Qi Zheng <zhengqi.arch@bytedance.com>

BTW, this link above seems to be inaccessible:

```
Message-ID <b1a78c6a-b3fa-46ed-810a-ce546e726d44@I-love.SAKURA.ne.jp>
not found

Perhaps try an external site:
```

And I did not find this patch in LKML.

> Fixes: 307bececcd12 ("mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}")
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Reported-by: syzbot <syzbot+1e0ed05798af62917464@syzkaller.appspotmail.com>
> Closes: https://syzkaller.appspot.com/bug?extid=1e0ed05798af62917464
> Cc: Qi Zheng <zhengqi.arch@bytedance.com>
> Cc: Muchun Song <songmuchun@bytedance.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>   mm/shrinker.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/mm/shrinker.c~mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map
> +++ a/mm/shrinker.c
> @@ -126,7 +126,7 @@ static int expand_one_shrinker_info(stru
>   		if (new_nr_max <= old->map_nr_max)
>   			continue;
>   
> -		new = kvmalloc_node(sizeof(*new) + new_size, GFP_KERNEL, nid);
> +		new = kvzalloc_node(sizeof(*new) + new_size, GFP_KERNEL, nid);
>   		if (!new)
>   			return -ENOMEM;
>   
> _
> 
> Patches currently in -mm which might be from penguin-kernel@I-love.SAKURA.ne.jp are
> 
> mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: + mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch added to mm-hotfixes-unstable branch
  2024-01-02 17:58 + mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch added to mm-hotfixes-unstable branch Andrew Morton
  2024-01-03  2:33 ` Qi Zheng
@ 2024-01-03  2:40 ` Qi Zheng
  1 sibling, 0 replies; 4+ messages in thread
From: Qi Zheng @ 2024-01-03  2:40 UTC (permalink / raw)
  To: Andrew Morton
  Cc: mm-commits, syzbot+1e0ed05798af62917464, songmuchun,
	penguin-kernel



On 2024/1/3 01:58, Andrew Morton wrote:
> The patch titled
>       Subject: mm: shrinker: use kvzalloc_node() from memcg_expand_one_shrinker_map()
> has been added to the -mm mm-hotfixes-unstable branch.  Its filename is
>       mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch
> 
> This patch will shortly appear at
>       https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch
> 
> This patch will later appear in the mm-hotfixes-unstable branch at
>      git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> 
> Before you just go and hit "reply", please:
>     a) Consider who else should be cc'ed
>     b) Prefer to cc a suitable mailing list as well
>     c) Ideally: find the original patch on the mailing list and do a
>        reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> 
> The -mm tree is included into linux-next via the mm-everything
> branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there every 2-3 working days
> 
> ------------------------------------------------------
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Subject: mm: shrinker: use kvzalloc_node() from memcg_expand_one_shrinker_map()

And we don't have memcg_expand_one_shrinker_map(), maybe change the
Subject to "mm: shrinker: use kvzalloc_node() in expand_one_shrinker_info()"

> Date: Wed, 3 Jan 2024 00:46:36 +0900
> 
> syzbot is reporting uninit-value at shrinker_alloc(), for commit
> 307bececcd12 ("mm: shrinker: add a secondary array for
> shrinker_info::{map, nr_deferred}") which assumed that the ->unit was
> allocated with __GFP_ZERO forgot to replace kvmalloc_node() in
> memcg_expand_one_shrinker_map() with kvzalloc_node().

Ditto, needs to be changed to expand_one_shrinker_info().

> 
> Link: https://lkml.kernel.org/r/b1a78c6a-b3fa-46ed-810a-ce546e726d44@I-love.SAKURA.ne.jp
> Fixes: 307bececcd12 ("mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}")
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Reported-by: syzbot <syzbot+1e0ed05798af62917464@syzkaller.appspotmail.com>
> Closes: https://syzkaller.appspot.com/bug?extid=1e0ed05798af62917464
> Cc: Qi Zheng <zhengqi.arch@bytedance.com>
> Cc: Muchun Song <songmuchun@bytedance.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>   mm/shrinker.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/mm/shrinker.c~mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map
> +++ a/mm/shrinker.c
> @@ -126,7 +126,7 @@ static int expand_one_shrinker_info(stru
>   		if (new_nr_max <= old->map_nr_max)
>   			continue;
>   
> -		new = kvmalloc_node(sizeof(*new) + new_size, GFP_KERNEL, nid);
> +		new = kvzalloc_node(sizeof(*new) + new_size, GFP_KERNEL, nid);
>   		if (!new)
>   			return -ENOMEM;
>   
> _
> 
> Patches currently in -mm which might be from penguin-kernel@I-love.SAKURA.ne.jp are
> 
> mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: + mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch added to mm-hotfixes-unstable branch
  2024-01-03  2:33 ` Qi Zheng
@ 2024-01-03  2:46   ` Tetsuo Handa
  0 siblings, 0 replies; 4+ messages in thread
From: Tetsuo Handa @ 2024-01-03  2:46 UTC (permalink / raw)
  To: Qi Zheng, Andrew Morton
  Cc: mm-commits, syzbot+1e0ed05798af62917464, songmuchun

On 2024/01/03 11:33, Qi Zheng wrote:
>> Link: https://lkml.kernel.org/r/b1a78c6a-b3fa-46ed-810a-ce546e726d44@I-love.SAKURA.ne.jp
> 
> Thanks for fixing this!
> 
> Reviewed-by: Qi Zheng <zhengqi.arch@bytedance.com>
> 
> BTW, this link above seems to be inaccessible:
> 
> ```
> Message-ID <b1a78c6a-b3fa-46ed-810a-ce546e726d44@I-love.SAKURA.ne.jp>
> not found
> 
> Perhaps try an external site:
> ```
> 
> And I did not find this patch in LKML.

Hmm. It seems that I should not remove linux-kernel@vger.kernel.org when posting to linux-mm@kvack.org
because lkml.kernel.org does not archive linux-mm@kvack.org and syzbot can not find this patch.

Andrew, please take v2 which corrected function name.

> 
>> Fixes: 307bececcd12 ("mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}")
>> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
>> Reported-by: syzbot <syzbot+1e0ed05798af62917464@syzkaller.appspotmail.com>
>> Closes: https://syzkaller.appspot.com/bug?extid=1e0ed05798af62917464
>> Cc: Qi Zheng <zhengqi.arch@bytedance.com>
>> Cc: Muchun Song <songmuchun@bytedance.com>
>> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-03  2:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-02 17:58 + mm-shrinker-use-kvzalloc_node-from-memcg_expand_one_shrinker_map.patch added to mm-hotfixes-unstable branch Andrew Morton
2024-01-03  2:33 ` Qi Zheng
2024-01-03  2:46   ` Tetsuo Handa
2024-01-03  2:40 ` Qi Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.