lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu,  7 Nov 2019 12:54:04 +0100
From:   Knut Omang <knut.omang@...cle.com>
To:     linux-mm@...ck.org
Cc:     linux-kernel@...r.kernel.org, Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Knut Omang <knut.omang@...cle.com>
Subject: [PATCH] mm: provide interface for retrieving kmem_cache name

With the restructuring done in commit 9adeaa226988
("mm, slab: move memcg_cache_params structure to mm/slab.h")

it is no longer possible for code external to mm to access
the name of a kmem_cache as struct kmem_cache has effectively become
opaque. Having access to the cache name is helpful to kernel testing
infrastructure.

Expose a new function kmem_cache_name to mitigate that.

Signed-off-by: Knut Omang <knut.omang@...cle.com>
---
 include/linux/slab.h | 1 +
 mm/slab_common.c     | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 4d2a2fa55ed5..3298c9db6e46 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -702,6 +702,7 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
 }
 
 unsigned int kmem_cache_size(struct kmem_cache *s);
+const char *kmem_cache_name(struct kmem_cache *s);
 void __init kmem_cache_init_late(void);
 
 #if defined(CONFIG_SMP) && defined(CONFIG_SLAB)
diff --git a/mm/slab_common.c b/mm/slab_common.c
index f9fb27b4c843..269a99dc8214 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -82,6 +82,15 @@ unsigned int kmem_cache_size(struct kmem_cache *s)
 }
 EXPORT_SYMBOL(kmem_cache_size);
 
+/*
+ * Get the name of a slab object
+ */
+const char *kmem_cache_name(struct kmem_cache *s)
+{
+	return s->name;
+}
+EXPORT_SYMBOL(kmem_cache_name);
+
 #ifdef CONFIG_DEBUG_VM
 static int kmem_cache_sanity_check(const char *name, unsigned int size)
 {
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ