From patchwork Fri Feb 5 15:39:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12070395 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=-17.1 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=unavailable 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 9196BC433E0 for ; Fri, 5 Feb 2021 15:42:04 +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 342D1650EC for ; Fri, 5 Feb 2021 15:42:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 342D1650EC 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=12T+l7VgFyOXn4nh8YwxsMN6nWgZ9hn1KmBNeBrNQC0=; b=PlwkrGY8L0kSxoM77QJE8ydGl evqWoKgkK80cwCvQz8/0e3BKKxWx3qx5zJWFYgRykhdPcMR0EwjYBDXmXjibBxgnla6i4i65Iak+T 56Hny54i+njRsMiS9sBnpTJcrbrbNVbYT8cu4Z9RuRhxQ7+ot/mNHfMOeTcUlzt1VHQDfk7mV9MjS M9VKP3LBUl9Mj/uoAWtQI+BQR+UYPOyC+qzbFNz1u02DdK3o/GVP1H4Hh31tyZCBHq2QaHLkwni1b 2DX7zsiaj5zelMgFPvKmuCzOohOjdnR/079knB9j5xSV6VTyloqizl7VWWcnwfziciPCx67jEpqxL fwRAnIZFg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l83Ds-0008Kf-Nm; Fri, 05 Feb 2021 15:40:40 +0000 Received: from mail-wr1-x44a.google.com ([2a00:1450:4864:20::44a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l83D2-0007t1-2t for linux-arm-kernel@lists.infradead.org; Fri, 05 Feb 2021 15:39:50 +0000 Received: by mail-wr1-x44a.google.com with SMTP id d7so5582008wri.23 for ; Fri, 05 Feb 2021 07:39:45 -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=r9X5DpdR9qKQzOGqj5YPMHvNzUxwchyNv1XRoONrpMQ=; b=GinXCbIKDRoOgLUpKmgxzl260l9tsG2LG+b4gApdVcTyZiiVgLI843m0SQIZzi7Qae NfAp0Io+LgzQcCk69t45hFOJaqjI9KbQccxbpOgaJcJcsZgClEf6fOOjoLnqeysqDHzq FFGcssvQchbEYQAOQYIjmmCgsqDh8MRge4yFNbKPar14MoUKxkyYfLYU4IcGP5q5DCJ/ uq6GvLUb93p8KgHDIgo2/wB6GGYBaMGnvBP6ZxWTkuxb9g0ZXn0bOOLgzYqsobzl23WX ypCO6WqihQFQ1clhxfXOzKJRjdZ8iu8uQBbv8Tp6n8rPnb3bq8lPznSVsroHSUulMSsU BQGQ== 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=r9X5DpdR9qKQzOGqj5YPMHvNzUxwchyNv1XRoONrpMQ=; b=WovxnG9Wf8dqux6kzFjbLkRhs6e7h8USXuI/XMl43mjlswC35Mpk9Axs0hh1utQ3Tk 05cPaBpFSaDMNPAn1ncTLOR9kJsdpth0pjGFfBc9X+OVmH09bLmhwFeMwQpnhWHa63O0 HDk7qcLy3On050q4Mxum5cgOi381P8adpqVLkFfXh8oLJ5kDKat5WhSS7JwP2kCoNZjp 9mFTSGpStF9iDcc5Nv+JK688p90ednNtJZwTZctfHKfx+aAnZdeAKPDzRSkssHgocI+V ZhV/V0XWHlCA2ahrdKxONhpE6vKe39NNPdtFeyiE9gDT2lXOgec/vLxsL11fCW1ftRYz O7FA== X-Gm-Message-State: AOAM5336VLJQXNn3jzM7ebyu6tv0u4gW0rFTbASAqWLAyzMXgH/JvMts AiOHiaw853ao6XGL5dfX4CMcubLKpN51KRD9 X-Google-Smtp-Source: ABdhPJwGux2zXHlarundz7K3SOkAa4ybczg07jIuC0920I9YRGfTqF2RXx4UClbc5pUiakH6JEZV6yYw43coZmqv X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:edb8:b79c:2e20:e531]) (user=andreyknvl job=sendgmr) by 2002:a1c:730a:: with SMTP id d10mr4025957wmb.53.1612539584906; Fri, 05 Feb 2021 07:39:44 -0800 (PST) Date: Fri, 5 Feb 2021 16:39:12 +0100 In-Reply-To: Message-Id: <182acaae3ed39231e6c3132c6bc7fc6b08ef003f.1612538932.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog Subject: [PATCH v2 11/12] kasan: inline HW_TAGS helper functions From: Andrey Konovalov To: Andrew Morton , Catalin Marinas , Vincenzo Frascino , Dmitry Vyukov , Alexander Potapenko , Marco Elver X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210205_103948_167624_F005F58E X-CRM114-Status: GOOD ( 11.12 ) 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: Branislav Rankov , Andrey Konovalov , Kevin Brodsky , Will Deacon , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Andrey Ryabinin , Peter Collingbourne , Evgenii Stepanov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Mark all static functions in common.c and kasan.h that are used for hardware tag-based KASAN as inline to avoid unnecessary function calls. Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 7ffb1e6de2ef..7b53291dafa1 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -279,7 +279,8 @@ void __kasan_poison_object_data(struct kmem_cache *cache, void *object) * based on objects indexes, so that objects that are next to each other * get different tags. */ -static u8 assign_tag(struct kmem_cache *cache, const void *object, bool init) +static inline u8 assign_tag(struct kmem_cache *cache, + const void *object, bool init) { if (IS_ENABLED(CONFIG_KASAN_GENERIC)) return 0xff; @@ -321,8 +322,8 @@ void * __must_check __kasan_init_slab_obj(struct kmem_cache *cache, return (void *)object; } -static bool ____kasan_slab_free(struct kmem_cache *cache, void *object, - unsigned long ip, bool quarantine) +static inline bool ____kasan_slab_free(struct kmem_cache *cache, + void *object, unsigned long ip, bool quarantine) { u8 tag; void *tagged_object; @@ -366,7 +367,7 @@ bool __kasan_slab_free(struct kmem_cache *cache, void *object, unsigned long ip) return ____kasan_slab_free(cache, object, ip, true); } -static bool ____kasan_kfree_large(void *ptr, unsigned long ip) +static inline bool ____kasan_kfree_large(void *ptr, unsigned long ip) { if (ptr != page_address(virt_to_head_page(ptr))) { kasan_report_invalid_free(ptr, ip); @@ -461,8 +462,8 @@ void * __must_check __kasan_slab_alloc(struct kmem_cache *cache, return tagged_object; } -static void *____kasan_kmalloc(struct kmem_cache *cache, const void *object, - size_t size, gfp_t flags) +static inline void *____kasan_kmalloc(struct kmem_cache *cache, + const void *object, size_t size, gfp_t flags) { unsigned long redzone_start; unsigned long redzone_end;