Hyeonggon Yoo
a122529082
mm/kfence: reset PG_slab and memcg_data before freeing __kfence_pool
...
commit 2839b0999c20c9f6bf353849c69370e121e2fa1a upstream.
When kfence fails to initialize kfence pool, it frees the pool. But it
does not reset memcg_data and PG_slab flag.
Below is a BUG because of this. Let's fix it by resetting memcg_data
and PG_slab flag before free.
[ 0.089149] BUG: Bad page state in process swapper/0 pfn:3d8e06
[ 0.089149] page:ffffea46cf638180 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3d8e06
[ 0.089150] memcg:ffffffff94a475d1
[ 0.089150] flags: 0x17ffffc0000200(slab|node=0|zone=2|lastcpupid=0x1fffff)
[ 0.089151] raw: 0017ffffc0000200 ffffea46cf638188 ffffea46cf638188 0000000000000000
[ 0.089152] raw: 0000000000000000 0000000000000000 00000000ffffffff ffffffff94a475d1
[ 0.089152] page dumped because: page still charged to cgroup
[ 0.089153] Modules linked in:
[ 0.089153] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G B W 5.18.0-rc1+ #965
[ 0.089154] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
[ 0.089154] Call Trace:
[ 0.089155] <TASK>
[ 0.089155] dump_stack_lvl+0x49/0x5f
[ 0.089157] dump_stack+0x10/0x12
[ 0.089158] bad_page.cold+0x63/0x94
[ 0.089159] check_free_page_bad+0x66/0x70
[ 0.089160] __free_pages_ok+0x423/0x530
[ 0.089161] __free_pages_core+0x8e/0xa0
[ 0.089162] memblock_free_pages+0x10/0x12
[ 0.089164] memblock_free_late+0x8f/0xb9
[ 0.089165] kfence_init+0x68/0x92
[ 0.089166] start_kernel+0x789/0x992
[ 0.089167] x86_64_start_reservations+0x24/0x26
[ 0.089168] x86_64_start_kernel+0xa9/0xaf
[ 0.089170] secondary_startup_64_no_verify+0xd5/0xdb
[ 0.089171] </TASK>
Link: https://lkml.kernel.org/r/YnPG3pQrqfcgOlVa@hyeyoo
Fixes: 0ce20dd84089 ("mm: add Kernel Electric-Fence infrastructure")
Fixes: 8f0b36497303 ("mm: kfence: fix objcgs vector allocation")
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Reviewed-by: Marco Elver <elver@google.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
[42.hyeyoo@gmail.com: backport - use struct page]
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-25 09:57:23 +02:00
..
2022-01-05 12:42:39 +01:00
2022-05-09 09:14:41 +02:00
2022-05-25 09:57:23 +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