Naoya Horiguchi
cc57b2e4a7
mm/hwpoison: use pr_err() instead of dump_page() in get_any_page()
...
commit 1825b93b626e99eb9a0f9f50342c7b2fa201b387 upstream.
The following VM_BUG_ON_FOLIO() is triggered when memory error event
happens on the (thp/folio) pages which are about to be freed:
[ 1160.232771] page:00000000b36a8a0f refcount:1 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x16a000
[ 1160.236916] page:00000000b36a8a0f refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x16a000
[ 1160.240684] flags: 0x57ffffc0800000(hwpoison|node=1|zone=2|lastcpupid=0x1fffff)
[ 1160.243458] raw: 0057ffffc0800000 dead000000000100 dead000000000122 0000000000000000
[ 1160.246268] raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
[ 1160.249197] page dumped because: VM_BUG_ON_FOLIO(!folio_test_large(folio))
[ 1160.251815] ------------[ cut here ]------------
[ 1160.253438] kernel BUG at include/linux/mm.h:788!
[ 1160.256162] invalid opcode: 0000 [#1 ] PREEMPT SMP PTI
[ 1160.258172] CPU: 2 PID: 115368 Comm: mceinj.sh Tainted: G E 5.18.0-rc1-v5.18-rc1-220404-2353-005-g83111+ #3
[ 1160.262049] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1.fc35 04/01/2014
[ 1160.265103] RIP: 0010:dump_page.cold+0x27e/0x2bd
[ 1160.266757] Code: fe ff ff 48 c7 c6 81 f1 5a 98 e9 4c fe ff ff 48 c7 c6 a1 95 59 98 e9 40 fe ff ff 48 c7 c6 50 bf 5a 98 48 89 ef e8 9d 04 6d ff <0f> 0b 41 f7 c4 ff 0f 00 00 0f 85 9f fd ff ff 49 8b 04 24 a9 00 00
[ 1160.273180] RSP: 0018:ffffaa2c4d59fd18 EFLAGS: 00010292
[ 1160.274969] RAX: 000000000000003e RBX: 0000000000000001 RCX: 0000000000000000
[ 1160.277263] RDX: 0000000000000001 RSI: ffffffff985995a1 RDI: 00000000ffffffff
[ 1160.279571] RBP: ffffdc9c45a80000 R08: 0000000000000000 R09: 00000000ffffdfff
[ 1160.281794] R10: ffffaa2c4d59fb08 R11: ffffffff98940d08 R12: ffffdc9c45a80000
[ 1160.283920] R13: ffffffff985b6f94 R14: 0000000000000000 R15: ffffdc9c45a80000
[ 1160.286641] FS: 00007eff54ce1740(0000) GS:ffff99c67bd00000(0000) knlGS:0000000000000000
[ 1160.289498] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1160.291106] CR2: 00005628381a5f68 CR3: 0000000104712003 CR4: 0000000000170ee0
[ 1160.293031] Call Trace:
[ 1160.293724] <TASK>
[ 1160.294334] get_hwpoison_page+0x47d/0x570
[ 1160.295474] memory_failure+0x106/0xaa0
[ 1160.296474] ? security_capable+0x36/0x50
[ 1160.297524] hard_offline_page_store+0x43/0x80
[ 1160.298684] kernfs_fop_write_iter+0x11c/0x1b0
[ 1160.299829] new_sync_write+0xf9/0x160
[ 1160.300810] vfs_write+0x209/0x290
[ 1160.301835] ksys_write+0x4f/0xc0
[ 1160.302718] do_syscall_64+0x3b/0x90
[ 1160.303664] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 1160.304981] RIP: 0033:0x7eff54b018b7
As shown in the RIP address, this VM_BUG_ON in folio_entire_mapcount() is
called from dump_page("hwpoison: unhandlable page") in get_any_page().
The below explains the mechanism of the race:
CPU 0 CPU 1
memory_failure
get_hwpoison_page
get_any_page
dump_page
compound = PageCompound
free_pages_prepare
page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP
folio_entire_mapcount
VM_BUG_ON_FOLIO(!folio_test_large(folio))
So replace dump_page() with safer one, pr_err().
Link: https://lkml.kernel.org/r/20220427053220.719866-1-naoya.horiguchi@linux.dev
Fixes: 74e8ee4708a8 ("mm: Turn head_compound_mapcount() into folio_entire_mapcount()")
Signed-off-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: William Kucharski <william.kucharski@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-18 10:26:57 +02:00
..
2022-01-05 12:42:39 +01:00
2022-05-09 09:14:41 +02:00
2022-05-01 17:22:28 +02:00
2021-12-14 10:57:11 +01:00
2021-05-07 00:26:35 -07:00
2021-09-03 09:58:14 -07:00
2021-05-05 11:27:21 -07:00
2021-05-05 11:27:24 -07:00
2021-05-05 11:27:24 -07:00
2021-05-05 11:27:24 -07:00
2021-09-08 12:55:35 -07:00
2022-02-08 18:34:05 +01:00
2021-09-24 16:13:35 -07:00
2021-06-29 10:53:52 -07:00
2021-09-08 11:50:24 -07:00
2020-10-13 18:38:29 -07:00
2022-05-01 17:22:28 +02:00
2021-05-05 11:27:27 -07:00
2021-05-05 11:27:26 -07:00
2021-05-05 11:27:26 -07:00
2022-05-15 20:18:53 +02:00
2022-04-13 20:59:21 +02:00
2022-01-27 11:05:43 +01:00
2022-05-18 10:26:55 +02:00
2021-05-05 11:27:22 -07:00
2021-06-30 20:47:26 -07:00
2021-06-30 20:47:25 -07:00
2021-11-25 09:49:07 +01:00
2021-09-03 09:58:15 -07:00
2021-07-08 11:48:21 -07:00
2021-09-03 09:58:16 -07:00
2021-04-30 11:20:38 -07:00
2021-04-30 11:20:39 -07:00
2021-09-08 11:50:24 -07:00
2021-11-25 09:48:43 +01:00
2020-12-15 12:13:46 -08:00
2021-10-28 17:18:55 -07:00
2022-04-20 09:34:18 +02:00
2021-09-13 10:18:28 -07:00
2021-05-05 11:27:23 -07:00
2021-08-20 11:39:25 +01:00
2022-04-08 14:22:56 +02:00
2021-09-08 11:50:24 -07:00
2021-07-01 11:06:02 -07:00
2022-03-02 11:48:10 +01:00
2022-04-27 14:38:57 +02:00
2022-03-08 19:12:48 +01:00
2021-09-08 12:55:35 -07:00
2022-05-18 10:26:57 +02:00
2022-05-15 20:18:52 +02:00
2022-04-13 20:59:22 +02:00
2021-06-04 19:32:21 +01:00
2021-09-08 11:50:23 -07:00
2022-05-15 20:18:52 +02:00
2021-01-24 14:27:16 +01:00
2022-05-15 20:18:53 +02:00
2021-04-30 11:20:42 -07:00
2021-07-23 17:43:28 -07:00
2022-04-27 14:38:57 +02:00
2021-04-16 16:10:36 -07:00
2022-04-27 14:38:58 +02:00
2020-12-15 14:48:04 -08:00
2022-02-23 12:03:03 +01:00
2022-04-13 20:59:22 +02:00
2021-04-30 11:20:37 -07:00
2021-09-04 11:35:47 -07:00
2022-04-27 14:38:58 +02:00
2022-04-27 14:38:50 +02:00
2021-04-30 11:20:38 -07:00
2021-10-18 20:22:02 -10:00
2021-09-08 11:50:24 -07:00
2022-04-20 09:34:18 +02:00
2021-09-08 12:55:35 -07:00
2021-09-08 11:50:22 -07:00
2021-04-30 11:20:36 -07:00
2021-06-29 10:53:47 -07:00
2021-06-29 10:53:47 -07:00
2021-07-01 11:06:03 -07:00
2021-09-03 10:08:28 -07:00
2021-06-29 10:53:49 -07:00
2021-07-01 17:17:24 -07:00
2021-07-04 18:30:17 +00:00
2021-06-05 20:43:15 +00:00
2021-07-04 18:30:17 +00:00
2021-09-08 12:55:35 -07:00
2021-05-07 00:26:35 -07:00
2021-06-16 09:24:42 -07:00
2021-05-05 11:27:27 -07:00
2021-04-16 16:10:37 -07:00
2021-07-13 13:14:27 +02:00
2022-04-13 20:59:14 +02:00
2022-04-20 09:34:18 +02:00
2022-05-15 20:18:53 +02:00
2021-04-16 16:10:36 -07:00
2021-05-22 15:09:07 -10:00
2022-04-27 14:38:51 +02:00
2022-04-27 14:38:51 +02:00
2022-04-27 14:38:51 +02:00
2022-04-27 14:38:51 +02:00
2022-04-27 14:38:51 +02:00
2021-06-30 20:47:26 -07:00
2021-09-03 09:58:15 -07:00
2021-08-28 01:46:17 +02:00
2022-03-23 09:16:41 +01:00
2021-09-24 16:13:35 -07:00
2021-09-03 09:58:12 -07:00
2021-09-03 10:08:28 -07:00
2022-04-08 14:24:14 +02:00
2022-05-15 20:18:53 +02:00
2022-03-08 19:12:44 +01:00
2022-03-08 19:12:38 +01:00
2021-09-03 09:58:17 -07:00
2021-09-08 18:45:53 -07:00
2021-09-08 15:32:34 -07:00
2022-04-27 14:38:57 +02:00
2021-07-01 11:06:03 -07:00
2021-07-01 11:06:03 -07:00
2021-05-07 00:26:35 -07:00
2021-11-18 19:17:10 +01:00
2021-06-30 20:47:31 -07:00