linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [mm?] general protection fault in swap_reclaim_full_clusters
@ 2024-11-06  1:23 syzbot
  2024-11-07 14:23 ` Johannes Weiner
  0 siblings, 1 reply; 5+ messages in thread
From: syzbot @ 2024-11-06  1:23 UTC (permalink / raw)
  To: akpm, linux-kernel, linux-mm, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    59b723cd2adb Linux 6.12-rc6
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1076c740580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=b77c8a55ccf1d9e2
dashboard link: https://syzkaller.appspot.com/bug?extid=078be8bfa863cb9e0c6b
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=167aa1f7980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=110d86a7980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/699c7100a12a/disk-59b723cd.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/74524a66d4bc/vmlinux-59b723cd.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e81ed2bba0ef/bzImage-59b723cd.xz

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

Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
CPU: 1 UID: 0 PID: 51 Comm: kworker/1:1 Not tainted 6.12.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: events swap_reclaim_work
RIP: 0010:__list_del_entry_valid_or_report+0x20/0x1c0 lib/list_debug.c:49
Code: 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 89 fe 48 83 c7 08 48 83 ec 18 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 19 01 00 00 48 89 f2 48 8b 4e 08 48 b8 00 00 00
RSP: 0018:ffffc90000bb7c30 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffff88807b9ae078
RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000008
RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 000000000000004f R12: dffffc0000000000
R13: ffffffffffffffb8 R14: ffff88807b9ae000 R15: ffffc90003af1000
FS:  0000000000000000(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fffaca68fb8 CR3: 00000000791c8000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __list_del_entry_valid include/linux/list.h:124 [inline]
 __list_del_entry include/linux/list.h:215 [inline]
 list_move_tail include/linux/list.h:310 [inline]
 swap_reclaim_full_clusters+0x109/0x460 mm/swapfile.c:748
 swap_reclaim_work+0x2e/0x40 mm/swapfile.c:779
 process_one_work+0x958/0x1b30 kernel/workqueue.c:3229
 process_scheduled_works kernel/workqueue.c:3310 [inline]
 worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391
 kthread+0x2c1/0x3a0 kernel/kthread.c:389
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__list_del_entry_valid_or_report+0x20/0x1c0 lib/list_debug.c:49
Code: 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 89 fe 48 83 c7 08 48 83 ec 18 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 19 01 00 00 48 89 f2 48 8b 4e 08 48 b8 00 00 00
RSP: 0018:ffffc90000bb7c30 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffff88807b9ae078
RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000008
RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 000000000000004f R12: dffffc0000000000
R13: ffffffffffffffb8 R14: ffff88807b9ae000 R15: ffffc90003af1000
FS:  0000000000000000(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fffaca68fb8 CR3: 00000000791c8000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	90                   	nop
   1:	90                   	nop
   2:	90                   	nop
   3:	90                   	nop
   4:	90                   	nop
   5:	90                   	nop
   6:	90                   	nop
   7:	90                   	nop
   8:	90                   	nop
   9:	90                   	nop
   a:	f3 0f 1e fa          	endbr64
   e:	48 89 fe             	mov    %rdi,%rsi
  11:	48 83 c7 08          	add    $0x8,%rdi
  15:	48 83 ec 18          	sub    $0x18,%rsp
  19:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  20:	fc ff df
  23:	48 89 fa             	mov    %rdi,%rdx
  26:	48 c1 ea 03          	shr    $0x3,%rdx
* 2a:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1) <-- trapping instruction
  2e:	0f 85 19 01 00 00    	jne    0x14d
  34:	48 89 f2             	mov    %rsi,%rdx
  37:	48 8b 4e 08          	mov    0x8(%rsi),%rcx
  3b:	48                   	rex.W
  3c:	b8                   	.byte 0xb8
  3d:	00 00                	add    %al,(%rax)


---
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 syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup


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

* Re: [syzbot] [mm?] general protection fault in swap_reclaim_full_clusters
  2024-11-06  1:23 [syzbot] [mm?] general protection fault in swap_reclaim_full_clusters syzbot
@ 2024-11-07 14:23 ` Johannes Weiner
  2024-11-08 22:11   ` Matteo Croce
  2024-11-08 23:29   ` Hillf Danton
  0 siblings, 2 replies; 5+ messages in thread
From: Johannes Weiner @ 2024-11-07 14:23 UTC (permalink / raw)
  To: syzbot; +Cc: akpm, linux-kernel, linux-mm, syzkaller-bugs, Kairui Song

On Tue, Nov 05, 2024 at 05:23:23PM -0800, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    59b723cd2adb Linux 6.12-rc6
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1076c740580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=b77c8a55ccf1d9e2
> dashboard link: https://syzkaller.appspot.com/bug?extid=078be8bfa863cb9e0c6b
> compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=167aa1f7980000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=110d86a7980000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/699c7100a12a/disk-59b723cd.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/74524a66d4bc/vmlinux-59b723cd.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/e81ed2bba0ef/bzImage-59b723cd.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+078be8bfa863cb9e0c6b@syzkaller.appspotmail.com
> 
> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI
> KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
> CPU: 1 UID: 0 PID: 51 Comm: kworker/1:1 Not tainted 6.12.0-rc6-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
> Workqueue: events swap_reclaim_work
> RIP: 0010:__list_del_entry_valid_or_report+0x20/0x1c0 lib/list_debug.c:49
> Code: 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 89 fe 48 83 c7 08 48 83 ec 18 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 19 01 00 00 48 89 f2 48 8b 4e 08 48 b8 00 00 00
> RSP: 0018:ffffc90000bb7c30 EFLAGS: 00010202
> RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffff88807b9ae078
> RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000008
> RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
> R10: 0000000000000001 R11: 000000000000004f R12: dffffc0000000000
> R13: ffffffffffffffb8 R14: ffff88807b9ae000 R15: ffffc90003af1000
> FS:  0000000000000000(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007fffaca68fb8 CR3: 00000000791c8000 CR4: 00000000003526f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
>  <TASK>
>  __list_del_entry_valid include/linux/list.h:124 [inline]
>  __list_del_entry include/linux/list.h:215 [inline]
>  list_move_tail include/linux/list.h:310 [inline]
>  swap_reclaim_full_clusters+0x109/0x460 mm/swapfile.c:748
>  swap_reclaim_work+0x2e/0x40 mm/swapfile.c:779
>  process_one_work+0x958/0x1b30 kernel/workqueue.c:3229
>  process_scheduled_works kernel/workqueue.c:3310 [inline]
>  worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391
>  kthread+0x2c1/0x3a0 kernel/kthread.c:389
>  ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>  </TASK>
> Modules linked in:
> ---[ end trace 0000000000000000 ]---
> RIP: 0010:__list_del_entry_valid_or_report+0x20/0x1c0 lib/list_debug.c:49
> Code: 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 89 fe 48 83 c7 08 48 83 ec 18 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 19 01 00 00 48 89 f2 48 8b 4e 08 48 b8 00 00 00
> RSP: 0018:ffffc90000bb7c30 EFLAGS: 00010202
> RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffff88807b9ae078
> RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000008
> RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
> R10: 0000000000000001 R11: 000000000000004f R12: dffffc0000000000
> R13: ffffffffffffffb8 R14: ffff88807b9ae000 R15: ffffc90003af1000
> FS:  0000000000000000(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007fffaca68fb8 CR3: 00000000791c8000 CR4: 00000000003526f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> ----------------
> Code disassembly (best guess):
>    0:	90                   	nop
>    1:	90                   	nop
>    2:	90                   	nop
>    3:	90                   	nop
>    4:	90                   	nop
>    5:	90                   	nop
>    6:	90                   	nop
>    7:	90                   	nop
>    8:	90                   	nop
>    9:	90                   	nop
>    a:	f3 0f 1e fa          	endbr64
>    e:	48 89 fe             	mov    %rdi,%rsi
>   11:	48 83 c7 08          	add    $0x8,%rdi
>   15:	48 83 ec 18          	sub    $0x18,%rsp
>   19:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
>   20:	fc ff df
>   23:	48 89 fa             	mov    %rdi,%rdx
>   26:	48 c1 ea 03          	shr    $0x3,%rdx
> * 2a:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1) <-- trapping instruction
>   2e:	0f 85 19 01 00 00    	jne    0x14d
>   34:	48 89 f2             	mov    %rsi,%rdx
>   37:	48 8b 4e 08          	mov    0x8(%rsi),%rcx
>   3b:	48                   	rex.W
>   3c:	b8                   	.byte 0xb8
>   3d:	00 00                	add    %al,(%rax)
> 
> 

This should fix it:

---

From cf580e76e9fc23eab347e232b32d8bc9378a3f4e Mon Sep 17 00:00:00 2001
From: Johannes Weiner <hannes@cmpxchg.org>
Date: Thu, 7 Nov 2024 09:08:36 -0500
Subject: [PATCH] mm: swapfile: fix cluster reclaim work crash on rotational
 devices

syzbot and Daan report a NULL pointer crash in the new full swap
cluster reclaim work:

> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI
> KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
> CPU: 1 UID: 0 PID: 51 Comm: kworker/1:1 Not tainted 6.12.0-rc6-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
> Workqueue: events swap_reclaim_work
> RIP: 0010:__list_del_entry_valid_or_report+0x20/0x1c0 lib/list_debug.c:49
> Code: 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 89 fe 48 83 c7 08 48 83 ec 18 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 19 01 00 00 48 89 f2 48 8b 4e 08 48 b8 00 00 00
> RSP: 0018:ffffc90000bb7c30 EFLAGS: 00010202
> RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffff88807b9ae078
> RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000008
> RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
> R10: 0000000000000001 R11: 000000000000004f R12: dffffc0000000000
> R13: ffffffffffffffb8 R14: ffff88807b9ae000 R15: ffffc90003af1000
> FS:  0000000000000000(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007fffaca68fb8 CR3: 00000000791c8000 CR4: 00000000003526f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
>  <TASK>
>  __list_del_entry_valid include/linux/list.h:124 [inline]
>  __list_del_entry include/linux/list.h:215 [inline]
>  list_move_tail include/linux/list.h:310 [inline]
>  swap_reclaim_full_clusters+0x109/0x460 mm/swapfile.c:748
>  swap_reclaim_work+0x2e/0x40 mm/swapfile.c:779

The syzbot console output indicates a virtual environment where
swapfile is on a rotational device. In this case, clusters aren't
actually used, and si->full_clusters is not initialized. Daan's report
is from qemu, so likely rotational too.

Make sure to only schedule the cluster reclaim work when clusters are
actually in use.

Link: https://lore.kernel.org/lkml/672ac50b.050a0220.2edce.1517.GAE@google.com/
Link: https://github.com/systemd/systemd/issues/35044
Fixes: 5168a68eb78f ("mm, swap: avoid over reclaim of full clusters")
Reported-by: syzbot+078be8bfa863cb9e0c6b@syzkaller.appspotmail.com
Reported-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/swapfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 46bd4b1a3c07..9c85bd46ab7f 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -929,7 +929,7 @@ static void swap_range_alloc(struct swap_info_struct *si, unsigned long offset,
 		si->highest_bit = 0;
 		del_from_avail_list(si);
 
-		if (vm_swap_full())
+		if (si->cluster_info && vm_swap_full())
 			schedule_work(&si->reclaim_work);
 	}
 }
-- 
2.47.0



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

* Re: [syzbot] [mm?] general protection fault in swap_reclaim_full_clusters
  2024-11-07 14:23 ` Johannes Weiner
@ 2024-11-08 22:11   ` Matteo Croce
  2024-11-08 23:29   ` Hillf Danton
  1 sibling, 0 replies; 5+ messages in thread
From: Matteo Croce @ 2024-11-08 22:11 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: syzbot, akpm, linux-kernel, linux-mm, syzkaller-bugs,
	Kairui Song, Daan De Meyer, Luca Boccassi

Il giorno ven 8 nov 2024 alle ore 18:35 Johannes Weiner
<hannes@cmpxchg.org> ha scritto:
> The syzbot console output indicates a virtual environment where
> swapfile is on a rotational device. In this case, clusters aren't
> actually used, and si->full_clusters is not initialized. Daan's report
> is from qemu, so likely rotational too.
>
> Make sure to only schedule the cluster reclaim work when clusters are
> actually in use.
>
> Link: https://lore.kernel.org/lkml/672ac50b.050a0220.2edce.1517.GAE@google.com/
> Link: https://github.com/systemd/systemd/issues/35044
> Fixes: 5168a68eb78f ("mm, swap: avoid over reclaim of full clusters")
> Reported-by: syzbot+078be8bfa863cb9e0c6b@syzkaller.appspotmail.com
> Reported-by: Daan De Meyer <daan.j.demeyer@gmail.com>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  mm/swapfile.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index 46bd4b1a3c07..9c85bd46ab7f 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -929,7 +929,7 @@ static void swap_range_alloc(struct swap_info_struct *si, unsigned long offset,
>                 si->highest_bit = 0;
>                 del_from_avail_list(si);
>
> -               if (vm_swap_full())
> +               if (si->cluster_info && vm_swap_full())
>                         schedule_work(&si->reclaim_work);
>         }
>  }
> --

I've tested the patch and now the oomd test passes:

1/1 systemd:integration-tests / TEST-55-OOMD OK               63.48s

Tested-by: Matteo Croce <teknoraver@meta.com>

-- 
Matteo Croce

perl -e 'for($t=0;;$t++){print chr($t*($t>>8|$t>>13)&255)}' |aplay


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

* Re: [syzbot] [mm?] general protection fault in swap_reclaim_full_clusters
  2024-11-07 14:23 ` Johannes Weiner
  2024-11-08 22:11   ` Matteo Croce
@ 2024-11-08 23:29   ` Hillf Danton
  2024-11-08 23:51     ` syzbot
  1 sibling, 1 reply; 5+ messages in thread
From: Hillf Danton @ 2024-11-08 23:29 UTC (permalink / raw)
  To: syzbot
  Cc: Johannes Weiner, linux-kernel, linux-mm, syzkaller-bugs,
	Kairui Song, Daan De Meyer

On Thu, 7 Nov 2024 09:23:35 -0500 Johannes Weiner <hannes@cmpxchg.org>
> On Tue, Nov 05, 2024 at 05:23:23PM -0800, syzbot wrote:
> > Hello,
> > 
> > syzbot found the following issue on:
> > 
> > HEAD commit:    59b723cd2adb Linux 6.12-rc6
> > git tree:       upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=1076c740580000
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=b77c8a55ccf1d9e2
> > dashboard link: https://syzkaller.appspot.com/bug?extid=078be8bfa863cb9e0c6b
> > compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=167aa1f7980000
> > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=110d86a7980000

#syz test

The syzbot console output indicates a virtual environment where
swapfile is on a rotational device. In this case, clusters aren't
actually used, and si->full_clusters is not initialized. Daan's report
is from qemu, so likely rotational too.

Make sure to only schedule the cluster reclaim work when clusters are
actually in use.

Link: https://lore.kernel.org/lkml/672ac50b.050a0220.2edce.1517.GAE@google.com/
Link: https://github.com/systemd/systemd/issues/35044
Fixes: 5168a68eb78f ("mm, swap: avoid over reclaim of full clusters")
Reported-by: syzbot+078be8bfa863cb9e0c6b@syzkaller.appspotmail.com
Reported-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/swapfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 46bd4b1a3c07..9c85bd46ab7f 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -929,7 +929,7 @@ static void swap_range_alloc(struct swap_info_struct *si, unsigned long offset,
 		si->highest_bit = 0;
 		del_from_avail_list(si);
 
-		if (vm_swap_full())
+		if (si->cluster_info && vm_swap_full())
 			schedule_work(&si->reclaim_work);
 	}
 }
-- 
2.47.0


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

* Re: [syzbot] [mm?] general protection fault in swap_reclaim_full_clusters
  2024-11-08 23:29   ` Hillf Danton
@ 2024-11-08 23:51     ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2024-11-08 23:51 UTC (permalink / raw)
  To: daan.j.demeyer, hannes, hdanton, linux-kernel, linux-mm, ryncsn,
	syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+078be8bfa863cb9e0c6b@syzkaller.appspotmail.com
Tested-by: syzbot+078be8bfa863cb9e0c6b@syzkaller.appspotmail.com

Tested on:

commit:         da4373fb Merge tag 'thermal-6.12-rc7' of git://git.ker..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11de435f980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e568a63823509f1f
dashboard link: https://syzkaller.appspot.com/bug?extid=078be8bfa863cb9e0c6b
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=17a72ea7980000

Note: testing is done by a robot and is best-effort only.


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

end of thread, other threads:[~2024-11-08 23:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-06  1:23 [syzbot] [mm?] general protection fault in swap_reclaim_full_clusters syzbot
2024-11-07 14:23 ` Johannes Weiner
2024-11-08 22:11   ` Matteo Croce
2024-11-08 23:29   ` Hillf Danton
2024-11-08 23:51     ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox