+ mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject:  mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix
has been added to the -mm tree.  Its filename is
     mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
Subject:  mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix

- Remove CONFIG_SLAB ifdefs. The code works just fine with both allocators.
- Reset metada offsets if metadata doesn't fit. Otherwise kasan_metadata_size()
will give us the wrong results.

Link: http://lkml.kernel.org/r/1468601423-28676-1-git-send-email-aryabinin@xxxxxxxxxxxxx
Signed-off-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
Acked-by: Alexander Potapenko <glider@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/kasan/kasan.c |   17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff -puN mm/kasan/kasan.c~mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix mm/kasan/kasan.c
--- a/mm/kasan/kasan.c~mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix
+++ a/mm/kasan/kasan.c
@@ -372,9 +372,7 @@ void kasan_cache_create(struct kmem_cach
 			unsigned long *flags)
 {
 	int redzone_adjust;
-#ifdef CONFIG_SLAB
 	int orig_size = *size;
-#endif
 
 	/* Add alloc meta. */
 	cache->kasan_info.alloc_meta_offset = *size;
@@ -392,25 +390,20 @@ void kasan_cache_create(struct kmem_cach
 	if (redzone_adjust > 0)
 		*size += redzone_adjust;
 
-#ifdef CONFIG_SLAB
-	*size = min(KMALLOC_MAX_SIZE,
-		    max(*size,
-			cache->object_size +
-			optimal_redzone(cache->object_size)));
+	*size = min(KMALLOC_MAX_SIZE, max(*size, cache->object_size +
+					optimal_redzone(cache->object_size)));
+
 	/*
 	 * If the metadata doesn't fit, don't enable KASAN at all.
 	 */
 	if (*size <= cache->kasan_info.alloc_meta_offset ||
 			*size <= cache->kasan_info.free_meta_offset) {
+		cache->kasan_info.alloc_meta_offset = 0;
+		cache->kasan_info.free_meta_offset = 0;
 		*size = orig_size;
 		return;
 	}
-#else
-	*size = max(*size,
-			cache->object_size +
-			optimal_redzone(cache->object_size));
 
-#endif
 	*flags |= SLAB_KASAN;
 }
 
_

Patches currently in -mm which might be from aryabinin@xxxxxxxxxxxxx are

radix-tree-fix-radix_tree_iter_retry-for-tagged-iterators.patch
mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]
  Powered by Linux