Skip to contentSkip to conversation

lib-alloc_tag-do-not-register-sysctl-interface-when-config_sysctl=n.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Jun 15, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: lib/alloc_tag: do not register sysctl interface when CONFIG_SYSCTL=n
has been removed from the -mm tree. Its filename was
lib-alloc_tag-do-not-register-sysctl-interface-when-config_sysctl=n.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Suren Baghdasaryan <[email protected]>
Subject: lib/alloc_tag: do not register sysctl interface when CONFIG_SYSCTL=n
Date: Sat, 1 Jun 2024 16:38:31 -0700

Memory allocation profiling is trying to register sysctl interface even when CONFIG_SYSCTL=n, resulting in proc_do_static_key() being undefined. Prevent that by skipping sysctl registration for such configurations.

Fixes 22d407b164ff ("lib: add allocation tagging support for memory allocation profiling")
Cc Kent Overstreet <[email protected]>
Cc Kees Cook <[email protected]>
Cc Pasha Tatashin <[email protected]>
Cc Suren Baghdasaryan <[email protected]>

---

 lib/alloc_tag.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
lib/alloc_tag.c renamed from lib/alloc_tag.c~lib-alloc_tag-do-not-register-sysctl-interface-when-config_sysctl=n +13 -3
@@ -227,6 +227,7 @@ struct page_ext_operations page_alloc_ta
 };
 EXPORT_SYMBOL(page_alloc_tagging_ops);
 
+#ifdef CONFIG_SYSCTL
 static struct ctl_table memory_allocation_profiling_sysctls[] = {
 	{
 		.procname	= "mem_profiling",
@@ -241,6 +242,17 @@ static struct ctl_table memory_allocatio
 	{ }
 };
 
+static void __init sysctl_init(void)
+{
+	if (!mem_profiling_support)
+		memory_allocation_profiling_sysctls[0].mode = 0444;
+
+	register_sysctl_init("vm", memory_allocation_profiling_sysctls);
+}
+#else /* CONFIG_SYSCTL */
+static inline void sysctl_init(void) {}
+#endif /* CONFIG_SYSCTL */
+
 static int __init alloc_tag_init(void)
 {
 	const struct codetag_type_desc desc = {
@@ -253,9 +265,7 @@ static int __init alloc_tag_init(void)
 	if (IS_ERR(alloc_tag_cttype))
 		return PTR_ERR(alloc_tag_cttype);
 
-	if (!mem_profiling_support)
-		memory_allocation_profiling_sysctls[0].mode = 0444;
-	register_sysctl_init("vm", memory_allocation_profiling_sysctls);
+	sysctl_init();
 	procfs_init();
 
 	return 0;

_

Patches currently in -mm which might be from [email protected] are

mm-slab-fix-variable-obj_exts-set-but-not-used-warning.patch mm-handle-profiling-for-fake-memory-allocations-during-compaction.patch