From patchwork Tue Dec 19 21:19:52 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: 13499118 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2081C41535 for ; Tue, 19 Dec 2023 21:20:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65F5E6B007E; Tue, 19 Dec 2023 16:20:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E6FD6B0080; Tue, 19 Dec 2023 16:20:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4618B6B0081; Tue, 19 Dec 2023 16:20:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1F9EC6B0080 for ; Tue, 19 Dec 2023 16:20:02 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id F38181A044D for ; Tue, 19 Dec 2023 21:20:01 +0000 (UTC) X-FDA: 81584835444.30.6DFF07F Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) by imf22.hostedemail.com (Postfix) with ESMTP id 3EA8CC000A for ; Tue, 19 Dec 2023 21:20:00 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=qSi6bCK8; spf=pass (imf22.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.185 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703020800; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fOHzqh8IZvvUQEcAVUngjlYsg+ArhHiPZJoDS72WUGY=; b=aABxJ8YdNyB6FW0PHYybFA4MTcvSRvdV0LeT+9WA1DaNHsgSqJwbE7nzSORG/nxcOrHa9Q P2gNw+tZrGn83XAupje1gRtvlpe4KlKYFP5X4SUNwFpTEU3veUU4BV9U08E4GS6YWplI8m IcFmC3mx8Btau9F/D35S2aIivP4p9VQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703020800; a=rsa-sha256; cv=none; b=EfmLaNgzpf688rFby96U08TgOvlO/2uiHCgqXpcVdfo2uCchbfrN84AvW+CrmMINd2HABC hEpwSFE3MMWoTdJx69d73nJ6A0MC7QqRph1pOApP5lk/CClbjXw/OXJM702xrWG0zuFsvH Te9onLo6X65uzTYPns73aGh7xWebbRQ= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=qSi6bCK8; spf=pass (imf22.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.185 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev 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=1703020798; 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=qSi6bCK82bZzb5eDpiDbrLAgv900bdtXCroZwQk+HMxNuCcAH6RDEUBSEuZXglh3sQ52dp y4hliOr/Z2u8q2lAKSTk3GSjbIMKCqYtE46R+/r0JsXgn8CkNa8Ohm/TliCh9Gv/qOmJ9H dqjaS5WqDKLwR54ujuGm3mhTRxi7Yx0= 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 v3 mm 3/4] kasan: memset free track in qlink_free Date: Tue, 19 Dec 2023 22:19:52 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 3EA8CC000A X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 5oojmbcjqpbs34j9zduhwopjie6xw4aw X-HE-Tag: 1703020800-548066 X-HE-Meta: U2FsdGVkX18zpWD7sYIhTeFWppLtsvTXDrIEyiQKwHuMldWm/5qxoYHBh/hiC4mwMJLmVFH4S0VDCLW2WKMfTS4DyrMfNVool1luVh+NVb/DxjVnZ5W1buwQ40p0mC+hHfwY21M80vIH1UfVFVvtKcgpE4QeCBNblGrm9e9SJnCp+Zum0vAWwOMNn7htSPX9cIwBFYPFZFVg32Kuxw5z+EGaAW3skIEBznWldem0UwaLpS4t1o5RK9tunJbJUJa3kl+xq2K6RO7yzJgqncEnEoKRvh3QSeBaIfnsZAv75PyeLSjDKAVOm5QAs/hi3UZ23uk0TYzdkEYJBxjN8XWUrMeCbDLJ1u6QJ3+qZsUNtZ4xacNruAsXR417kroTagU1J489yYjOkLtoI8X/Ualk4CFCMPCBrjFQWb/MIfCL0T39krqi+AIJYk8fo/z7AINtR/PwrWRoOQ734jJYJ1EEUAbQYYWWWS7LnZRErxswTPwhxahMHG1RBj6Lcld153WI7ExvH5yh1f2Q8ReMgW04eJ8yed6ZmzzZPkExTcktv9QEGskwvYQeGKuWLVYtru9WzxUL4r4tQG3d2D3bb+FlFAKnk5jxh7gtUo/+G9vZdpIJNuwk2qfaC1Y9q6KX6AZjieOfoDXk6LAqOhOAhVrtEfkt+jPMVFe3Ct9SLEBBl7+KVEJsR9uqI6IYX7m/w7yrimZn5s4aw8G8dy7acSVq4n6cv2at2Ipb/OTAngU3g8MuWxxDFhAncKzmqFSwpiBAxVWiopW6fwhxZTjXCciu7YNw8iGaN/2dyGAmxZxOw5tZIQoV+oADjqu5P2dLnHANuvdDP3s/TPTah2I7ePhbeHnLsu00gmjjOuxoBZWUT5nUJhiVfOLuaUam5alrP+Nm3dwhCckkEo+ka5z1e/s6v5AgudtxeQfv0nGhz3wxmoNwApJTO9s5taoGP3eoaV77maWnFrVSd+sJpTE/o9V 9F7NPcMn tFH0kxMBm+6aGt6QSk2u5jJYspyE7rqUzAyYBVwmoaKQqFXWwFdZ9zCr2J3kNFY9Mw6Ujf5YfCjTHpf6L2UIe1kMSE98vDWoYR0+kWZHfGXuA/YE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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)); } /*