Skip to content

Commit 15d2fdd

Browse files
committed
mm/vmscan: fix a bug calling wakeup_kswapd() with a wrong zone index
jira LE-1907 cve CVE-2024-26783 Rebuild_History Non-Buildable kernel-5.14.0-427.26.1.el9_4 commit-author Byungchul Park <[email protected]> commit 2774f25 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-5.14.0-427.26.1.el9_4/2774f256.failed With numa balancing on, when a numa system is running where a numa node doesn't have its local memory so it has no managed zones, the following oops has been observed. It's because wakeup_kswapd() is called with a wrong zone index, -1. Fixed it by checking the index before calling wakeup_kswapd(). > BUG: unable to handle page fault for address: 00000000000033f3 > #PF: supervisor read access in kernel mode > #PF: error_code(0x0000) - not-present page > PGD 0 P4D 0 > Oops: 0000 [#1] PREEMPT SMP NOPTI > CPU: 2 PID: 895 Comm: masim Not tainted 6.6.0-dirty ctrliq#255 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS > rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 > RIP: 0010:wakeup_kswapd (./linux/mm/vmscan.c:7812) > Code: (omitted) > RSP: 0000:ffffc90004257d58 EFLAGS: 00010286 > RAX: ffffffffffffffff RBX: ffff88883fff0480 RCX: 0000000000000003 > RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88883fff0480 > RBP: ffffffffffffffff R08: ff0003ffffffffff R09: ffffffffffffffff > R10: ffff888106c95540 R11: 0000000055555554 R12: 0000000000000003 > R13: 0000000000000000 R14: 0000000000000000 R15: ffff88883fff0940 > FS: 00007fc4b8124740(0000) GS:ffff888827c00000(0000) knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 00000000000033f3 CR3: 000000026cc08004 CR4: 0000000000770ee0 > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > PKRU: 55555554 > Call Trace: > <TASK> > ? __die > ? page_fault_oops > ? __pte_offset_map_lock > ? exc_page_fault > ? asm_exc_page_fault > ? wakeup_kswapd > migrate_misplaced_page > __handle_mm_fault > handle_mm_fault > do_user_addr_fault > exc_page_fault > asm_exc_page_fault > RIP: 0033:0x55b897ba0808 > Code: (omitted) > RSP: 002b:00007ffeefa821a0 EFLAGS: 00010287 > RAX: 000055b89983acd0 RBX: 00007ffeefa823f8 RCX: 000055b89983acd0 > RDX: 00007fc2f8122010 RSI: 0000000000020000 RDI: 000055b89983acd0 > RBP: 00007ffeefa821a0 R08: 0000000000000037 R09: 0000000000000075 > R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000 > R13: 00007ffeefa82410 R14: 000055b897ba5dd8 R15: 00007fc4b8340000 > </TASK> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Byungchul Park <[email protected]> Reported-by: Hyeongtak Ji <[email protected]> Fixes: c574bbe ("NUMA balancing: optimize page placement for memory tiering system") Reviewed-by: Oscar Salvador <[email protected]> Cc: Baolin Wang <[email protected]> Cc: "Huang, Ying" <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> (cherry picked from commit 2774f25) Signed-off-by: Jonathan Maple <[email protected]> # Conflicts: # mm/migrate.c
1 parent 8b6503d commit 15d2fdd

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
mm/vmscan: fix a bug calling wakeup_kswapd() with a wrong zone index
2+
3+
jira LE-1907
4+
cve CVE-2024-26783
5+
Rebuild_History Non-Buildable kernel-5.14.0-427.26.1.el9_4
6+
commit-author Byungchul Park <[email protected]>
7+
commit 2774f256e7c0219e2b0a0894af1c76bdabc4f974
8+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
9+
Will be included in final tarball splat. Ref for failed cherry-pick at:
10+
ciq/ciq_backports/kernel-5.14.0-427.26.1.el9_4/2774f256.failed
11+
12+
With numa balancing on, when a numa system is running where a numa node
13+
doesn't have its local memory so it has no managed zones, the following
14+
oops has been observed. It's because wakeup_kswapd() is called with a
15+
wrong zone index, -1. Fixed it by checking the index before calling
16+
wakeup_kswapd().
17+
18+
> BUG: unable to handle page fault for address: 00000000000033f3
19+
> #PF: supervisor read access in kernel mode
20+
> #PF: error_code(0x0000) - not-present page
21+
> PGD 0 P4D 0
22+
> Oops: 0000 [#1] PREEMPT SMP NOPTI
23+
> CPU: 2 PID: 895 Comm: masim Not tainted 6.6.0-dirty #255
24+
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
25+
> rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
26+
> RIP: 0010:wakeup_kswapd (./linux/mm/vmscan.c:7812)
27+
> Code: (omitted)
28+
> RSP: 0000:ffffc90004257d58 EFLAGS: 00010286
29+
> RAX: ffffffffffffffff RBX: ffff88883fff0480 RCX: 0000000000000003
30+
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88883fff0480
31+
> RBP: ffffffffffffffff R08: ff0003ffffffffff R09: ffffffffffffffff
32+
> R10: ffff888106c95540 R11: 0000000055555554 R12: 0000000000000003
33+
> R13: 0000000000000000 R14: 0000000000000000 R15: ffff88883fff0940
34+
> FS: 00007fc4b8124740(0000) GS:ffff888827c00000(0000) knlGS:0000000000000000
35+
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
36+
> CR2: 00000000000033f3 CR3: 000000026cc08004 CR4: 0000000000770ee0
37+
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
38+
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
39+
> PKRU: 55555554
40+
> Call Trace:
41+
> <TASK>
42+
> ? __die
43+
> ? page_fault_oops
44+
> ? __pte_offset_map_lock
45+
> ? exc_page_fault
46+
> ? asm_exc_page_fault
47+
> ? wakeup_kswapd
48+
> migrate_misplaced_page
49+
> __handle_mm_fault
50+
> handle_mm_fault
51+
> do_user_addr_fault
52+
> exc_page_fault
53+
> asm_exc_page_fault
54+
> RIP: 0033:0x55b897ba0808
55+
> Code: (omitted)
56+
> RSP: 002b:00007ffeefa821a0 EFLAGS: 00010287
57+
> RAX: 000055b89983acd0 RBX: 00007ffeefa823f8 RCX: 000055b89983acd0
58+
> RDX: 00007fc2f8122010 RSI: 0000000000020000 RDI: 000055b89983acd0
59+
> RBP: 00007ffeefa821a0 R08: 0000000000000037 R09: 0000000000000075
60+
> R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000
61+
> R13: 00007ffeefa82410 R14: 000055b897ba5dd8 R15: 00007fc4b8340000
62+
> </TASK>
63+
64+
Link: https://lkml.kernel.org/r/[email protected]
65+
Signed-off-by: Byungchul Park <[email protected]>
66+
Reported-by: Hyeongtak Ji <[email protected]>
67+
Fixes: c574bbe917036 ("NUMA balancing: optimize page placement for memory tiering system")
68+
Reviewed-by: Oscar Salvador <[email protected]>
69+
Cc: Baolin Wang <[email protected]>
70+
Cc: "Huang, Ying" <[email protected]>
71+
Cc: Johannes Weiner <[email protected]>
72+
73+
Signed-off-by: Andrew Morton <[email protected]>
74+
(cherry picked from commit 2774f256e7c0219e2b0a0894af1c76bdabc4f974)
75+
Signed-off-by: Jonathan Maple <[email protected]>
76+
77+
# Conflicts:
78+
# mm/migrate.c
79+
diff --cc mm/migrate.c
80+
index 591c0ffb249a,c27b1f8097d4..000000000000
81+
--- a/mm/migrate.c
82+
+++ b/mm/migrate.c
83+
@@@ -2149,7 -2519,16 +2149,20 @@@ static int numamigrate_isolate_page(pg_
84+
if (managed_zone(pgdat->node_zones + z))
85+
break;
86+
}
87+
++<<<<<<< HEAD
88+
+ wakeup_kswapd(pgdat->node_zones + z, 0, order, ZONE_MOVABLE);
89+
++=======
90+
+
91+
+ /*
92+
+ * If there are no managed zones, it should not proceed
93+
+ * further.
94+
+ */
95+
+ if (z < 0)
96+
+ return 0;
97+
+
98+
+ wakeup_kswapd(pgdat->node_zones + z, 0,
99+
+ folio_order(folio), ZONE_MOVABLE);
100+
++>>>>>>> 2774f256e7c0 (mm/vmscan: fix a bug calling wakeup_kswapd() with a wrong zone index)
101+
return 0;
102+
}
103+
104+
* Unmerged path mm/migrate.c

0 commit comments

Comments
 (0)