From patchwork Fri Feb 5 17:34:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12070593 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 B2CEEC433DB for ; Fri, 5 Feb 2021 17:37:34 +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 3FA7E64DC4 for ; Fri, 5 Feb 2021 17:37:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FA7E64DC4 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=xiKkvqQSaakHSkBhnlu9jrZi4 iLOuL3SlRLv7YIo+ceYOv7HviywUNFTQOiPjfqdSNhg3v/h7RZlv93gyXnRTj5QvX44USgKyGylO7 cH6prmzlLkcF5KdVoB0YEXU+lfvZ1sct4kkw8n4O5asNbfD7W4ITuJWYHO6yUYOYsNRL93ZKjxgGh 16nQ39VQtcs92giYO48KI4Fn22o3bIH5B+G+1UAVkg2Hh5jZqgSdqNTDsX46USuMGvJfa/E5amcdH WZ5hh/9vljoZmVCoVMijPhwHeFCveP596ex8qXa6DsUOtr0rr2ayw3SYQ6JaFfYwOZOi8dVH3Kq1o IFEfBjo3w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l851g-0005L9-Am; Fri, 05 Feb 2021 17:36:12 +0000 Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l850r-0004z6-MX for linux-arm-kernel@lists.infradead.org; Fri, 05 Feb 2021 17:35:30 +0000 Received: by mail-wr1-x449.google.com with SMTP id o17so5757272wrv.4 for ; Fri, 05 Feb 2021 09:35:18 -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=rhZcOisXxajZRSH31J6t5x8y7U35XbWt39APfdQTAyFPG0HF5mjWJSCOgw16eIMOMa FxjsONeMdcvEksZXk6bC9GsFOfyYtiJJVVxykiWoVQthkFCZ+7JIWakX1YKqLh2Hfnsw UHhGojbmi5DGaKkXKVb9OuWCEYr4RB6K9hJP+CP2j/YOxjaS7vNIFnSlhUYQR2/KU0oU ooZpFMWOGqErYIXA8pyt+sZSi7z6vjp1Cx9mo0rM+ADEMLxumJNs73rI/ZV+psV71+ij 0yCJp9ep/i82xgHJH7EhvCF5jIIaWuoWZ9xoBRvQpbg8jUeOxTCIZpjL2b4jXvijo6zj rsPQ== 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=qdIlOQ+mkvIdHkDmqLF4i3EhfLej9dLGfStK9YZSKngWESQYIybVEhhhSLvuT9wVqn TQSC3d3xoMsieAZoV12Kp1wP9OlX70fa6ru3yRJuLJDV+ngeZZaQwzPwXrJGuU6OVTAY +nwVnMOr3osxdewV4RCZ4qB3ZD4J/uC29u4Qgf62wuU/4pnOUzDCmqef96xUoCK0ZgWe c7oHIYtCE2yIn1EWH2i258lIrS+pGgA976LEAsw9tQNDdz9vRpE6legjdx2hrrNh2QTP o1YdcbvtAOGSRhEDxqjcqR0wMbaebRDcAQpgxJjhzwBhI60a+LPK9HrRiCFi0AUt0Hou KQAA== X-Gm-Message-State: AOAM530PoSsXnF6XqPi0mxXAxrz+WpA3DGnFOM/GwkB1HMcjne3VIhWP Msq67QL219ADor/SvyJcVG10xeaV89XiLKPB X-Google-Smtp-Source: ABdhPJwTAziAbVGPOhm/GCfHuY7Nxua8uArDaBNKr1jq6WV9vgAgwxgQ1kegmyvTxo5ASrnPr8xSaEmusHPD5Qp2 X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:edb8:b79c:2e20:e531]) (user=andreyknvl job=sendgmr) by 2002:adf:f149:: with SMTP id y9mr6216013wro.144.1612546517387; Fri, 05 Feb 2021 09:35:17 -0800 (PST) Date: Fri, 5 Feb 2021 18:34:45 +0100 In-Reply-To: Message-Id: <2c94a2af0657f2b95b9337232339ff5ffa643ab5.1612546384.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog Subject: [PATCH v3 mm 11/13] 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_123522_050139_8C10CE5E 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 Reviewed-by: Marco Elver --- 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;