Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5684270rdb; Wed, 13 Dec 2023 16:48:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJ+6W0nCK9Ke0L277ARxHteI35A5oOjW/b6fulcIteIpGeQjZuq6CYJO10KSPFKqWQ7fpC X-Received: by 2002:a05:6a21:81af:b0:18c:44d3:d314 with SMTP id pd47-20020a056a2181af00b0018c44d3d314mr8761068pzb.10.1702514921314; Wed, 13 Dec 2023 16:48:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702514921; cv=none; d=google.com; s=arc-20160816; b=vWTS+zsXY5eEgvOTR0AlNceawkuuMptLVXJxQB7NdYdrmaVQsfVCe5AGNgQulJpn1P uApcqEJrlxlsv4jUN8XCEcWm6RLtEDDD1yiG/3ANQV/eR4rkpTse1cSc0z3QzM48BoCs iCRlVXsVy4X9poOBSrrOxuEzXMDpCkFFHvQLff0AI3YAOkiw1mPcjW4tR5zNNolo+V30 a5ueAZWlcNTcODPhKC01MY9FXf+JfsSFlSA9hrfsszRhleyvDA8fyRgzZkwL2/wmplTA IDxEDlxFvIiXaZoxeZUnWTg4kudfniAc/GLr2DSUfq1k8ZB5fM5YAzut454qz/AT3qbj Sr+Q== 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=fOHzqh8IZvvUQEcAVUngjlYsg+ArhHiPZJoDS72WUGY=; fh=R37Itr4vM4DSdM7nCVEJRaUzpyR01xRhpmD5Puf7xME=; b=vm6+1UaMbMcGNmXI+LAL9fnA8oWVHARCM8u+Zb34GVUK2LdN6CwPllGKUt1oFEjIxc Tind4OLHV90QHZ3oB1y7WJdzELTM5uf91/G3LEeLBqF1KRse2G2MZH4V+z9KgF8ANnuV icuJNkZtDoXeI4wTfrL5yCZJmX2+irwnephu6klJWwsKJvQEl8imgnLiOLufIEcHtKmV cXEGMWbVzXbBeIokVtKjEPoww4KwCH046Nhw5MsqCpKhhd4+ZwLhsFF63wVPlJdSD7Uj cgHeknnbig1/G4hdeZVgFwbCoYHH4qAs6CFrSLosgVPCrVdTguiUnomWyIFFPeH/ya9q ZEoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mE3jhmI4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id kq8-20020a056a004b0800b0069026fd5a48si10115623pfb.34.2023.12.13.16.48.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 16:48:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mE3jhmI4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DC18280236E0; Wed, 13 Dec 2023 16:48:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234206AbjLNAsC (ORCPT + 99 others); Wed, 13 Dec 2023 19:48:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442894AbjLNAr4 (ORCPT ); Wed, 13 Dec 2023 19:47:56 -0500 Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [IPv6:2001:41d0:203:375::b5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF5BBA3 for ; Wed, 13 Dec 2023 16:48:02 -0800 (PST) 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=1702514881; 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=fOHzqh8IZvvUQEcAVUngjlYsg+ArhHiPZJoDS72WUGY=; b=mE3jhmI4IuQyy9Oj7FbJ4UWoTg80r8UlyLdLcotJ2d/EbCumZB6ZIk/usRDEldWY+o2Do0 taeItiOWOIa0q4b6vqwJB8QO9mSeuaXO84ASNC46APW3IbCNy6spdT/VnDOv9ZjJh/7OiI jNBCabIu/dOKWGrgx7tbKL2hH4yxYFI= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Tetsuo Handa , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH -v2 mm 3/4] kasan: memset free track in qlink_free Date: Thu, 14 Dec 2023 01:47:53 +0100 Message-Id: <39bbc4d0bc72dfaf02f9dc63ee6f25a8f3a1719c.1702514411.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Dec 2023 16:48:39 -0800 (PST) From: Andrey Konovalov Instead of only zeroing out the stack depot handle when evicting the free stack trace in qlink_free, zero out the whole track. Do this just to produce a similar effect for alloc and free meta. The other fields of the free track besides the stack trace handle are considered invalid at this point anyway, so no harm in zeroing them out. Fixes: 773688a6cb24 ("kasan: use stack_depot_put for Generic mode") Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov --- mm/kasan/quarantine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c index 265ca2bbe2dd..782e045da911 100644 --- a/mm/kasan/quarantine.c +++ b/mm/kasan/quarantine.c @@ -157,7 +157,7 @@ static void qlink_free(struct qlist_node *qlink, struct kmem_cache *cache) if (free_meta && *(u8 *)kasan_mem_to_shadow(object) == KASAN_SLAB_FREETRACK) { stack_depot_put(free_meta->free_track.stack); - free_meta->free_track.stack = 0; + __memset(&free_meta->free_track, 0, sizeof(free_meta->free_track)); } /* -- 2.25.1