kernel/0001-mm-kmemleak-skip-late_init-if-not-skip-disable.patch
Justin M. Forbes fa13b59d63 kernel-5.9.0-0.rc1.1
* Mon Aug 17 2020 Fedora Kernel Team <kernel-team@fedoraproject.org> [5.9.0-0.rc1.1]
- v5.9-rc1 rebase
- Config updates for Fedora ("Justin M. Forbes")
- fedora: enable enery model (Peter Robinson)
- iio: enable LTR-559 light and proximity sensor (Peter Robinson)
- iio: chemical: enable some popular chemical and partical sensors (Peter Robinson)
- More mismatches ("Justin M. Forbes")
- Fedora config change due to deps ("Justin M. Forbes")
- CONFIG_SND_SOC_MAX98390 is now selected by SND_SOC_INTEL_DA7219_MAX98357A_GENERIC ("Justin M. Forbes")
- Config change required for build part 2 ("Justin M. Forbes")
- Config change required for build ("Justin M. Forbes")
- Enable ARM_SMCCC_SOC_ID on all aarch64 kernels (Peter Robinson)
- Enable ZSTD compression algorithm on all kernels (Peter Robinson)
- Fedora config update ("Justin M. Forbes")
- Revert "Merge branch 'make_configs_fix' into 'os-build'" (Justin Forbes)
- Use the configs/generic config for SND_HDA_INTEL everywhere (Peter Robinson)
- redhat/configs/process_configs.sh: Remove *.config.orig files (Prarit Bhargava)
- redhat/configs/process_configs.sh: Add process_configs_known_broken flag (Prarit Bhargava)
- redhat/Makefile: Fix '*-configs' targets (Prarit Bhargava)
- Updated changelog for the release based on v5.8 (Fedora Kernel Team)
- Add ability to sync upstream through Makefile (Don Zickus)
- Add master merge check (Don Zickus)
- Replace hardcoded values 'os-build' and project id with variables (Don Zickus)
- gitattributes: Remove unnecesary export restrictions (Prarit Bhargava)
- redhat/Makefile.common: Fix MARKER (Prarit Bhargava)
Resolves: rhbz#

Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
2020-08-17 11:18:16 -05:00

72 lines
2.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Murphy Zhou <jencce.kernel@gmail.com>
Date: Sun, 29 Sep 2019 17:56:59 +0800
Subject: [PATCH] mm/kmemleak: skip late_init if not skip disable
Now if DEFAULT_OFF set to y, kmemleak_init will start the cleanup_work
workqueue. Then late_init call will set kmemleak_initialized to 1, the
cleaup workqueue will try to do cleanup, triggering:
[24.738773] ==================================================================
[24.742784] BUG: KASAN: global-out-of-bounds in __kmemleak_do_cleanup+0x166/0x180
[24.744144] Key type ._fscrypt registered
[24.745680] Read of size 8 at addr ffffffff88746c90 by task kworker/3:1/171
[24.745687]
[24.745697] CPU: 3 PID: 171 Comm: kworker/3:1 Not tainted 5.3.0-v5.3-12475-gcbafe18 #1
[24.745701] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
[24.745710] Workqueue: events kmemleak_do_cleanup
[24.745717] Call Trace:
[24.745736] dump_stack+0x7c/0xc0
[24.745755] print_address_description.constprop.4+0x1f/0x300
[24.751562] Key type .fscrypt registered
[24.754370] __kasan_report.cold.8+0x76/0xb2
[24.754388] ? __kmemleak_do_cleanup+0x166/0x180
[24.754407] kasan_report+0xe/0x20
[24.778543] __kmemleak_do_cleanup+0x166/0x180
[24.780795] process_one_work+0x919/0x17d0
[24.782929] ? pwq_dec_nr_in_flight+0x320/0x320
[24.785092] worker_thread+0x87/0xb40
[24.786948] ? __kthread_parkme+0xc3/0x190
[24.789217] ? process_one_work+0x17d0/0x17d0
[24.791414] kthread+0x333/0x3f0
[24.793031] ? kthread_create_worker_on_cpu+0xc0/0xc0
[24.795473] ret_from_fork+0x3a/0x50
[24.797303]
[24.798091] The buggy address belongs to the variable:
[24.800634] mem_pool_free_count+0x10/0x40
[24.802656]
[24.803434] Memory state around the buggy address:
[24.805793] ffffffff88746b80: 04 fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
[24.809177] ffffffff88746c00: 00 fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa
[24.812407] >ffffffff88746c80: 04 fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa
[24.815638] ^
[24.817372] ffffffff88746d00: 00 00 fa fa fa fa fa fa 00 00 00 00 00 00 00 00
[24.820740] ffffffff88746d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[24.824021] ==================================================================
Fixes: c5665868183f ("mm: kmemleak: use the memory pool for early allocations")
Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
---
mm/kmemleak.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 5e252d91eb14..c6e1a9443e9e 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1960,6 +1960,11 @@ void __init kmemleak_init(void)
*/
static int __init kmemleak_late_init(void)
{
+ if (!kmemleak_skip_disable) {
+ kmemleak_disable();
+ return 0;
+ }
+
kmemleak_initialized = 1;
debugfs_create_file("kmemleak", 0644, NULL, NULL, &kmemleak_fops);
--
2.26.2