From patchwork Mon Nov 23 20:14:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11926693 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 353BBC388F9 for ; Mon, 23 Nov 2020 20:37:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 85EE420715 for ; Mon, 23 Nov 2020 20:37:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="q2PAKfot"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="sEEd+SR5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85EE420715 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lfIKoMFdfjaQB8qvSmonxrnOkbGbM0rbEYhjZ7IMq/Y=; b=q2PAKfotw8lY5kjdXrutMaxZB dFVkkdveQqrfkUKDfpohqbl3EpbGYXevizC0W+Q6oGeQB7//dnLq9nQYeclKdwy24BCdailcZf7+p Fe1WmJueKQI7ksQESu4lyOK2MOHa8LaOvXN/X8B1XlfCsmBGuHUWFaBBzL4l4LgB5X4XFh+xDUlg9 53u9R9442YGYaPkf20ufeHLhzoiijZenRMX14Er2wnXDdH9Z9L+HJ1fbXo7ZDC6Bd98Xgn3DiQbcC z1rowrsruPmDq0LleoGLylTwpjK7O/esp0Xp56stChrekGTtP1PPsTrNQFSlhLlG4y6ICl27mIIGf X5vj8Fskw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khIYO-0002d0-57; Mon, 23 Nov 2020 20:35:16 +0000 Received: from mail-qt1-x84a.google.com ([2607:f8b0:4864:20::84a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khIFF-0002G3-Bk for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2020 20:15:43 +0000 Received: by mail-qt1-x84a.google.com with SMTP id t22so9792263qtq.2 for ; Mon, 23 Nov 2020 12:15:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=NLiVUxn9nGZzjemtf3cQRZI6tHXp7YKQ8dqUNAbFdqU=; b=sEEd+SR5E0QujIT6LdTNMkP8lvByK/biZ74au0Czx9ejMJ7eteUUr04ivXsXnZo0g+ ATjcA39S/TY8d8NJxKDXQ1milDVgJmFjdelMKmd3E+kadIQWJxzBS/HP4OQn/3jV53EX zbtTSa1kT/UkktYPQ1CYBza1aMMLQSg3uRWLqRuPvi8Iq0z26TFAB3ZXNeF1Mu+LBYeo iAHQizMKbfGB75rv0K24dDQV7pzlIuD8FAttvqmJn27tLVdR7ewFAbw6w0P0VPS6I0vX dyjKhQWaiOUXrKBzq1gX3WWhDNtOnk2CyVHfR21g9XT+kNzCmuYSC4AQuXtmhHH+46yn Gylw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=NLiVUxn9nGZzjemtf3cQRZI6tHXp7YKQ8dqUNAbFdqU=; b=FvCF9P8kfsFVCr2LwQW/mcMWZyPVT6zUbu18YLOGu50JqdZuf8ENHDHHU/QYzJz6HJ 0TTxMgEZrgIFSrdvzizLKRNccloBFVjvroGiSfu5uUuRKbgskFl9rmOm+8hf84UcSN+Z eulha4MqONz6UePmxs2CCAxo+OUbleF/5aekW8T8u/EsYXIW0p65ICf8+JP9yKbq3dJZ XAuntdf12ksV6FjIzn8p40ShhX1Ss6TDuFlCUxrQpv5klkE6GCnSyJXmsc1PCL+a1OXj nG7uXr9J6HpiUvitEcpj5sQCmRqJ+dUZAw0ro9Q2/4/6lx6Sr+RJoSjCK2DRnvbOpsE8 dliQ== X-Gm-Message-State: AOAM5306ilSKTEEXX+G2YIQG7+zLYhuH/SGs1id8C+hvopvB0ah9moEW LE2z89/81Wj9TtfA/X67/GJQub5dd5alpAEW X-Google-Smtp-Source: ABdhPJxOc7uK81qXmguJVdi7tYU8ToxOxicUm1j1rL9VWGPliVVPXjfCwHBWb4jXxW7bR846SidQKgv2RVKPCxk+ X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:ad4:4a8a:: with SMTP id h10mr1086459qvx.55.1606162514671; Mon, 23 Nov 2020 12:15:14 -0800 (PST) Date: Mon, 23 Nov 2020 21:14:39 +0100 In-Reply-To: Message-Id: <131a6694a978a9a8b150187e539eecc8bcbf759b.1606162397.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH mm v4 09/19] kasan: open-code kasan_unpoison_slab From: Andrey Konovalov To: Andrew Morton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201123_151530_145189_FDEDEB52 X-CRM114-Status: GOOD ( 14.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Marco Elver , Catalin Marinas , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , Evgenii Stepanov , Andrey Konovalov , Andrey Ryabinin , Vincenzo Frascino , Dmitry Vyukov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Marco Elver 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); }