Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3933407imw; Mon, 18 Jul 2022 17:48:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sdciUTpk4oovMyDsQvDUFaLDZOVNkUMqH75uDJWBDvJE+5kIM0K3ab9blp+bwYKVuQbIpI X-Received: by 2002:aa7:c2d3:0:b0:43a:707a:72c5 with SMTP id m19-20020aa7c2d3000000b0043a707a72c5mr40964465edp.54.1658191727749; Mon, 18 Jul 2022 17:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658191727; cv=none; d=google.com; s=arc-20160816; b=FuIW68DpNhREi9tnwLWIW+6vijAA+bwn/suxf2UjY+5PbVgTAf4lTA1NKJ4JPHXDiY tfS+lUVWtWPz2hplnHa6Cy/Awu5RaBVKRQ670Vrk4vnmI0mjRhxOCUa7O2LZQ2RKfwec v/t/W+gNtPIlkRK+wibG9MHgGiBUP6sksbwAtVnEk+148L9I1cJDI9+bSF+Pa1hG50CU czqlPuWfZniDzQswP26rqTnnCOTD1pJQxixuSdE4P8ruFRSf87MCs3WN3AaLyCLMIjkS qM1LK9FMW7g35MFZZqHEMQ0/JR1sl5QnshzIuYO+97wZMaq9kIgY3+Gr1X0VkAMF1bIr TrLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6+gehTqFh9JAtZFAnb2OrzE2PLFsl5pe0e/6PyzNuaE=; b=zC3r77ZgVmlPAHOm3Ktm2/5NCabYNbFbRyqM93lQs7v4fFsNpNc6uiJqUBSzGaF4hr BxMyl4DREyVgvPfHXz5fA6B1PwjSnDbW++t3cLd5OJb9hOAuZqY7iso8BxwDrEZYMsnG pzl4QjNC7Ozb4eBK+hXCxrqEx4ibWdKiIKVlQIfmWQcAEDoIgXdPGNHpdEcGr3vrEUmw 8OF4b5oITWcqPa2rErLssEhanNazJm0kSN21jY4OO6R7HHSS/EHMMlnd8nbErxDK+LaE AmoTpxQtXCQTkLVTjWt7DQt3Q3r8gVrb2h70M34Z7njJ6NNMUcPrpxESH72kd6mbH8Dx /I7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=l78plOGG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a056402440400b0043b52adbf6esi11216288eda.557.2022.07.18.17.48.23; Mon, 18 Jul 2022 17:48:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=l78plOGG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236612AbiGSANk (ORCPT + 99 others); Mon, 18 Jul 2022 20:13:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236598AbiGSANh (ORCPT ); Mon, 18 Jul 2022 20:13:37 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B2F933E3E for ; Mon, 18 Jul 2022 17:13:36 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1658189615; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6+gehTqFh9JAtZFAnb2OrzE2PLFsl5pe0e/6PyzNuaE=; b=l78plOGGvEzmW1nLutXBidFKXT5EgQxtyQeanLl9qQqV8nwCAWQUsTzPMERsq/SmVrUKgL uQJi7IeyRDBgevAT3fqQ1aJ3wwKQNrS7DZTnFxXmRQQZEsMNQ1zpawzdntePJiIlJyulxo /iYHiZhprvmiUnF03O7hu7gtEm8YUt4= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Peter Collingbourne , Evgenii Stepanov , Florian Mayer , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm v2 19/33] kasan: pass tagged pointers to kasan_save_alloc/free_info Date: Tue, 19 Jul 2022 02:09:59 +0200 Message-Id: <46aa2a55f0bcf04a2617222936d15119581f6dd7.1658189199.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Konovalov Pass tagged pointers to kasan_save_alloc/free_info(). This is a preparatory patch to simplify other changes in the series. Signed-off-by: Andrey Konovalov --- Changes v1->v2: - Drop unused variable tag from ____kasan_slab_free(). --- mm/kasan/common.c | 6 ++---- mm/kasan/generic.c | 3 +-- mm/kasan/kasan.h | 2 +- mm/kasan/tags.c | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 89aa97af876e..3dc57a199893 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -192,13 +192,11 @@ void * __must_check __kasan_init_slab_obj(struct kmem_cache *cache, static inline bool ____kasan_slab_free(struct kmem_cache *cache, void *object, unsigned long ip, bool quarantine, bool init) { - u8 tag; void *tagged_object; if (!kasan_arch_is_ready()) return false; - tag = get_tag(object); tagged_object = object; object = kasan_reset_tag(object); @@ -227,7 +225,7 @@ static inline bool ____kasan_slab_free(struct kmem_cache *cache, void *object, return false; if (kasan_stack_collection_enabled()) - kasan_save_free_info(cache, object, tag); + kasan_save_free_info(cache, tagged_object); return kasan_quarantine_put(cache, object); } @@ -316,7 +314,7 @@ void * __must_check __kasan_slab_alloc(struct kmem_cache *cache, /* Save alloc info (if possible) for non-kmalloc() allocations. */ if (kasan_stack_collection_enabled() && !cache->kasan_info.is_kmalloc) - kasan_save_alloc_info(cache, (void *)object, flags); + kasan_save_alloc_info(cache, tagged_object, flags); return tagged_object; } diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c index f6bef347de87..aff39af3c532 100644 --- a/mm/kasan/generic.c +++ b/mm/kasan/generic.c @@ -500,8 +500,7 @@ void kasan_save_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags) kasan_set_track(&alloc_meta->alloc_track, flags); } -void kasan_save_free_info(struct kmem_cache *cache, - void *object, u8 tag) +void kasan_save_free_info(struct kmem_cache *cache, void *object) { struct kasan_free_meta *free_meta; diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index cae60e4d8842..cca49ab029f1 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -309,7 +309,7 @@ static inline void kasan_init_object_meta(struct kmem_cache *cache, const void * depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc); void kasan_set_track(struct kasan_track *track, gfp_t flags); void kasan_save_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags); -void kasan_save_free_info(struct kmem_cache *cache, void *object, u8 tag); +void kasan_save_free_info(struct kmem_cache *cache, void *object); struct kasan_track *kasan_get_alloc_track(struct kmem_cache *cache, void *object); struct kasan_track *kasan_get_free_track(struct kmem_cache *cache, diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c index 4f24669085e9..fd11d10a4ffc 100644 --- a/mm/kasan/tags.c +++ b/mm/kasan/tags.c @@ -21,8 +21,7 @@ void kasan_save_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags) { } -void kasan_save_free_info(struct kmem_cache *cache, - void *object, u8 tag) +void kasan_save_free_info(struct kmem_cache *cache, void *object) { } -- 2.25.1