Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4323912rdb; Mon, 11 Dec 2023 16:16:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IF24zoObzR7kdw1sMoLKHsbjUhen5QLArcJvLFdRXXPvEWaABDCP9Y9oGBEZ8EKTZ3flXNB X-Received: by 2002:a05:6a00:2354:b0:6cd:e2c2:13d7 with SMTP id j20-20020a056a00235400b006cde2c213d7mr6846552pfj.23.1702340176847; Mon, 11 Dec 2023 16:16:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702340176; cv=none; d=google.com; s=arc-20160816; b=Mi+mspBdhqAADqWkoi6UXTgRJxcaed6goqQLaWzyzW4FHrARsY4c22r2I8X+oDN8gF AO3ZEkjS0Bk4TvNuy2L+DHjqqPmggbXLhyavOR4xMG7n5HIUP0n8zMXhd49UetdTyedB wSqZ0LnsnWoonob6Nx67kpIoSSQc02JswMDzemwuEhw1scmLwVKKJMN6etwINRzL0ga1 SanrvG6B2MVL8pC8y2xy7kO87jasLFz/bzO/xjP6CC681BrHq+bFw4yBGaYXdt1sVYhj wQYazFTxwGHQhWPwYbDzyqgOEIGWzMLee3mQykAPzks/zDNGat8Ow13fKXRm5By5u5Ew 9bog== 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=OwbAGppKL3WPs8Dt+2mYc7aec7Z15bPqx/lY8lY4n/4=; fh=R37Itr4vM4DSdM7nCVEJRaUzpyR01xRhpmD5Puf7xME=; b=w6kVh1k61o3v2aDUaQ27QyAFVAMjaVkf0s86OxQidtgZd0BvrbC0qfJBzIVR5bfOgt l0vaIeZV8+btVanBQa8Fhjq4HOUs1VNk5ysOiHCBy4++MQ9pPEV/LMJRsPww4Gz9l4R1 YlC1aRbSyMwA5B4ItT1m6LBWtWEEX9/6vMabcIZJsVT39WjiPikMMDOq9zc2wel41M0C pjv9glvlC0/BT1m7fOQDWkwdIzi7N0pAB4hdeEfw23hmD69on17n39USP9vuhR9fI6aa 9qMb1oonwjQd3oKljLaZP0/H6e1sJqPwI+ydbVsdFig32gao2fTgqOWOm6Cu8GRfR6qi WSvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=AhuNEvWc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bw10-20020a056a00408a00b006ce4e9187b4si6923916pfb.370.2023.12.11.16.16.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 16:16:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=AhuNEvWc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 AAB11807BA2C; Mon, 11 Dec 2023 16:15:18 -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 S1345460AbjLLAOJ (ORCPT + 99 others); Mon, 11 Dec 2023 19:14:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345418AbjLLAOF (ORCPT ); Mon, 11 Dec 2023 19:14:05 -0500 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [IPv6:2001:41d0:203:375::b0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 170FBB5 for ; Mon, 11 Dec 2023 16:14:12 -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=1702340050; 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=OwbAGppKL3WPs8Dt+2mYc7aec7Z15bPqx/lY8lY4n/4=; b=AhuNEvWc+xId+ebmaR6PLfGdXFqw+Wg1SNRrPQ1ZlK1Sc1etaByaW4J7PAGKThBVnj447n j8TePKCfHAMCJ1KwilljkT2LUfiq2L5u0pH0HA7XJfeRd1JbF++UGx/w+zfsttHD227a+f IZQYQmT7JGekNhMS5pIy488rlfoaazI= 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 mm 3/4] kasan: memset free track in qlink_free Date: Tue, 12 Dec 2023 01:14:02 +0100 Message-Id: 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]); Mon, 11 Dec 2023 16:15:18 -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. Signed-off-by: Andrey Konovalov --- This can be squashed into "kasan: use stack_depot_put for Generic mode" or left standalone. --- 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