mm/slab: remove HAVE_HARDENED_USERCOPY_ALLOCATOR
authorVlastimil Babka <vbabka@suse.cz>
Tue, 23 May 2023 07:26:35 +0000 (09:26 +0200)
committerVlastimil Babka <vbabka@suse.cz>
Wed, 24 May 2023 13:38:17 +0000 (15:38 +0200)
With SLOB removed, both remaining allocators support hardened usercopy,
so remove the config and associated #ifdef.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
mm/Kconfig
mm/slab.h
security/Kconfig

index 7672a22647b4a2434c22bda7b92b3897efc84783..041f0da42f2b2ed3a1bb8657a6236f8a926c43ed 100644 (file)
@@ -221,7 +221,6 @@ choice
 config SLAB
        bool "SLAB"
        depends on !PREEMPT_RT
-       select HAVE_HARDENED_USERCOPY_ALLOCATOR
        help
          The regular slab allocator that is established and known to work
          well in all environments. It organizes cache hot objects in
@@ -229,7 +228,6 @@ config SLAB
 
 config SLUB
        bool "SLUB (Unqueued Allocator)"
-       select HAVE_HARDENED_USERCOPY_ALLOCATOR
        help
           SLUB is a slab allocator that minimizes cache line usage
           instead of managing queues of cached objects (SLAB approach).
index f01ac256a8f5565e173a31d74d8a19d54a26212e..ae41c0c50ba6c13f63c5448c656feaa70e6a9255 100644 (file)
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -832,16 +832,8 @@ struct kmem_obj_info {
 void __kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab);
 #endif
 
-#ifdef CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR
 void __check_heap_object(const void *ptr, unsigned long n,
                         const struct slab *slab, bool to_user);
-#else
-static inline
-void __check_heap_object(const void *ptr, unsigned long n,
-                        const struct slab *slab, bool to_user)
-{
-}
-#endif
 
 #ifdef CONFIG_SLUB_DEBUG
 void skip_orig_size_check(struct kmem_cache *s, const void *object);
index 97abeb9b9a194b2710d4636c7977a0eba7d6a518..52c9af08ad35d3d31995337d4643b26c015f75ca 100644 (file)
@@ -127,16 +127,8 @@ config LSM_MMAP_MIN_ADDR
          this low address space will need the permission specific to the
          systems running LSM.
 
-config HAVE_HARDENED_USERCOPY_ALLOCATOR
-       bool
-       help
-         The heap allocator implements __check_heap_object() for
-         validating memory ranges against heap object sizes in
-         support of CONFIG_HARDENED_USERCOPY.
-
 config HARDENED_USERCOPY
        bool "Harden memory copies between kernel and userspace"
-       depends on HAVE_HARDENED_USERCOPY_ALLOCATOR
        imply STRICT_DEVMEM
        help
          This option checks for obviously wrong memory regions when