linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Konovalov <andreyknvl@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arm-kernel@lists.infradead.org,
	Marco Elver <elver@google.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Kevin Brodsky <kevin.brodsky@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Branislav Rankov <Branislav.Rankov@arm.com>,
	kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, Alexander Potapenko <glider@google.com>,
	Evgenii Stepanov <eugenis@google.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Dmitry Vyukov <dvyukov@google.com>
Subject: [PATCH mm v3 09/19] kasan: open-code kasan_unpoison_slab
Date: Fri, 13 Nov 2020 23:19:59 +0100	[thread overview]
Message-ID: <4d64025c647190a8b7101d0b1da3deb922535a0d.1605305978.git.andreyknvl@google.com> (raw)
In-Reply-To: <cover.1605305978.git.andreyknvl@google.com>

There's the external annotation kasan_unpoison_slab() that is currently
defined as static inline and uses kasan_unpoison_range(). Open-code this
function in mempool.c. Otherwise with an upcoming change this function
will result in an unnecessary function call.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Link: https://linux-review.googlesource.com/id/Ia7c8b659f79209935cbaab3913bf7f082cc43a0e
---
 include/linux/kasan.h | 6 ------
 mm/mempool.c          | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 1594177f86bb..872bf145ddde 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -106,11 +106,6 @@ struct kasan_cache {
 	int free_meta_offset;
 };
 
-size_t __ksize(const void *);
-static inline void kasan_unpoison_slab(const void *ptr)
-{
-	kasan_unpoison_range(ptr, __ksize(ptr));
-}
 size_t kasan_metadata_size(struct kmem_cache *cache);
 
 bool kasan_save_enable_multi_shot(void);
@@ -166,7 +161,6 @@ static inline bool kasan_slab_free(struct kmem_cache *s, void *object,
 	return false;
 }
 
-static inline void kasan_unpoison_slab(const void *ptr) { }
 static inline size_t kasan_metadata_size(struct kmem_cache *cache) { return 0; }
 
 #endif /* CONFIG_KASAN */
diff --git a/mm/mempool.c b/mm/mempool.c
index f473cdddaff0..583a9865b181 100644
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -112,7 +112,7 @@ static __always_inline void kasan_poison_element(mempool_t *pool, void *element)
 static void kasan_unpoison_element(mempool_t *pool, void *element)
 {
 	if (pool->alloc == mempool_alloc_slab || pool->alloc == mempool_kmalloc)
-		kasan_unpoison_slab(element);
+		kasan_unpoison_range(element, __ksize(element));
 	else if (pool->alloc == mempool_alloc_pages)
 		kasan_alloc_pages(element, (unsigned long)pool->pool_data);
 }
-- 
2.29.2.299.gdc1121823c-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-11-13 22:41 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 22:19 [PATCH mm v3 00/19] kasan: boot parameters for hardware tag-based mode Andrey Konovalov
2020-11-13 22:19 ` [PATCH mm v3 01/19] kasan: simplify quarantine_put call site Andrey Konovalov
2020-11-13 22:19 ` [PATCH mm v3 02/19] kasan: rename get_alloc/free_info Andrey Konovalov
2020-11-13 22:19 ` [PATCH mm v3 03/19] kasan: introduce set_alloc_info Andrey Konovalov
2020-11-13 22:19 ` [PATCH mm v3 04/19] kasan, arm64: unpoison stack only with CONFIG_KASAN_STACK Andrey Konovalov
2020-11-16 11:00   ` Dmitry Vyukov
2020-11-13 22:19 ` [PATCH mm v3 05/19] kasan: allow VMAP_STACK for HW_TAGS mode Andrey Konovalov
2020-11-16 11:01   ` Dmitry Vyukov
2020-11-13 22:19 ` [PATCH mm v3 06/19] kasan: remove __kasan_unpoison_stack Andrey Konovalov
2020-11-13 22:19 ` [PATCH mm v3 07/19] kasan: inline kasan_reset_tag for tag-based modes Andrey Konovalov
2020-11-17 10:56   ` Dmitry Vyukov
2020-11-13 22:19 ` [PATCH mm v3 08/19] kasan: inline random_tag for HW_TAGS Andrey Konovalov
2020-11-17 10:58   ` Dmitry Vyukov
2020-11-13 22:19 ` Andrey Konovalov [this message]
2020-11-16 15:06   ` [PATCH mm v3 09/19] kasan: open-code kasan_unpoison_slab Marco Elver
2020-11-13 22:20 ` [PATCH mm v3 10/19] kasan: inline (un)poison_range and check_invalid_free Andrey Konovalov
2020-11-16 15:11   ` Marco Elver
2020-11-13 22:20 ` [PATCH mm v3 11/19] kasan: add and integrate kasan boot parameters Andrey Konovalov
2020-11-16 15:15   ` Marco Elver
2020-11-17 11:09     ` Dmitry Vyukov
2020-11-13 22:20 ` [PATCH mm v3 12/19] kasan, mm: check kasan_enabled in annotations Andrey Konovalov
2020-11-16 15:26   ` Marco Elver
2020-11-17 11:12     ` Dmitry Vyukov
2020-11-13 22:20 ` [PATCH mm v3 13/19] kasan, mm: rename kasan_poison_kfree Andrey Konovalov
2020-11-16 15:43   ` Marco Elver
2020-11-13 22:20 ` [PATCH mm v3 14/19] kasan: don't round_up too much Andrey Konovalov
2020-11-13 22:20 ` [PATCH mm v3 15/19] kasan: simplify assign_tag and set_tag calls Andrey Konovalov
2020-11-13 22:20 ` [PATCH mm v3 16/19] kasan: clarify comment in __kasan_kfree_large Andrey Konovalov
2020-11-13 22:20 ` [PATCH mm v3 17/19] kasan: clean up metadata allocation and usage Andrey Konovalov
2020-11-16 15:46   ` Marco Elver
2020-11-17 13:12   ` Dmitry Vyukov
2020-11-17 13:18     ` Marco Elver
2020-11-17 13:27       ` Dmitry Vyukov
2020-11-23 18:54     ` Andrey Konovalov
2020-11-23 19:16       ` Andrey Konovalov
2020-11-13 22:20 ` [PATCH mm v3 18/19] kasan, mm: allow cache merging with no metadata Andrey Konovalov
2020-11-16 15:45   ` Marco Elver
2020-11-17 13:25   ` Dmitry Vyukov
2020-11-23 13:52     ` Andrey Konovalov
2020-11-13 22:20 ` [PATCH mm v3 19/19] kasan: update documentation Andrey Konovalov
2020-11-16 15:47   ` Marco Elver
2020-11-17 13:28     ` Dmitry Vyukov
2020-11-16 14:48 ` [PATCH mm v3 00/19] kasan: boot parameters for hardware tag-based mode Vincenzo Frascino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d64025c647190a8b7101d0b1da3deb922535a0d.1605305978.git.andreyknvl@google.com \
    --to=andreyknvl@google.com \
    --cc=Branislav.Rankov@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=catalin.marinas@arm.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=eugenis@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kevin.brodsky@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vincenzo.frascino@arm.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).