[syzbot] WARNING in __split_huge_page_tail

10 views
Skip to first unread message

syzbot

unread,
Oct 26, 2022, 2:59:44 AM10/26/22
to ak...@linux-foundation.org, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 4da34b7d175d Merge tag 'thermal-6.1-rc2' of git://git.kern..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=113bd8bc880000
kernel config: https://syzkaller.appspot.com/x/.config?x=4789759e8a6d5f57
dashboard link: https://syzkaller.appspot.com/bug?extid=273b547b15eb58ea35e8
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=161e1f62880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16dd4fe6880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a61ddb36c296/disk-4da34b7d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ceee41246252/vmlinux-4da34b7d.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+273b54...@syzkaller.appspotmail.com

tlb_finish_mmu+0xcb/0x200 mm/mmu_gather.c:363
exit_mmap+0x2b1/0x670 mm/mmap.c:3098
__mmput+0x114/0x3b0 kernel/fork.c:1185
exit_mm+0x217/0x2f0 kernel/exit.c:516
do_exit+0x5e7/0x2070 kernel/exit.c:807
do_group_exit+0x1fd/0x2b0 kernel/exit.c:950
__do_sys_exit_group kernel/exit.c:961 [inline]
__se_sys_exit_group kernel/exit.c:959 [inline]
__x64_sys_exit_group+0x3b/0x40 kernel/exit.c:959
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
------------[ cut here ]------------
WARNING: CPU: 0 PID: 3908 at mm/huge_memory.c:2465 __split_huge_page_tail+0x81c/0x1080 mm/huge_memory.c:2465
Modules linked in:
CPU: 0 PID: 3908 Comm: syz-executor315 Not tainted 6.1.0-rc1-syzkaller-00249-g4da34b7d175d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
RIP: 0010:__split_huge_page_tail+0x81c/0x1080 mm/huge_memory.c:2465
Code: ff ff e8 57 a7 a6 ff 48 ff cb e9 1a fd ff ff e8 4a a7 a6 ff 4c 89 ef 48 c7 c6 80 5d bb 8a e8 6b f0 e3 ff c6 05 2f 20 30 0c 01 <0f> 0b e9 cb fb ff ff 89 e9 80 e1 07 80 c1 03 38 c1 0f 8c 29 f8 ff
RSP: 0018:ffffc900044b6ba8 EFLAGS: 00010046
RAX: beb4e3f6a4108300 RBX: 1ffffd400031ed85 RCX: ffffffff8169255b
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffffff8e277d28
RBP: ffffea00018f0008 R08: dffffc0000000000 R09: fffffbfff1c4efa6
R10: fffffbfff1c4efa6 R11: 1ffffffff1c4efa5 R12: ffffea00018f6c00
R13: ffffea00018f0000 R14: 1ffffd400031e001 R15: ffffea00018f6c28
FS: 00005555567b0300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020001304 CR3: 000000001d5c1000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__split_huge_page+0x403/0x1df0 mm/huge_memory.c:2527
split_huge_page_to_list+0x101d/0x1c90 mm/huge_memory.c:2756
split_huge_page include/linux/huge_mm.h:188 [inline]
deferred_split_scan+0x683/0x8b0 mm/huge_memory.c:2882
do_shrink_slab+0x4e1/0xa00 mm/vmscan.c:842
shrink_slab_memcg+0x2ec/0x630 mm/vmscan.c:911
shrink_slab+0xbe/0x340 mm/vmscan.c:990
shrink_node_memcgs+0x3c3/0x770 mm/vmscan.c:6076
shrink_node+0x299/0x1050 mm/vmscan.c:6105
shrink_zones+0x4fb/0xc40 mm/vmscan.c:6343
do_try_to_free_pages+0x215/0xcd0 mm/vmscan.c:6405
try_to_free_mem_cgroup_pages+0x3cb/0x6d0 mm/vmscan.c:6720
try_charge_memcg+0x6a1/0x11f0 mm/memcontrol.c:2681
try_charge mm/memcontrol.c:2823 [inline]
mem_cgroup_charge_skmem+0xa7/0x370 mm/memcontrol.c:7209
sock_reserve_memory+0x105/0x640 net/core/sock.c:1018
sk_setsockopt+0x16bf/0x32c0 net/core/sock.c:1518
__sys_setsockopt+0x6ba/0xa00 net/socket.c:2248
__do_sys_setsockopt net/socket.c:2263 [inline]
__se_sys_setsockopt net/socket.c:2260 [inline]
__x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2260
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7ff3a2ea8ee9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 15 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd09efcd08 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007ff3a2ea8ee9
RDX: 0000000000000049 RSI: 0000000000000001 RDI: 0000000000000004
RBP: 0000000000000000 R08: 0000000000000010 R09: 00007ffd09efcd30
R10: 0000000020000040 R11: 0000000000000246 R12: 00007ffd09efcd2c
R13: 00007ffd09efcd40 R14: 00007ffd09efcd80 R15: 0000000000000130
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

David Hildenbrand

unread,
Oct 26, 2022, 5:54:18 AM10/26/22
to syzbot, ak...@linux-foundation.org, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com
Is this the

VM_BUG_ON_PAGE(atomic_read(&page_tail->_mapcount) != -1, page_tail);

assertion?

--
Thanks,

David / dhildenb

Dmitry Vyukov

unread,
Oct 26, 2022, 9:25:41 AM10/26/22
to David Hildenbrand, syzbot, ak...@linux-foundation.org, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com
Hi David,

You can check the sources for that revision, but on the dashboard
there are clickable links for all source references:
https://syzkaller.appspot.com/bug?extid=273b547b15eb58ea35e8

In this case it points to:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/huge_memory.c?id=4da34b7d175dc99b8befebd69e96546c960d526c#n2465

David Hildenbrand

unread,
Oct 26, 2022, 10:46:25 AM10/26/22
to Dmitry Vyukov, syzbot, ak...@linux-foundation.org, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com, Mel Gorman, Hugh Dickins
Ah, thanks!

... so

if (!folio_test_swapcache(page_folio(head))) {
VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, head);
page_tail->private = 0;
}

I recall that there was a patch either from Hugh or Mel floating around
that might be related.

Hugh Dickins

unread,
Oct 26, 2022, 12:18:05 PM10/26/22
to David Hildenbrand, Dmitry Vyukov, syzbot, ak...@linux-foundation.org, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com, Mel Gorman, Hugh Dickins
Yes, it's in akpm's mm-hotfixes-unstable branch, currently at
826367c8c422 ("mm: prep_compound_tail() clear page->private")

[PATCH] mm: prep_compound_tail() clear page->private

Although page allocation always clears page->private in the first page
or head page of an allocation, it has never made a point of clearing
page->private in the tails (though 0 is often what is already there).

But now commit 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t
during THP split") issues a warning when page_tail->private is found to
be non-0 (unless it's swapcache).

Change that warning to dump page_tail (which also dumps head), instead
of just the head: so far we have seen dead000000000122, dead000000000003,
dead000000000001 or 0000000000000002 in the raw output for tail private.

We could just delete the warning, but today's consensus appears to want
page->private to be 0, unless there's a good reason for it to be set:
so now clear it in prep_compound_tail() (more general than just for THP;
but not for high order allocation, which makes no pass down the tails).

Fixes: 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t during THP split")
Signed-off-by: Hugh Dickins <hu...@google.com>
Cc: Mel Gorman <mgo...@techsingularity.net>
Cc: Matthew Wilcox (Oracle) <wi...@infradead.org>
Cc: <sta...@vger.kernel.org>
---
mm/huge_memory.c | 2 +-
mm/page_alloc.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 03fc7e5edf07..561a42567477 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2462,7 +2462,7 @@ static void __split_huge_page_tail(struct page *head, int tail,
* Fix up and warn once if private is unexpectedly set.
*/
if (!folio_test_swapcache(page_folio(head))) {
- VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, head);
+ VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, page_tail);
page_tail->private = 0;
}

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b5a6c815ae28..218b28ee49ed 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -807,6 +807,7 @@ static void prep_compound_tail(struct page *head, int tail_idx)

p->mapping = TAIL_MAPPING;
set_compound_head(p, head);
+ set_page_private(p, 0);
}

void prep_compound_page(struct page *page, unsigned int order)
--
2.35.3

Dmitry Vyukov

unread,
Nov 13, 2022, 11:44:57 AM11/13/22
to Hugh Dickins, David Hildenbrand, syzbot, ak...@linux-foundation.org, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com, Mel Gorman
Let's tell syzbot about the fix so that it reports similar bugs in future:

#syz fix: mm: prep_compound_tail() clear page->private
Reply all
Reply to author
Forward
0 new messages