From patchwork Thu Dec 14 00:47:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 178392 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8222984dys; Wed, 13 Dec 2023 16:48:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUfkTwxC5sJIpcfOzFO739sgc6MQ3ztJBaf9K15p941D1FsTAuMF50kOPBhHMlaRDymEKQ X-Received: by 2002:a05:6a00:190c:b0:6be:130a:22a0 with SMTP id y12-20020a056a00190c00b006be130a22a0mr11458229pfi.14.1702514917752; Wed, 13 Dec 2023 16:48:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702514917; cv=none; d=google.com; s=arc-20160816; b=xK7tF708Khm99qPJosr+fvg6aGfGMda7AWds3D3fxGrJjtSvPwSOp7Uqawjt/iszXV XSktWd7cIQm1FePtnW7ypHBXJRhny2jCdofyMH4vDtMStJUBXUUbnaMFCTNZLT3f2RJe YBv0M7OOgxLBIdfVxnChEr0Zlww7i/YWqr92BNQAltUvYlQqBhc30gvS66tXhffQ1R9/ HTEpt44A3aj7jnOh647skZqyaa31tIgwWiqfzPiv24VKRpqMam94s+o+FVs76sHKCYCa 6kr69Hp6oGwpxIPpmtttbgnN5APnjSUcsoS/sDPOAxU81pBsK3x2ac74Rqtf/7e89EU1 lGhQ== 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 Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id fh13-20020a056a00390d00b006cefb653cecsi7695941pfb.146.2023.12.13.16.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 16:48:37 -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 0FBAE8022C4E; Wed, 13 Dec 2023 16:48:35 -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 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:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785216282455319579 X-GMAIL-MSGID: 1785216282455319579 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)); } /*